]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - tests/server.wv
tests: Check that server ssh login works and reenable server tests
[novaboot.git] / tests / server.wv
index 2fcbed01e2941f07e398967c8ab67e9a9e07f347..62d0f8d89dce89a7f0fba3db10ad8529fe35dcd5 100755 (executable)
@@ -59,6 +59,29 @@ EOF
     WVPASS run_server console | WVPASS grep -F 'Hello console'
 )
 
+WVSTART "default_cmd can be set to run_novaboot"
+(
+    export NOVABOOT_SHELL_CONFIG="./.novaboot-shell"
+    cat <<EOF > default_nb_script
+run echo "Hello default_nb_script"
+EOF
+    cat <<'EOF' > $NOVABOOT_SHELL_CONFIG
+default_cmd='run_novaboot default_nb_script --scriptmod=s/default_nb_script/default_nb_script_mod/'
+console_cmd='while sleep 0.01; do echo "Hello console"; done'
+reset_cmd='echo "Hello reset"'
+target_config="\
+--name=some name with spaces and hash #
+--exiton=Hello console
+"
+EOF
+    WVPASS run_server | (
+        stdout=$(cat)
+        WVPASS grep -F 'Hello default_nb_script' <<<"$stdout"
+        WVPASS grep -F 'Hello default_nb_script_mod' <<<"$stdout"
+        WVPASS grep -F 'Hello console' <<<"$stdout"
+    )
+)
+
 WVSTART 'Second connection to console prints queue'
 coproc console1 { exec_server console; }
 WVPASS sed -e '/novaboot-shell: Connected/q0' -e '3q1' <&${console1[0]}
@@ -163,13 +186,15 @@ WVPASS test -n "$SSH_AUTH_SOCK" || exit 1
 if [ ! -f id_rsa ]; then
     ssh-keygen -t rsa -C "generated by $0" -N '' -f ./id_rsa
 fi
+ID_RSA=$(realpath ./id_rsa)
 WVPASS ssh-add ./id_rsa
 
 WVSTART "Setup SSH server's admin key"
 WVPASS sudo_ mkdir -p $(dirname "$AUTH")
 WVPASS sudo_ chmod 700 $(dirname "$AUTH")
-WVPASS sudo_ tee "$AUTH" <<<"command=\"user test admin\" $(cat ./id_rsa.pub)"
-exit
+WVPASS sudo_ tee "$AUTH" <<<"command=\"user test admin\" $(cat "$ID_RSA".pub)"
+# Check that we can really log in
+WVPASS ssh novaboot-test@localhost help
 
 WVSTART "Novaboot --ssh option (connect, rsync, reset)"
 WVPASS sudo_ rm -rf "$TFTPROOT"