MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / loadTestFile

Function loadTestFile

pkg/parser/parsing_test.go:188–215  ·  view source on GitHub ↗
(t require.TestingT, file string)

Source from the content-addressed store, hash-verified

186}
187
188func loadTestFile(t require.TestingT, file string) []TestFile {
189 yamlFile, err := os.Open(file)
190 require.NoError(t, err, "failed to open test file")
191
192 dec := yaml.NewDecoder(yamlFile)
193 dec.SetStrict(true)
194
195 var testSet []TestFile
196
197 for {
198 tf := TestFile{}
199
200 err := dec.Decode(&tf)
201 if err != nil {
202 if errors.Is(err, io.EOF) {
203 break
204 }
205
206 require.NoError(t, err, "failed to load testfile '%s'", file)
207
208 return nil
209 }
210
211 testSet = append(testSet, tf)
212 }
213
214 return testSet
215}
216
217func matchEvent(expected pipeline.Event, out pipeline.Event, debug bool) ([]string, bool) {
218 var retInfo []string

Callers 1

testOneParserFunction · 0.85

Calls 1

OpenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…