From bf9c48fa71989db71c3febc2ec47804364c32c16 Mon Sep 17 00:00:00 2001 From: JeremyTubongbanua Date: Mon, 18 Sep 2023 10:24:30 -0400 Subject: [PATCH 1/5] feat: remove `-o StrictHostKeyChecking=no` --- tests/end2end_tests/entrypoints/sshnp_entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh index 4ca29872e..10d7aeefc 100644 --- a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh +++ b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh @@ -19,7 +19,7 @@ if [ ! -s sshcommand.txt ]; then exit 1 fi fi -echo "$(sed '1!d' sshcommand.txt) -o StrictHostKeyChecking=no " > sshcommand.txt ; +echo "$(sed '1!d' sshcommand.txt)" > 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 From 999be04f0c77e7398966213b4709e19cabf37699 Mon Sep 17 00:00:00 2001 From: JeremyTubongbanua Date: Mon, 18 Sep 2023 10:28:01 -0400 Subject: [PATCH 2/5] chore: chmod +x test.sh --- tests/end2end_tests/contexts/sshnpd/test.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tests/end2end_tests/contexts/sshnpd/test.sh diff --git a/tests/end2end_tests/contexts/sshnpd/test.sh b/tests/end2end_tests/contexts/sshnpd/test.sh old mode 100644 new mode 100755 From 4df32e90d71fd262b7a728b3698165ba6acbeb46 Mon Sep 17 00:00:00 2001 From: JeremyTubongbanua Date: Mon, 18 Sep 2023 10:28:51 -0400 Subject: [PATCH 3/5] ci: sshnp entry point attempt 3 times --- .../entrypoints/sshnp_entrypoint.sh | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh index 10d7aeefc..c208c7835 100644 --- a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh +++ b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh @@ -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)" > 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 + echo "Test Passed" + exit 0 + fi + done +} + +main From afb34332a6e5e7f000301c0fab9f20b29f06114c Mon Sep 17 00:00:00 2001 From: JeremyTubongbanua Date: Mon, 18 Sep 2023 10:30:35 -0400 Subject: [PATCH 4/5] ci: sleep in between attempts --- tests/end2end_tests/entrypoints/sshnp_entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh index c208c7835..3539f1985 100644 --- a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh +++ b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh @@ -14,7 +14,7 @@ run_test() echo "sshcommand.txt is empty" return 1 fi - + sed '1!d' sshcommand.txt echo "ssh -p command: $(cat sshcommand.txt)" echo "./test.sh " | eval "$(cat sshcommand.txt)" @@ -31,6 +31,7 @@ main() echo "Test Passed" exit 0 fi + sleep 5 done } From 0fa09b16fe94c7f3d2eb1c485361c04e7e94cb89 Mon Sep 17 00:00:00 2001 From: JeremyTubongbanua Date: Mon, 18 Sep 2023 10:33:22 -0400 Subject: [PATCH 5/5] chore: remove duplicate "Test Passed" --- tests/end2end_tests/entrypoints/sshnp_entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh index 3539f1985..0bf8feaca 100644 --- a/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh +++ b/tests/end2end_tests/entrypoints/sshnp_entrypoint.sh @@ -28,7 +28,6 @@ main() do run_test if [ $? -eq 0 ]; then - echo "Test Passed" exit 0 fi sleep 5