MCPcopy Create free account
hub / github.com/containerd/nerdctl / EnsureContainerStarted

Method EnsureContainerStarted

pkg/testutil/testutil.go:301–317  ·  view source on GitHub ↗
(con string)

Source from the content-addressed store, hash-verified

299}
300
301func (b *Base) EnsureContainerStarted(con string) {
302 b.T.Helper()
303
304 const (
305 maxRetry = 5
306 sleep = time.Second
307 )
308 for i := 0; i < maxRetry; i++ {
309 if b.InspectContainer(con).State.Running {
310 b.T.Logf("container %s is now running", con)
311 return
312 }
313 b.T.Logf("(retry=%d)", i+1)
314 time.Sleep(sleep)
315 }
316 b.T.Fatalf("conainer %s not running", con)
317}
318
319func (b *Base) EnsureContainerExited(con string, expectedExitCode int) {
320 b.T.Helper()

Calls 2

InspectContainerMethod · 0.95
HelperMethod · 0.65