Skip to content

Commit

Permalink
Fix command detection in the out-of-session test
Browse files Browse the repository at this point in the history
The `/tests/execute/reboot/out-of-session` test was not safely
detecting the `podman exec` command which could result in multiple
lines returned. Let's make sure that there is just a sigle line.
  • Loading branch information
psss committed Sep 13, 2024
1 parent 9919b75 commit 0b4a2d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/execute/reboot/out-of-session.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ rlJournalStart
tmt_reboot_command="export TMT_TEST_PIDFILE=/var/tmp/tmt-test.pid; export TMT_TEST_PIDFILE_LOCK=/var/tmp/tmt-test.pid.lock; export TMT_DEBUG=1; tmt-reboot"

if [ "$PROVISION_HOW" = "container" ]; then
podman_exec="$(sed -nr 's/\s*Run command: (podman exec .*) \/bin\/bash.*cd.*/\1/p' tmt.output)"
podman_exec="$(sed -nr 's/\s*Run command: (podman exec .*) \/bin\/bash.*cd.*/\1/p' tmt.output | head -1)"

$podman_exec bash -c "$tmt_reboot_command"

elif [ "$PROVISION_HOW" = "virtual" ]; then
ssh_exec="$(sed -nr "s/\s*Run command: (ssh .* -tt root@.*) 'export .*/\1/p" tmt.output)"
ssh_exec="$(sed -nr "s/\s*Run command: (ssh .* -tt root@.*) 'export .*/\1/p" tmt.output | head -1)"

$ssh_exec "$tmt_reboot_command"
fi
Expand Down

0 comments on commit 0b4a2d0

Please sign in to comment.