Skip to content

Commit

Permalink
Fix test: wait for systemd to come up
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Jul 6, 2024
1 parent 95a5fca commit 624cc25
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/nerdctl/container_run_systemd_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ func TestRunWithSystemdTrueEnabled(t *testing.T) {

base.Cmd("inspect", "--format", "{{json .Config.Labels}}", containerName).AssertOutContains("SIGRTMIN+3")

base.Cmd("exec", containerName, "systemctl", "list-jobs").AssertOutContains("jobs listed.")
base.Cmd("exec", containerName, "sh", "-c", "--", `tries=0
until [ -e /run/systemd/io.system.ManagedOOM ]; do
sleep 1s
tries=$(( tries + 1))
[ $tries -lt 10 ] || {
>&2 printf "Failed waiting for systemd to come up in a reasonable amount of time\n"
exit 1
}
done
systemctl list-jobs`).AssertOutContains("jobs listed.")
}

func TestRunWithSystemdTrueDisabled(t *testing.T) {
Expand Down

0 comments on commit 624cc25

Please sign in to comment.