Skip to content

Commit

Permalink
fixup! tests: revert to using netcat for sending passphrase to nested vm
Browse files Browse the repository at this point in the history
using tcp socket file caused the VM to keep waiting

Signed-off-by: Zeyad Gouda <[email protected]>
  • Loading branch information
ZeyadYasser committed Jan 28, 2025
1 parent c26ec1b commit c08093a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/lib/external/snapd-testing-tools/remote/remote.wait-for
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -xe

# The default values have been selected trying to match with most of
# the wait times in the tests and also trying to follow common sense.
Expand Down Expand Up @@ -123,7 +123,7 @@ wait_for_reboot() {
# Wait for passphrase prompt from serial log file.
if MATCH "Please enter the passphrase" < ${log_file}; then
# Enter passphrase to continue boot.
echo "$expect_passphrase" > /dev/tcp/localhost/7777
echo "$expect_passphrase" | netcat -N localhost 7777
break
fi
sleep "$wait"
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/nested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ nested_start_core_vm_unit() {
# Wait for passphrase prompt from serial log file.
retry -n 120 --wait 1 sh -c "MATCH \"Please enter the passphrase\" < ${NESTED_LOGS_DIR}/serial.log"
# Enter passphrase to continue boot.
echo "$EXPECT_PASSPHRASE" > /dev/tcp/localhost/7777
echo "$EXPECT_PASSPHRASE" | netcat -N localhost 7777
fi

local EXPECT_SHUTDOWN
Expand Down Expand Up @@ -1608,7 +1608,7 @@ nested_start_classic_vm() {
# XXX: remove once we no longer support xenial hosts
PARAM_SERIAL="-serial file:${NESTED_LOGS_DIR}/serial.log"
else
PARAM_SERIAL="-chardev socket,path=${NESTED_LOGS_DIR}/serial.sock,server=on,wait=off,id=char0,logfile=${NESTED_LOGS_DIR}/serial.log,logappend=on -serial chardev:char0"
PARAM_SERIAL="-chardev socket,telnet=on,host=localhost,server=on,port=7777,wait=off,id=char0,logfile=${NESTED_LOGS_DIR}/serial.log,logappend=on -serial chardev:char0"
fi
PARAM_BIOS=""
PARAM_TPM=""
Expand Down

0 comments on commit c08093a

Please sign in to comment.