This directory contains Ingress conformance tests for Knative Ingress resource.
go
: The languageKnative Serving
is built in (1.13 or later)ko
: Build tool to setup the environment.kubectl
: For managing development environments.
-
A running
Knative Serving
cluster., with the Ingress implementation of choice installed.# Set the Ingress class annotation to use in tests. # Some examples: # export INGRESS_CLASS=gloo.ingress.networking.knative.dev # Gloo Ingress # export INGRESS_CLASS=istio.ingress.networking.knative.dev # Istio Ingress # export INGRESS_CLASS=kourier.ingress.networking.knative.dev # Kourier Ingress export INGRESS_CLASS=<your-ingress-class-annotation>
-
Knative Networking source code check out at
${NETWORKING_ROOT}
. Often this is$GOPATH/src/go/knative.dev/networking
. This contains both the test images and the tests.export NETWORKING_ROOT=<where-you-checked-out-knative/networking>
-
(Recommended) Knative net-istio source code checked out. This contains an invocation of
RunConformance
that easily allows to run tests. -
(For setup only) Knative Serving source code check out at
${SERVING_ROOT}
. Often this is$GOPATH/src/go/knative.dev/serving
. This contains theknative-testing
resources.export SERVING_ROOT=<where-you-checked-out-knative/serving>
-
A docker repo containing the test images
KO_DOCKER_REPO
: The docker repository to which developer images should be pushed (e.g.gcr.io/[gcloud-project]
).export KO_DOCKER_REPO=<your-docker-repository>
-
The
knative-testing
resourcesko apply -f "$SERVING_ROOT/test/config"
NOTE: this is only required when you run conformance/e2e tests locally with
go test
commands, and may be required periodically.
The upload-test-images.sh
script can be used to
build and push the test images used by the conformance and e2e tests. The script
expects your environment to be setup as described in
DEVELOPMENT.md.
To run the script for all end to end test images:
cd $NETWORKING_ROOT
./test/upload-test-images.sh
Tests need to be exported and accessible downstream so they should be placed in
non-test files (ie. sometest.go). Additionally, invoke your test in the default
RunConformance
function in run.go
. This function is the entry
point by which tests are executed.
This approach aims to reduce the changes required when tests are added & removed.
To run all the conformance tests in your own repo we encourage adopting the
RunConformance
function to run all your tests.
To do so would look something like:
package conformance
import (
"testing"
"knative.dev/serving/test/conformance/ingress"
)
func TestYourIngressConformance(t *testing.T) {
ingress.RunConformance(t)
}
net-istio
already invokes the RunConformance
function in
ingress_test.go
,
so it offers a convenient place to run the tests.
If INGRESS_CLASS
is already set, then you can simply go test ingress_test.go
-
Clone the net-istio repository (or use any repository that invokes
RunConformance
). -
In net-istio, add an entry to go.mod that points to your local networking folder:
-
Make any changes to your local networking E2E tests
-
Run
go mod vendor
in net-istio -
Run
go test test/conformance/ingress_test.go
NOTE: You will need to run go mod vendor
for every change you make.