MCPcopy
hub / github.com/opencontainers/runc / checkWait

Function checkWait

libcontainer/logs/logs_linux_test.go:145–166  ·  view source on GitHub ↗

checkWait is like check, but if the file is empty, it waits until it's not.

(t *testing.T, l *log, txt, notxt string)

Source from the content-addressed store, hash-verified

143// checkWait is like check, but if the file is empty,
144// it waits until it's not.
145func checkWait(t *testing.T, l *log, txt, notxt string) {
146 t.Helper()
147 const (
148 delay = 100 * time.Millisecond
149 iter = 3
150 )
151 for i := 0; ; i++ {
152 st, err := l.file.Stat()
153 if err != nil {
154 t.Fatal(err)
155 }
156 if st.Size() > 0 {
157 break
158 }
159 if i == iter {
160 t.Fatalf("waited %s for file %s to be non-empty but it still is", iter*delay, l.file.Name())
161 }
162 time.Sleep(delay)
163 }
164
165 check(t, l, txt, notxt)
166}

Calls 1

checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…