MCPcopy Index your code
hub / github.com/netdata/netdata / TestBEGIN

Function TestBEGIN

src/go/pkg/netdataapi/api_test.go:92–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestBEGIN(t *testing.T) {
93
94 tests := map[string]struct {
95 name string
96 typeID string
97 ID string
98 msSince int
99 expected string
100 }{
101 "without msSince": {
102 typeID: "system",
103 ID: "cpu",
104 msSince: 0,
105 expected: "BEGIN 'system.cpu'\n",
106 },
107 "with msSince": {
108 typeID: "system",
109 ID: "cpu",
110 msSince: 1000,
111 expected: "BEGIN 'system.cpu' 1000\n",
112 },
113 }
114
115 for name, test := range tests {
116 t.Run(name, func(t *testing.T) {
117 w := &bytes.Buffer{}
118 api := New(w)
119
120 api.BEGIN(test.typeID, test.ID, test.msSince)
121
122 require.Equal(t, test.expected, w.String())
123 })
124 }
125}
126
127func TestSET(t *testing.T) {
128 w := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 5

BEGINMethod · 0.80
EqualMethod · 0.80
NewFunction · 0.70
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…