Skip to content

Commit

Permalink
add test ssh connection command and pause before check
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Nov 26, 2024
1 parent 7550d1d commit 67e39a4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/wolfsshd/test/sshd_term_close_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openssl-1.1.1/lib
# get the current wolfsshd pid count to compare with
WOLFSSHD_PID_COUNT=$(pgrep wolfsshd | wc -l)

COMMAND="timeout 2 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"sleep 10\""
COMMAND="$TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"echo test\""
echo "$COMMAND"
set -e
$COMMAND
set +e

COMMAND="timeout 3 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"sleep 10\""
echo "$COMMAND &"
$COMMAND &
sleep 1
WOLFSSHD_PID_COUNT_AFTER=$(pgrep wolfsshd | wc -l)
if [ "$WOLFSSHD_PID_COUNT" = "$WOLFSSHD_PID_COUNT_AFTER" ]; then
echo "Expecting another wolfSSHd pid after connection"
echo "PID count before = $WOLFSSHD_PID_COUNT"
echo "PID count after = $WOLFSSHD_PID_COUNT_AFTER"
exit 1
fi

netstat -nt | grep ESTABLISHED
RESULT=$?
if [ "$RESULT" != "0" ]; then
Expand Down

0 comments on commit 67e39a4

Please sign in to comment.