Skip to content

Commit

Permalink
ci:
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyTubongbanua committed Jul 5, 2023
1 parent e43686d commit 6ebd23f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/sshnoports/test/end2end_tests/command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-o StrictHostKeyChecking=no
; exit 0
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#!/bin/bash
sleep 2
~/.local/bin/sshnp -f @jeremy_0 -t @smoothalligator -d docker -h @rv_am -s id_ed25519.pub -v
~/.local/bin/sshnp -f @jeremy_0 -t @smoothalligator -d sad -h @rv_am -s id_ed25519.pub -v > logs.txt
cat logs.txt
tail -n 5 logs.txt | grep "ssh -p" > command.txt

# if command.txt is empty, exit 1
if [ ! -s command.txt ]
then
echo "command.txt is empty"
tail -n 1 logs.txt || echo
exit 1
fi

echo " -o StrictHostKeyChecking=no " >> command.txt ;
echo " -tt " >> command.txt ;
echo "sh test.sh && exit" | $(cat command.txt)
exit
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
~/.local/bin/sshnpd -a @smoothalligator -m @jeremy_0 -d docker -s -u -v
echo "Test Passed" > test.txt
~/.local/bin/sshnpd -a @smoothalligator -m @jeremy_0 -d sad -s -u -v
11 changes: 11 additions & 0 deletions packages/sshnoports/test/end2end_tests/contexts/sshnpd/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# this is script is meant to be run by the sshnp container.
# cat test.txt and check if "test passed" exit 0, otherwise exit 1
cat test.txt | grep "Test Passed"
if [ $? -eq 0 ]
then
echo "Test Passed"
exit 0
fi
echo "Test Failed"
exit 1
3 changes: 2 additions & 1 deletion packages/sshnoports/test/end2end_tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ services:
container_name: sshnpd_trunk
volumes:
- ./contexts/sshnpd/keys/:/atsign/.atsign/keys/ # mount keys
- ./contexts/sshnpd/entrypoint.sh:/atsign/entrypoint.sh # mount entrypoint
- ./contexts/sshnpd/entrypoint.sh:/atsign/entrypoint.sh # mount entrypoint.sh
- ./contexts/sshnpd/test.sh:/atsign/test.sh # mount test.sh
networks:
- sshnpd
depends_on:
Expand Down

0 comments on commit 6ebd23f

Please sign in to comment.