Skip to content

Commit e2bcc80

Browse files
committed
CI: add tests for mina misc mina-key-pair command
1 parent ffd6a8a commit e2bcc80

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Test the mina misc mina-key-pair command
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
9+
cd "$REPO_ROOT"
10+
11+
MINA_BIN="${MINA_BIN:-./target/release/mina}"
12+
13+
echo "Testing: mina misc mina-key-pair"
14+
echo ""
15+
16+
# Test 1: Basic mina-key-pair command
17+
echo "Test 1: mina misc mina-key-pair (basic)"
18+
if "$MINA_BIN" misc mina-key-pair > /dev/null 2>&1; then
19+
echo "✓ Command executed successfully"
20+
else
21+
echo "✗ Test failed: Command failed to execute"
22+
exit 1
23+
fi
24+
echo ""
25+
26+
# Test 2: mina-key-pair with --web-node-secrets flag
27+
echo "Test 2: mina misc mina-key-pair --web-node-secrets"
28+
OUTPUT=$("$MINA_BIN" misc mina-key-pair --web-node-secrets)
29+
30+
# Verify command executed successfully
31+
if [ $? -ne 0 ]; then
32+
echo "✗ Test failed: Command failed to execute"
33+
exit 1
34+
fi
35+
echo "✓ Command executed successfully"
36+
37+
# Verify output is valid JSON
38+
if ! echo "$OUTPUT" | jq empty 2>/dev/null; then
39+
echo "✗ Test failed: Output is not valid JSON"
40+
echo "Output was: $OUTPUT"
41+
exit 1
42+
fi
43+
echo "✓ Output is valid JSON"
44+
45+
# Verify JSON contains "publicKey" field with a string value
46+
PUBLIC_KEY=$(echo "$OUTPUT" | jq -r '.publicKey' 2>/dev/null)
47+
if [ -z "$PUBLIC_KEY" ] || [ "$PUBLIC_KEY" = "null" ]; then
48+
echo " Test failed: JSON does not contain 'publicKey' field with a string value"
49+
echo "Output was: $OUTPUT"
50+
exit 1
51+
fi
52+
echo "✓ JSON contains 'publicKey' field with value: $PUBLIC_KEY"
53+
54+
# Verify JSON contains "privateKey" field with a string value
55+
PRIVATE_KEY=$(echo "$OUTPUT" | jq -r '.privateKey' 2>/dev/null)
56+
if [ -z "$PRIVATE_KEY" ] || [ "$PRIVATE_KEY" = "null" ]; then
57+
echo "✗ Test failed: JSON does not contain 'privateKey' field with a string value"
58+
echo "Output was: $OUTPUT"
59+
exit 1
60+
fi
61+
echo "✓ JSON contains 'privateKey' field with value: [REDACTED]"
62+
63+
echo ""
64+
echo "✓ All tests passed!"

.github/workflows/tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ jobs:
228228
- name: Test OCaml-specific GraphQL endpoints
229229
run: ./.github/scripts/test-ocaml-specific-endpoints.sh
230230

231+
- name: Test mina misc mina-key-pair command
232+
run: ./.github/scripts/test-misc-mina-key-pair.sh
233+
231234
- name: Upload binaries
232235
uses: actions/upload-artifact@v5
233236
with:

0 commit comments

Comments
 (0)