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

Function TestIsStock

src/go/pkg/pluginconfig/pluginconfig_test.go:346–362  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

344}
345
346func TestIsStock(t *testing.T) {
347 orig := dirs
348 t.Cleanup(func() { dirs = orig })
349
350 t.Run("fallback heuristic when stock dir is not initialized", func(t *testing.T) {
351 dirs = directories{}
352 assert.True(t, IsStock("/usr/lib/netdata/conf.d/go.d/module.conf"))
353 assert.False(t, IsStock("/etc/netdata/go.d/module.conf"))
354 })
355
356 t.Run("uses configured stock root when available", func(t *testing.T) {
357 dirs = directories{stockConfigDir: "/custom/stock"}
358 assert.True(t, IsStock("/custom/stock/go.d/module.conf"))
359 assert.False(t, IsStock("/usr/lib/netdata/conf.d/go.d/module.conf"))
360 assert.False(t, IsStock("/etc/netdata/go.d/module.conf"))
361 })
362}

Callers

nothing calls this directly

Calls 3

IsStockFunction · 0.85
CleanupMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…