mirror of
https://github.com/vee1e/KubeArmor.git
synced 2026-09-01 10:18:29 +00:00
|
|
||
|---|---|---|
| .. | ||
| blockposture | ||
| configmap | ||
| csp | ||
| host_scenarios | ||
| ksp | ||
| microservices | ||
| multicontainer | ||
| networktests | ||
| nsp | ||
| presets | ||
| privileged | ||
| scenarios | ||
| smoke | ||
| syscalls | ||
| throttling | ||
| visibility | ||
| Makefile | ||
| README.md | ||
| test-scenarios-github.sh | ||
| test-scenarios-in-runtime.sh | ||
| test-scenarios-local.sh | ||
| tests.allow | ||
| tests.ignore | ||
KubeArmor Automated Tests
Prerequisites
- Install ginkgo
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo kubectlneeds to be installed
How to add a new testsuite?
mkdir $BASE/newsuite && cd $BASE/newsuite
ginkgo bootstrap # This adds the skeleton for a new testcase
How to add a new testcase/testspec?
Refer to $BASE/smoke folder.
For making assertions in testspec using gomega, check this.
How to execute testsuites?
By default, running a make in the KubeArmor/tests folders runs all the tests.
Check the ginkgo command in Makefile for options used (such as --flake-attempts, --timeout etc) used.
Other ways of executing the testsuites:
- Execute all testsuites using
ginkgo -r - Execute specific testsuite using
ginkgo --focus "Smoke"... whereSmokeis the name of the testsuite. - Execute specific testcase/testspec. Check this.
- Stop on first failure
ginkgo -r --fail-fast
- Note: Why is
--flake-attempts=5used inMakefile? Lot of times, on resource constrained VMs provided by GH actions, the events from kubearmor are lost. This is essentially a performance issue, but currently we are rerunning the tests.
I already have a k8s cluster. Is it possible to execute tests using it?
Yes, the tests assumes that there exists a k8s setup already operational.