Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(falco): remove some legacy tests #39

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions tests/data/rules/falco.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ var InvalidAppendMacro = run.NewStringFileAccessor(
`,
)

var InvalidAppendMacroDangling = run.NewStringFileAccessor(
"invalid_append_macro_dangling.yaml",
`- macro: dangling append
condition: and evt.type=execve
append: true`,
)

var InvalidAppendMacroMultipleDocs = run.NewStringFileAccessor(
"invalid_append_macro_multiple_docs.yaml",
`---
Expand Down Expand Up @@ -647,15 +640,6 @@ var ListAppend = run.NewStringFileAccessor(
`,
)

var ListAppendFailure = run.NewStringFileAccessor(
"list_append_failure.yaml",
`
- list: my_list
items: [not-cat]
append: true
`,
)

var ListAppendFalse = run.NewStringFileAccessor(
"list_append_false.yaml",
`
Expand Down Expand Up @@ -987,15 +971,6 @@ var RuleAppend = run.NewStringFileAccessor(
`,
)

var RuleAppendFailure = run.NewStringFileAccessor(
"rule_append_failure.yaml",
`
- rule: my_rule
condition: evt.type=open
append: true
`,
)

var RuleAppendFalse = run.NewStringFileAccessor(
"rule_append_false.yaml",
`
Expand Down
51 changes: 0 additions & 51 deletions tests/falco/legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,23 +521,6 @@ func TestFalco_Legacy_ListSubBare(t *testing.T) {
assert.Equal(t, 0, res.ExitCode())
}

func TestFalco_Legacy_InvalidAppendMacroDangling(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
res := falco.Test(
tests.NewFalcoExecutableRunner(t),
falco.WithOutputJSON(),
falco.WithRulesValidation(rules.InvalidAppendMacroDangling),
)
assert.NotNil(t, res.RuleValidation().AllErrors().
OfCode("LOAD_ERR_VALIDATE").
OfItemType("macro").
OfItemName("dangling append").
OfMessage("Macro has 'append' key but no macro by that name already exists"))
assert.Error(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, 1, res.ExitCode())
}

func TestFalco_Legacy_InvalidOverwriteMacroMultipleDocs(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
Expand Down Expand Up @@ -1096,23 +1079,6 @@ func TestFalco_Legacy_MonitorSyscallDropsLog(t *testing.T) {
assert.Equal(t, 0, res.ExitCode())
}

func TestFalco_Legacy_InvalidRuleAppendDangling(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
res := falco.Test(
tests.NewFalcoExecutableRunner(t),
falco.WithOutputJSON(),
falco.WithRulesValidation(rules.RuleAppendFailure),
)
assert.NotNil(t, res.RuleValidation().AllErrors().
OfCode("LOAD_ERR_VALIDATE").
OfItemType("rule").
OfItemName("my_rule").
OfMessage("Rule has 'append' key but no rule by that name already exists"))
assert.Error(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, 1, res.ExitCode())
}

func TestFalco_Legacy_InvalidOverwriteRule(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
Expand Down Expand Up @@ -1713,23 +1679,6 @@ func TestFalco_Legacy_InvalidArrayItemNotObject(t *testing.T) {
assert.Equal(t, 1, res.ExitCode())
}

func TestFalco_Legacy_InvalidListAppendDangling(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
res := falco.Test(
tests.NewFalcoExecutableRunner(t),
falco.WithOutputJSON(),
falco.WithRulesValidation(rules.ListAppendFailure),
)
assert.NotNil(t, res.RuleValidation().AllErrors().
OfCode("LOAD_ERR_VALIDATE").
OfItemType("list").
OfItemName("my_list").
OfMessage("List has 'append' key but no list by that name already exists"))
assert.Error(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, 1, res.ExitCode())
}

func TestFalco_Legacy_RuleExceptionSecondItem(t *testing.T) {
t.Parallel()
checkDefaultConfig(t)
Expand Down