Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: retry prod test 3 times #485

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified tests/end2end_tests/contexts/sshnpd/test.sh
100644 → 100755
Empty file.
44 changes: 28 additions & 16 deletions tests/end2end_tests/entrypoints/sshnp_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
#!/bin/bash
echo "SSHNP START ENTRY"
SSHNP_COMMAND="$HOME/.local/bin/sshnp -f @sshnpatsign -t @sshnpdatsign -d deviceName -h @sshrvdatsign -s id_ed25519.pub -v > sshnp.log"
echo "Running: $SSHNP_COMMAND"
eval "$SSHNP_COMMAND"
cat sshnp.log
tail -n 5 sshnp.log | grep "ssh -p" > sshcommand.txt

if [ ! -s sshcommand.txt ]; then
# try again
run_test()
{
echo "Running: $SSHNP_COMMAND"
eval "$SSHNP_COMMAND"
cat sshnp.log
tail -n 5 sshnp.log | grep "ssh -p" > sshcommand.txt
tail -n 20 sshnp.log | grep "ssh -p" > sshcommand.txt

# if sshcommand is empty, exit code 1
if [ ! -s sshcommand.txt ]; then
echo "could not find 'ssh -p' command in sshnp.log"
echo "last 5 lines of sshnp.log:"
tail -n 5 sshnp.log || echo
exit 1
echo "sshcommand.txt is empty"
return 1
fi
fi
echo "$(sed '1!d' sshcommand.txt) -o StrictHostKeyChecking=no " > sshcommand.txt ;
echo "ssh -p command: $(cat sshcommand.txt)"
echo "sh test.sh " | eval "$(cat sshcommand.txt)"
sleep 2 # time for ssh connection to properly exit

sed '1!d' sshcommand.txt
echo "ssh -p command: $(cat sshcommand.txt)"
echo "./test.sh " | eval "$(cat sshcommand.txt)"
sleep 2 # time for ssh connection to properly exit
}

main()
{
# run test 3 times, while run_test is not successful
for i in {1..3}
do
run_test
if [ $? -eq 0 ]; then
exit 0
fi
sleep 5
done
}

main