- Install
chainsaw
:go install github.com/kyverno/chainsaw@latest
- Execute
make test-e2e
- Create a clean cluster
kind delete cluster --name kind && make create-kind deploy-kind && kubectl port-forward deploy/netbox 8080:8080 -n default
- During development, we would need to have a clean NetBox instance between runs, which we can do with the following commands as soon as we create a new cluster
- Backup:
kubectl exec pod/netbox-db-0 -- bash -c "pg_dump --clean -U postgres netbox" > database.sql
- Backup:
- The simplest test case is
tests/e2e/GivenPrefixClaimWithPreserveWhenAppliedThenSucceed
- We always need a
chainsaw-test.yaml
- We always need a
- Perform a clean run by resetting the database first, then execute the test
- Reset database
cat database.sql | kubectl exec -i pod/netbox-db-0 -- psql -U postgres -d netbox
- Make sure that in the
e2e
namespace, no leftover CRs are there
- Make sure that in the
- Execute the entire e2e test
make test-e2e
- Or just perform a specific run, e.g.
chainsaw test --test-dir tests/e2e/Prefix/IPv4/GivenPrefixClaimWhenAppliedThenFailedPrefixExhausted
- Or just perform a specific run, e.g.
- Reset database
kubectl get prefixclaim,prefix,ipaddressclaim,ipaddress,iprange,iprangeclaim -A
- For monitoring failures, we can use event (which is a native k8s object)
- e.g.
kubectl events --for prefixclaim.netbox.dev/prefixclaim-apply-prefixexhausted-3 -o yaml
- e.g.
- I am not entirely sure why is resetting the database not clean enough, maybe the redis is doing some caching that I am not aware of