Skip to content

Commit 78efe22

Browse files
committed
Update GitHub user keys in tests and adjust permission checks for integration tests
1 parent 1b7b7eb commit 78efe22

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
# Test user key mapping with public GitHub users
4949
declare -A USER_KEYS=(
5050
# Test with a known GitHub user that has public keys
51-
["testuser1"]="ghuser:octocat"
51+
["testuser1"]="ghuser:locus313"
5252
# Test with raw public key (using GitHub's public key endpoint)
53-
["testuser2"]="raw:https://github.com/octocat.keys"
53+
["testuser2"]="raw:https://github.com/locus313.keys"
5454
)
5555
EOF
5656
@@ -137,7 +137,7 @@ jobs:
137137
- name: Test GitHub user key fetching (mock)
138138
run: |
139139
# Test the curl command format for GitHub user keys
140-
curl -fsSL "https://github.com/octocat.keys" | head -5
140+
curl -fsSL "https://github.com/locus313.keys" | head -2
141141
echo "✓ GitHub user key endpoint is accessible"
142142
143143
- name: Test script version extraction
@@ -224,31 +224,34 @@ jobs:
224224
# Integration test configuration
225225
declare -A USER_KEYS=(
226226
# Use a real GitHub user with known public keys for integration testing
227-
["integrationuser"]="ghuser:octocat"
227+
["integrationuser"]="ghuser:locus313"
228228
)
229229
EOF
230230
231231
- name: Run integration test
232232
run: |
233-
# Run the script and verify it completes successfully
234-
./sync-ssh-keys.sh
233+
# Run the script with sudo and verify it completes successfully
234+
sudo ./sync-ssh-keys.sh
235235
236236
# Verify the authorized_keys file was created
237-
if [[ -f /home/integrationuser/.ssh/authorized_keys ]]; then
237+
if sudo test -f /home/integrationuser/.ssh/authorized_keys; then
238238
echo "✓ authorized_keys file created successfully"
239239
echo "File contents:"
240-
head -2 /home/integrationuser/.ssh/authorized_keys
240+
sudo head -2 /home/integrationuser/.ssh/authorized_keys
241241
echo "File permissions:"
242-
ls -la /home/integrationuser/.ssh/authorized_keys
242+
sudo ls -la /home/integrationuser/.ssh/authorized_keys
243243
else
244244
echo "✗ authorized_keys file was not created"
245+
echo "Directory contents:"
246+
sudo ls -la /home/integrationuser/ || true
247+
sudo ls -la /home/integrationuser/.ssh/ || true
245248
exit 1
246249
fi
247250
248251
- name: Verify file permissions
249252
run: |
250253
# Check SSH directory permissions
251-
PERMS=$(stat -c "%a" /home/integrationuser/.ssh)
254+
PERMS=$(sudo stat -c "%a" /home/integrationuser/.ssh)
252255
if [[ "$PERMS" == "700" ]]; then
253256
echo "✓ SSH directory permissions are correct (700)"
254257
else
@@ -257,7 +260,7 @@ jobs:
257260
fi
258261
259262
# Check authorized_keys file permissions
260-
PERMS=$(stat -c "%a" /home/integrationuser/.ssh/authorized_keys)
263+
PERMS=$(sudo stat -c "%a" /home/integrationuser/.ssh/authorized_keys)
261264
if [[ "$PERMS" == "600" ]]; then
262265
echo "✓ authorized_keys file permissions are correct (600)"
263266
else

0 commit comments

Comments
 (0)