The end-to-end (E2E) integration test performs the following:
- Start up an ephemeral Kubernetes cluster (KIND)
- Install a container registry (localhost:5000)
- Push the Kong Ingress Controller image to localhost:5000/kic:local
- Run Kong Ingress Controller in the local Kubernetes cluster
- Start up example services (echo and httpbin)
- Run test cases (
/test/integration/cases/*
):- Apply manifests from
.yaml
files present in the test case directory- Wait for KIC to apply the configuration
- Run ./verify.sh to verify assertions
- Delete manifests created in the apply step above.
- Apply manifests from
make integration-test
This command builds a KIC Docker image and runs the test against that image.
It is possible to run the test against any prebuilt KIC image, skipping the build step:
env KIC_IMAGE=some-kic-image:tag ./test/integration/test.sh
If you want to troubleshoot a specific test case, here's how to do it:
By passing SKIP_TEARDOWN=yes
to the test you can inspect the test environment after failure, and run certain test cases manually:
make SKIP_TEARDOWN=yes integration-test
# or
env KIC_IMAGE=some-kic-image:tag SKIP_TEARDOWN=yes ./test/integration/test.sh
After the test invocation command with SKIP_TEARDOWN=yes
set terminates, KIND will continue running in the cluster. You can access it using ./kubeconfig-test-cluster
as kubeconfig:
kubectl --kubeconfig=./kubeconfig-test-cluster get pods --all-namespaces
You can run a test case manually:
kubectl --kubeconfig=./kubeconfig-test-cluster port-forward -n kong svc/kong-proxy "27080:80" "27443:443"
# in a separate terminal window:
kubectl --kubeconfig=./kubeconfig-test-cluster apply -f ./test/integration/cases/01-https
env SUT_HTTP_HOST=127.0.0.1:27080 SUT_HTTPS_HOST=127.0.0.1:27443 ./test/integration/cases/01-https/verify.sh
kubectl --kubeconfig=./kubeconfig-test-cluster delete -f ./test/integration/cases/01-https
At the end of the debugging session, you can tear down the environment like this:
docker rm -f test-cluster-control-plane test-local-registry