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

Function TestCompileMinEngineVersion

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

Source from the content-addressed store, hash-verified

48}
49
50func TestCompileMinEngineVersion(t *testing.T) {
51 var tests = []struct {
52 rules string
53 ver string
54 e string
55 }{
56 {"_fixtures/min_engine_version/fail/*.yml", "2.0.0", `rule "accept events where source port = 44123" needs engine version [2.2.0] but current version is [2.0.0]`},
57 {"_fixtures/min_engine_version/ok/*.yml", "2.0.0", ""},
58 }
59
60 for _, tt := range tests {
61 t.Run(tt.rules, func(t *testing.T) {
62 c := newCompiler(new(ps.SnapshotterMock), newConfig(tt.rules))
63 version.Set(tt.ver)
64 _, _, err := c.compile()
65 if err != nil && tt.e == "" {
66 require.Error(t, err)
67 }
68 if err != nil {
69 require.EqualError(t, err, tt.e)
70 }
71 })
72 }
73}
74
75func TestCompileEventCategoryFieldNames(t *testing.T) {
76 var tests = []struct {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected