MCPcopy
hub / github.com/kubernetes/node-problem-detector / TestPush

Function TestPush

pkg/systemlogmonitor/log_buffer_test.go:26–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestPush(t *testing.T) {
27 for c, test := range []struct {
28 max int
29 logs []string
30 expected string
31 }{
32 {
33 max: 1,
34 logs: []string{"a", "b"},
35 expected: "b",
36 },
37 {
38 max: 2,
39 logs: []string{"a", "b"},
40 expected: "a\nb",
41 },
42 {
43 max: 2,
44 logs: []string{"a", "b", "c"},
45 expected: "b\nc",
46 },
47 {
48 max: 2,
49 logs: []string{"a", "b", "c", "d"},
50 expected: "c\nd",
51 },
52 } {
53 b := NewLogBuffer(test.max)
54 for _, log := range test.logs {
55 b.Push(&types.Log{Message: log})
56 }
57 got := b.String()
58 if test.expected != got {
59 t.Errorf("case %d: expected %q, got %q", c+1, test.expected, got)
60 }
61 }
62}
63
64func TestMatch(t *testing.T) {
65 max := 4

Callers

nothing calls this directly

Calls 3

PushMethod · 0.95
StringMethod · 0.95
NewLogBufferFunction · 0.85

Tested by

no test coverage detected