MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestCompileEventCategoryFieldNames

Function TestCompileEventCategoryFieldNames

pkg/rules/compiler_test.go:75–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestCompileEventCategoryFieldNames(t *testing.T) {
76 var tests = []struct {
77 rules string
78 err error
79 }{
80 {"_fixtures/field_values/correct_event_name_field.yml", nil},
81 {"_fixtures/field_values/incorrect_event_name_field.yml", ErrUnknownEventName("match https connections", "RecvTcp4")},
82 {"_fixtures/field_values/incorrect_event_name_in_operator.yml", ErrUnknownEventName("match https connections", "CreateProc")},
83 {"_fixtures/field_values/correct_category_name_field.yml", nil},
84 {"_fixtures/field_values/incorrect_category_name_field.yml", ErrUnknownCategoryName("match https connections", "network")},
85 }
86
87 for _, tt := range tests {
88 t.Run(tt.rules, func(t *testing.T) {
89 c := newCompiler(new(ps.SnapshotterMock), newConfig(tt.rules))
90 _, _, err := c.compile()
91 if err != nil && tt.err != nil {
92 require.Error(t, err)
93 }
94 if err != nil {
95 require.EqualError(t, err, tt.err.Error())
96 }
97 })
98 }
99}

Callers

nothing calls this directly

Calls 5

newCompilerFunction · 0.85
newConfigFunction · 0.85
compileMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected