The kubernetes package offers helper functions that are used by the disruptors. Testing this package with the kubernetes client mock is insufficient due to its many limitations. The mock does not validate the objects submitted to the API, and it does not support the generation of events (required for example by watchers) in a reliable way.
This PR is a Proof of concept of using TestContainers for the kubernetes integration tests using the k3s module that allows spawning a fully functional kubernetes cluster running in a container.
Its main advantage with respect to the existing tests is the speed of spawning the Kubernetes cluster.
Checklist:
[X] I have performed a self-review of my code
[X] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[X] I have added tests that prove my fix is effective or that my feature works.
[X] I have run linter locally (make lint) and all checks pass.
[X] I have run tests locally (make test) and all tests pass.
[X] I have run relevant e2e test locally (make e2e-xxx for agent, disruptors, kubernetes or cluster related changes)
[ ] Any dependent changes have been merged and published in downstream modules
Description
The kubernetes package offers helper functions that are used by the disruptors. Testing this package with the kubernetes client mock is insufficient due to its many limitations. The mock does not validate the objects submitted to the API, and it does not support the generation of events (required for example by watchers) in a reliable way.
This PR is a Proof of concept of using TestContainers for the kubernetes integration tests using the k3s module that allows spawning a fully functional kubernetes cluster running in a container.
Its main advantage with respect to the existing tests is the speed of spawning the Kubernetes cluster.
Checklist:
make lint
) and all checks pass.make test
) and all tests pass.make e2e-xxx
foragent
,disruptors
,kubernetes
orcluster
related changes)