MCPcopy Index your code
hub / github.com/coder/coder / assertLogs

Function assertLogs

cli/clilog/clilog_test.go:176–190  ·  view source on GitHub ↗
(t testing.TB, path string, expected ...string)

Source from the content-addressed store, hash-verified

174}
175
176func assertLogs(t testing.TB, path string, expected ...string) {
177 t.Helper()
178
179 data, err := os.ReadFile(path)
180 require.NoError(t, err)
181
182 logs := strings.Split(strings.TrimSpace(string(data)), "\n")
183 if !assert.Len(t, logs, len(expected)) {
184 t.Log(string(data))
185 t.FailNow()
186 }
187 for i, log := range logs {
188 require.Contains(t, log, expected[i])
189 }
190}
191
192func assertLogsJSON(t testing.TB, path string, levelExpected ...string) {
193 t.Helper()

Callers 1

TestBuilderFunction · 0.85

Calls 6

LogMethod · 0.80
FailNowMethod · 0.80
HelperMethod · 0.65
ReadFileMethod · 0.65
LenMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected