Skip to content

Commit 8bf68d5

Browse files
committed
Wallet e2e tests: use environment variable for endpoint
1 parent 0e0e670 commit 8bf68d5

File tree

7 files changed

+67
-18
lines changed

7 files changed

+67
-18
lines changed

.github/scripts/wallet/test-balance-from-key.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet balance command with --from key file (text format)
64

5+
# Check for required environment variables before enabling strict mode
6+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
7+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
8+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
9+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
10+
exit 1
11+
fi
12+
13+
set -euo pipefail
14+
715
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
816
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
917
cd "$REPO_ROOT"
@@ -14,7 +22,7 @@ PASSWORD="test-password"
1422

1523
echo "Test: Verify --from option works with key file (text format)"
1624
export MINA_PRIVKEY_PASS="$PASSWORD"
17-
BALANCE_OUTPUT=$(./target/release/mina wallet balance --from "$KEY_FILE" --endpoint "http://mina-rust-plain-1.gcp.o1test.net/graphql" --format text 2>&1 || true)
25+
BALANCE_OUTPUT=$(./target/release/mina wallet balance --from "$KEY_FILE" --endpoint "$MINA_NODE_ENDPOINT" --format text 2>&1 || true)
1826

1927
echo "Balance command output:"
2028
echo "$BALANCE_OUTPUT"

.github/scripts/wallet/test-balance-json-format.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet balance command JSON format output structure
64

5+
# Check for required environment variables before enabling strict mode
6+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
7+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
8+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
9+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
10+
exit 1
11+
fi
12+
13+
set -euo pipefail
14+
715
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
816
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
917
cd "$REPO_ROOT"
@@ -18,7 +26,7 @@ fi
1826
echo "Test: Verify JSON format output structure"
1927
JSON_OUTPUT=$(./target/release/mina wallet balance \
2028
--address "B62qkiqPXFDayJV8JutYvjerERZ35EKrdmdcXh3j1rDUHRs1bJkFFcX" \
21-
--endpoint "http://mina-rust-plain-1.gcp.o1test.net/graphql" \
29+
--endpoint "$MINA_NODE_ENDPOINT" \
2230
--format json 2>&1 || true)
2331

2432
echo "JSON format output:"

.github/scripts/wallet/test-balance-json.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet balance command with --address (JSON format)
64

5+
# Check for required environment variables before enabling strict mode
6+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
7+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
8+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
9+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
10+
exit 1
11+
fi
12+
13+
set -euo pipefail
14+
715
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
816
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
917
cd "$REPO_ROOT"
@@ -19,7 +27,7 @@ fi
1927
PUBLIC_KEY=$(cat "tests/files/accounts/test-block-producer.pub")
2028

2129
echo "Test: Verify --address option works with public key (JSON format)"
22-
BALANCE_JSON=$(./target/release/mina wallet balance --address "$PUBLIC_KEY" --endpoint "http://mina-rust-plain-1.gcp.o1test.net/graphql" --format json 2>&1 || true)
30+
BALANCE_JSON=$(./target/release/mina wallet balance --address "$PUBLIC_KEY" --endpoint "$MINA_NODE_ENDPOINT" --format json 2>&1 || true)
2331

2432
echo "Balance command output:"
2533
echo "$BALANCE_JSON"

.github/scripts/wallet/test-balance-no-account.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet balance command error when no account specified
64

5+
# Check for required environment variables before enabling strict mode
6+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
7+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
8+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
9+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
10+
exit 1
11+
fi
12+
13+
set -euo pipefail
14+
715
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
816
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
917
cd "$REPO_ROOT"
1018

1119
echo "Test: Verify error when no account specified"
12-
ERROR_OUTPUT=$(./target/release/mina wallet balance --endpoint "http://mina-rust-plain-1.gcp.o1test.net/graphql" 2>&1 || true)
20+
ERROR_OUTPUT=$(./target/release/mina wallet balance --endpoint "$MINA_NODE_ENDPOINT" 2>&1 || true)
1321

1422
echo "Command output:"
1523
echo "$ERROR_OUTPUT"

.github/scripts/wallet/test-balance-text-format.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet balance command text format output structure
64

5+
# Check for required environment variables before enabling strict mode
6+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
7+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
8+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
9+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
10+
exit 1
11+
fi
12+
13+
set -euo pipefail
14+
715
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
816
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
917
cd "$REPO_ROOT"
1018

1119
echo "Test: Verify text format output structure"
1220
TEXT_OUTPUT=$(./target/release/mina wallet balance \
1321
--address "B62qkiqPXFDayJV8JutYvjerERZ35EKrdmdcXh3j1rDUHRs1bJkFFcX" \
14-
--endpoint "http://mina-rust-plain-1.gcp.o1test.net/graphql" \
22+
--endpoint "$MINA_NODE_ENDPOINT" \
1523
--format text 2>&1 || true)
1624

1725
echo "Text format output:"

.github/scripts/wallet/test-send.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
#!/bin/bash
22

3-
set -euo pipefail
4-
53
# Test the wallet send command by sending a transaction to the same account
64
# Uses a very small fee to avoid draining the account on each PR
75

6+
# Check for required environment variables before enabling strict mode
7+
if [ -z "${MINA_NODE_ENDPOINT:-}" ]; then
8+
echo "Error: MINA_NODE_ENDPOINT environment variable is not set"
9+
echo "Please set it to a GraphQL endpoint URL, e.g.:"
10+
echo " export MINA_NODE_ENDPOINT=http://mina-rust-plain-1.gcp.o1test.net/graphql"
11+
exit 1
12+
fi
13+
14+
set -euo pipefail
15+
816
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
917
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
1018
cd "$REPO_ROOT"
1119

1220
# Define test parameters
1321
KEY_FILE="tests/files/accounts/test-wallet"
1422
PUBKEY_FILE="tests/files/accounts/test-wallet.pub"
15-
NODE_ENDPOINT="${MINA_NODE_ENDPOINT:-http://mina-rust-plain-1.gcp.o1test.net/graphql}"
23+
NODE_ENDPOINT="$MINA_NODE_ENDPOINT"
1624

1725
# Password from environment variable (set in GitHub secrets)
1826
# Default to "test" for local testing

.github/workflows/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ jobs:
264264
- name: Run wallet tests
265265
env:
266266
MINA_PRIVKEY_PASS: ${{ secrets.MINA_PRIVKEY_PASS }}
267+
MINA_NODE_ENDPOINT: http://mina-rust-plain-1.gcp.o1test.net/graphql
267268
run: make test-wallet
268269

269270
build-tests:

0 commit comments

Comments
 (0)