MCPcopy
hub / github.com/crowdsecurity/crowdsec / TestDataSourceConfigure

Function TestDataSourceConfigure

pkg/acquisition/acquisition_test.go:88–222  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestDataSourceConfigure(t *testing.T) {
89 ctx := t.Context()
90
91 appendMockSource(t)
92
93 tests := []struct {
94 TestName string
95 String string
96 ExpectedError string
97 }{
98 {
99 TestName: "basic_valid_config",
100 String: `
101mode: cat
102labels:
103 test: foobar
104log_level: info
105source: mock
106toto: test_value1
107`,
108 },
109 {
110 TestName: "basic_debug_config",
111 String: `
112mode: cat
113labels:
114 test: foobar
115log_level: debug
116source: mock
117toto: test_value1
118`,
119 },
120 {
121 TestName: "basic_tailmode_config",
122 String: `
123mode: tail
124labels:
125 test: foobar
126log_level: debug
127source: mock
128toto: test_value1
129`,
130 },
131 {
132 TestName: "bad_mode_config",
133 String: `
134mode: ratata
135labels:
136 test: foobar
137log_level: debug
138source: mock
139toto: test_value1
140`,
141 ExpectedError: "mode ratata is not supported",
142 },
143 {
144 TestName: "bad_type_config",
145 String: `

Callers

nothing calls this directly

Calls 4

appendMockSourceFunction · 0.85
DataSourceConfigureFunction · 0.85
RunMethod · 0.65
DumpMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…