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 8, 2024
1 parent 95a5fca commit af2f140
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 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,17 @@ 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 systemctl is-system-running >/dev/null 2>&1; do
>&2 printf "Waiting for systemd to come up...\n"
sleep 1s
tries=$(( tries + 1))
[ $tries -lt 10 ] || {
>&2 printf "systemd failed to come up in a reasonable amount of time\n"
exit 1
}
done
systemctl list-jobs`).AssertOutContains("jobs")
}

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

0 comments on commit af2f140

Please sign in to comment.