MCPcopy
hub / github.com/netdata/netdata / TestCmdAdd_Success

Function TestCmdAdd_Success

src/go/plugin/framework/dyncfg/handler_test.go:468–482  ·  view source on GitHub ↗

--- CmdAdd Tests ---

(t *testing.T)

Source from the content-addressed store, hash-verified

466// --- CmdAdd Tests ---
467
468func TestCmdAdd_Success(t *testing.T) {
469 cb := &mockCallbacks{}
470 h := newTestHandler(cb)
471
472 fn := newTestFn("test:job1", "add", "job1", []byte(`{}`))
473 h.CmdAdd(fn)
474
475 // Config should be in both caches.
476 _, ok := h.seen.LookupByUID("dyncfg:job1")
477 assert.True(t, ok, "config should be in seen cache")
478
479 entry, ok := h.exposed.LookupByKey("job1")
480 require.True(t, ok, "config should be in exposed cache")
481 assert.Equal(t, StatusAccepted, entry.Status)
482}
483
484func TestCmdAdd_InvalidArgs(t *testing.T) {
485 cb := &mockCallbacks{}

Callers

nothing calls this directly

Calls 6

newTestHandlerFunction · 0.85
newTestFnFunction · 0.85
CmdAddMethod · 0.80
LookupByUIDMethod · 0.80
LookupByKeyMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…