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

Function check

libcontainer/logs/logs_linux_test.go:129–141  ·  view source on GitHub ↗

check checks that the file contains txt and does not contain notxt.

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

Source from the content-addressed store, hash-verified

127
128// check checks that the file contains txt and does not contain notxt.
129func check(t *testing.T, l *log, txt, notxt string) {
130 t.Helper()
131 contents, err := os.ReadFile(l.file.Name())
132 if err != nil {
133 t.Fatal(err)
134 }
135 if txt != "" && !bytes.Contains(contents, []byte(txt)) {
136 t.Fatalf("%s does not contain %s", contents, txt)
137 }
138 if notxt != "" && bytes.Contains(contents, []byte(notxt)) {
139 t.Fatalf("%s does contain %s", contents, notxt)
140 }
141}
142
143// checkWait is like check, but if the file is empty,
144// it waits until it's not.

Calls 1

ContainsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…