Skip to content

Commit

Permalink
new(tests/falco): add TestFalco_Config_Metrics_Enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Melissa Kilby <[email protected]>
  • Loading branch information
incertum committed Feb 22, 2024
1 parent 7abf76f commit a48a4e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/data/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,13 @@ var RuleMatchingWrongValue = run.NewStringFileAccessor(
rule_matching: test
`,
)

var MetricsEnabled = run.NewStringFileAccessor(
"rule_metrics_enabled.yaml",
`
metrics:
enabled: true
interval: 5s
output_rule: true
`,
)
13 changes: 13 additions & 0 deletions tests/falco/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,16 @@ func TestFalco_Config_RuleMatchingWrongValue(t *testing.T) {
assert.Contains(t, res.Stderr(), "Unknown rule matching strategy")
assert.Equal(t, 1, res.ExitCode())
}

func TestFalco_Config_Metrics_Enabled(t *testing.T) {
t.Parallel()
res := falco.Test(
tests.NewFalcoExecutableRunner(t),
falco.WithRules(rules.ShadowingRules),
falco.WithConfig(configs.MetricsEnabled),
falco.WithCaptureFile(captures.TracesPositiveReadSensitiveFileUntrusted),
falco.WithOutputJSON(),
)
assert.NoError(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, 0, res.ExitCode())
}

0 comments on commit a48a4e0

Please sign in to comment.