master
go 35 lines 944 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package jobmgr
4
5 import (
6 "bytes"
7 "fmt"
8 "testing"
9
10 "github.com/netdata/netdata/go/plugins/pkg/netdataapi"
11 "github.com/netdata/netdata/go/plugins/plugin/framework/dyncfg"
12 "github.com/stretchr/testify/assert"
13 )
14
15 func TestNew_UsesConfiguredOutForDyncfgResponder(t *testing.T) {
16 const pluginName = "test"
17
18 var buf bytes.Buffer
19 mgr := New(Config{
20 PluginName: pluginName,
21 Out: &buf,
22 })
23
24 mgr.dyncfgResponder.ConfigCreate(netdataapi.ConfigOpts{
25 ID: "test:collector:module",
26 Status: dyncfg.StatusAccepted.String(),
27 ConfigType: dyncfg.ConfigTypeTemplate.String(),
28 Path: fmt.Sprintf(dyncfgCollectorPath, pluginName),
29 SourceType: "internal",
30 Source: "internal",
31 SupportedCommands: "schema",
32 })
33
34 assert.Contains(t, buf.String(), "CONFIG test:collector:module create accepted template /collectors/test/Jobs")
35 }