MCPcopy
hub / github.com/google/mtail / ExpectLinesReceivedNoDiff

Function ExpectLinesReceivedNoDiff

internal/testutil/lines.go:21–41  ·  view source on GitHub ↗
(tb testing.TB, wantLines []*logline.LogLine, gotLines <-chan *logline.LogLine)

Source from the content-addressed store, hash-verified

19}
20
21func ExpectLinesReceivedNoDiff(tb testing.TB, wantLines []*logline.LogLine, gotLines <-chan *logline.LogLine) func() {
22 tb.Helper()
23 var received []*logline.LogLine
24
25 var wg sync.WaitGroup
26 wg.Add(1)
27 go func() {
28 defer wg.Done()
29 for line := range gotLines {
30 received = append(received, line)
31 }
32 }()
33 return func() {
34 tb.Helper()
35 wg.Wait()
36 if len(received) != len(wantLines) {
37 tb.Errorf("unexpected line count, want %d got %d", len(wantLines), len(received))
38 }
39 ExpectNoDiff(tb, wantLines, received, IgnoreFields(logline.LogLine{}, "Context"))
40 }
41}

Calls 3

ExpectNoDiffFunction · 0.85
IgnoreFieldsFunction · 0.85
AddMethod · 0.45