Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 2.29 KB

File metadata and controls

68 lines (49 loc) · 2.29 KB

E2E test

The end-to-end (E2E) integration test performs the following:

  1. Start up an ephemeral Kubernetes cluster (KIND)
  2. Install a container registry (localhost:5000)
  3. Push the Kong Ingress Controller image to localhost:5000/kic:local
  4. Run Kong Ingress Controller in the local Kubernetes cluster
  5. Start up example services (echo and httpbin)
  6. Run test cases (/test/integration/cases/*):
    1. Apply manifests from .yaml files present in the test case directory
      1. Wait for KIC to apply the configuration
      2. Run ./verify.sh to verify assertions
      3. Delete manifests created in the apply step above.

How to run the test

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

Troubleshooting

If you want to troubleshoot a specific test case, here's how to do it:

Run tests with SKIP_TEARDOWN=yes

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

Access the test cluster with kubectl

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

Run a test case manually

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

Manually tear down the test cluster

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