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

Function TestManager_Run

src/go/plugin/framework/functions/manager_test.go:257–478  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

255}
256
257func TestManager_Run(t *testing.T) {
258 tests := map[string]struct {
259 register []string
260 input string
261 expected []Function
262 }{
263 "valid function: single": {
264 register: []string{"fn1"},
265 input: fmt.Sprintf(`
266FUNCTION UID 1 "fn1 arg1 arg2" %s "%s"
267`, managerTestPermissions, managerTestSource),
268 expected: []Function{
269 {
270 key: lineFunction,
271 UID: "UID",
272 Timeout: time.Second,
273 Name: "fn1",
274 Args: []string{"arg1", "arg2"},
275 Permissions: managerTestPermissions,
276 Source: managerTestSource,
277 ContentType: "",
278 Payload: nil,
279 },
280 },
281 },
282 "valid function: multiple": {
283 register: []string{"fn1", "fn2"},
284 input: fmt.Sprintf(`
285FUNCTION UID1 1 "fn1 arg1 arg2" %s "%s"
286FUNCTION UID2 1 "fn2 arg1 arg2" %s "%s"
287`, managerTestPermissions, managerTestSource, managerTestPermissions, managerTestSource),
288 expected: []Function{
289 {
290 key: lineFunction,
291 UID: "UID1",
292 Timeout: time.Second,
293 Name: "fn1",
294 Args: []string{"arg1", "arg2"},
295 Permissions: managerTestPermissions,
296 Source: managerTestSource,
297 ContentType: "",
298 Payload: nil,
299 },
300 {
301 key: lineFunction,
302 UID: "UID2",
303 Timeout: time.Second,
304 Name: "fn2",
305 Args: []string{"arg1", "arg2"},
306 Permissions: managerTestPermissions,
307 Source: managerTestSource,
308 ContentType: "",
309 Payload: nil,
310 },
311 },
312 },
313 "valid function: single with payload": {
314 register: []string{"fn1", "fn2"},

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
RunMethod · 0.95
snapshotMethod · 0.95
newMockInputFunction · 0.85
NewManagerFunction · 0.70
RunMethod · 0.65
StopMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…