Skip to content

Commit 46cf936

Browse files
committed
CI: add more tests regarding encrypted key generation
1 parent 289eb12 commit 46cf936

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/doc-commands.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,61 @@ jobs:
8383
fi
8484
}
8585
86+
- name: Test generate-block-producer-key with custom filename
87+
run: |
88+
echo "Testing generate-block-producer-key with custom PRODUCER_KEY_FILENAME..."
89+
make generate-block-producer-key PRODUCER_KEY_FILENAME=./openmina-workdir/custom-producer-key
90+
91+
# Verify custom private key file exists
92+
if [ ! -f "./openmina-workdir/custom-producer-key" ]; then
93+
echo "❌ Custom producer key file was not generated"
94+
exit 1
95+
fi
96+
97+
# Verify custom public key file exists
98+
if [ ! -f "./openmina-workdir/custom-producer-key.pub" ]; then
99+
echo "❌ Custom producer public key file was not generated"
100+
exit 1
101+
fi
102+
103+
# Check file permissions (should be 600 for private key)
104+
PERMS=$(stat -c "%a" "./openmina-workdir/custom-producer-key")
105+
if [ "$PERMS" != "600" ]; then
106+
echo "❌ Custom producer key file has incorrect permissions: $PERMS (expected: 600)"
107+
exit 1
108+
fi
109+
110+
# Check both files are not empty
111+
if [ ! -s "./openmina-workdir/custom-producer-key" ]; then
112+
echo "❌ Custom producer key file is empty"
113+
exit 1
114+
fi
115+
116+
if [ ! -s "./openmina-workdir/custom-producer-key.pub" ]; then
117+
echo "❌ Custom producer public key file is empty"
118+
exit 1
119+
fi
120+
121+
echo "✅ Custom producer key pair generated successfully"
122+
123+
- name: Test generate-block-producer-key failure when keys exist
124+
run: |
125+
echo "Testing that generate-block-producer-key fails when keys already exist..."
126+
127+
# Try to generate keys again with default filename (should fail)
128+
if make generate-block-producer-key 2>/dev/null; then
129+
echo "❌ Command should have failed when keys already exist"
130+
exit 1
131+
fi
132+
133+
# Try to generate keys again with custom filename (should fail)
134+
if make generate-block-producer-key PRODUCER_KEY_FILENAME=./openmina-workdir/custom-producer-key 2>/dev/null; then
135+
echo "❌ Command should have failed when custom keys already exist"
136+
exit 1
137+
fi
138+
139+
echo "✅ Command correctly fails when keys already exist"
140+
86141
- name: Test other documented make targets exist
87142
run: |
88143
echo "Testing that documented make targets exist..."

0 commit comments

Comments
 (0)