Skip to content
Closed
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
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ runs:
shell: bash
run: |
if ${{ inputs.test-falco == 'true' }}; then
./build/falco.test -falco-static=${{ inputs.static }} -test.timeout=600s -test.v >> ./report.txt 2>&1 || true
./build/falco.test -falco-static=${{ inputs.static }} -test.timeout=600s -test.v >> ./report.txt 2>&1 || cat ./report.txt
fi
if ${{ inputs.static == 'false' }}; then
if ${{ inputs.test-falcoctl == 'true' }}; then
./build/falcoctl.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || true
./build/falcoctl.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || cat ./report.txt
fi
if ${{ inputs.test-k8saudit == 'true' }}; then
./build/k8saudit.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || true
./build/k8saudit.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || cat ./report.txt
fi
if ${{ inputs.test-dummy == 'true' }}; then
./build/dummy.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || true
./build/dummy.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || cat ./report.txt
fi
if ${{ inputs.test-drivers == 'true' }}; then
${{ inputs.sudo }} ./build/falco-driver-loader.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || true
${{ inputs.sudo }} ./build/falco-driver-loader.test -test.timeout=600s -test.v >> ./report.txt 2>&1 || cat ./report.txt
fi
fi
cat ./report.txt | go-junit-report -set-exit-code > report.xml
Expand Down
12 changes: 11 additions & 1 deletion tests/data/configs/configs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright (C) 2023 The Falco Authors.
Copyright (C) 2025 The Falco Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -319,6 +319,16 @@ load_plugins: [k8saudit, json]
`,
)

var PluginsJson = run.NewStringFileAccessor(
"json_plugin_config.yaml",
`
plugins:
- name: json
library_path: /usr/share/falco/plugins/libjson.so
init_config: ""
`,
)

var PluginsOverlapExtractSources = run.NewStringFileAccessor(
"overlap_extract_sources.yaml",
`
Expand Down
2 changes: 1 addition & 1 deletion tests/data/rules/falco.go
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ var AppendUnknownSource = run.NewStringFileAccessor(
var RulesListWithPluginJSON = run.NewStringFileAccessor(
"rule-list-with-plugin-json.yaml",
`
- required_engine_version: 11
- required_engine_version: 0.11.0

- required_plugin_versions:
- name: json
Expand Down
16 changes: 7 additions & 9 deletions tests/falco/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/falcosecurity/testing/pkg/falco"
"github.com/falcosecurity/testing/tests"
"github.com/falcosecurity/testing/tests/data/configs"
"github.com/falcosecurity/testing/tests/data/outputs"
"github.com/falcosecurity/testing/tests/data/rules"

Expand Down Expand Up @@ -110,26 +111,19 @@ func TestFalco_Cmd_ListPlugins(t *testing.T) {
tests.NewFalcoExecutableRunner(t),
falco.WithArgs("--list-plugins"),
falco.WithArgs("-o", "load_plugins[0]=container"),
falco.WithArgs("-o", "load_plugins[1]=json"),
)
assert.NoError(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, res.ExitCode(), 0)
assert.Regexp(t, regexp.MustCompile(
`2 Plugins Loaded:[\s]+`+
`1 Plugins Loaded:[\s]+`+
`Name: container[\s]+`+
`Description: .*[\s]+`+
`Contact: .*[\s]+`+
`Version: .*[\s]+`+
`Capabilities:[\s]+`+
`- Field Extraction[\s]+`+
`- Event Parsing[\s]+`+
`- Async Events[\s]+`+
`Name: json[\s]+`+
`Description: .*[\s]+`+
`Contact: .*[\s]+`+
`Version: .*[\s]+`+
`Capabilities:[\s]+`+
`- Field Extraction`),
`- Async Events`),
res.Stdout())
}

Expand Down Expand Up @@ -214,6 +208,7 @@ func TestFalco_Print_Rules(t *testing.T) {
checkNotStaticExecutable(t)
res := falco.Test(
runner,
falco.WithConfig(configs.PluginsJson),
falco.WithArgs("-L"),
falco.WithOutputJSON(),
falco.WithArgs("-o", "load_plugins[0]=json"),
Expand All @@ -222,6 +217,9 @@ func TestFalco_Print_Rules(t *testing.T) {

assert.NoError(t, res.Err())
infos := res.RulesetDescription()
if infos == nil {
t.Fatalf("RulesetDescription returned nil, stdout: %s, stderr: %s", res.Stdout(), res.Stderr())
}
assert.NotNil(t, infos)

// check required engine version
Expand Down