-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
executable file
·44 lines (30 loc) · 895 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
export BOOTSTRAP_LOG="test.log"
echo "" > $BOOTSTRAP_LOG
source .functions.sh
trap 'kill $(jobs -p)' EXIT
ssh-keygen -f ~/.ssh/known_hosts -R [localhost]:2222
check "sshpass command" \
"which sshpass"
check "ssh command" \
"which ssh"
function sshc() {
sshpass -p 'lounge' ssh -p 2222 -oStrictHostKeyChecking=no -oConnectTimeout=10 root@localhost "$1" 2>> test.log
return $?
}
export -f sshc
#### main ####
[ $# -ne 3 ] || error "Usage: test.sh [amd64|armhf] <image>"
arch="$1"
image="$2"
./runimage.sh -a "$arch" -n "$image" &>> $BOOTSTRAP_LOG &
check "Wait 120 seconds" \
"sleep 120"
check "Test ssh connectivity" \
'sshc id'
sleep 20
check "Test Janosh availability" \
"sshc '/lounge/bin/janosh hash'"
check "Test JanoshAPI availability" \
'[ "$(echo "Janosh:tprint({\"hi\"})" | sshc "bash -lc \"/lounge/bin/janosh -f /dev/stdin\"")" == "1: hi" ]'
exit 0