Skip to content

Commit 75a964b

Browse files
committed
fix: test bug
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent b77e655 commit 75a964b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cmd/nerdctl/container/container_stop_linux_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,20 @@ func TestStopWithStopSignal(t *testing.T) {
8282

8383
base.Cmd("run", "-d", "--stop-signal", "SIGQUIT", "--name", testContainerName, testutil.CommonImage, "sh", "-euxc", `#!/bin/sh
8484
set -eu
85-
trap 'quit=1' QUIT
85+
echo "Script started"
8686
quit=0
87-
while [ $quit -ne 1 ]; do
88-
printf 'wait quit'
87+
trap 'echo "SIGQUIT received"; quit=1' QUIT
88+
echo "Trap set"
89+
while true; do
90+
if [ $quit -eq 1 ]; then
91+
echo "Quitting loop"
92+
break
93+
fi
94+
echo "In loop"
8995
sleep 1
9096
done
91-
echo "signal quit"`).AssertOK()
97+
echo "signal quit"
98+
sync`).AssertOK()
9299
base.Cmd("stop", testContainerName).AssertOK()
93100
base.Cmd("logs", "-f", testContainerName).AssertOutContains("signal quit")
94101
}

0 commit comments

Comments
 (0)