This directory contains tests and testing docs for Knative Observability
:
- Unit tests currently reside in the codebase alongside the code they test
- End-to-end tests, of which there are two types:
To run all unit tests:
go test ./...
By default go test
will not run the e2e tests, which need -tags=e2e
to be enabled.
Setting up a running Knative Observability
cluster.
-
A Kubernetes cluster v1.10 or newer with the
ValidatingAdmissionWebhook
admission controller enabled.kubectl
v1.10 is also required. -
Deploy Knative Observability components as mentioned in Deploying Sink Resources
Once the environment has been setup and the kubectl
targeting the correct
cluster, run the Go E2E tests with the build tag.
go test -v -tags=e2e -count=1 -race ./test/e2e/...
-count=1
is the idiomatic way to bypass test caching, so that tests will always run.
These tests asserts the validation logic for applying the various sink CRDs.
./test/crd/test.sh
To run one e2e test case, e.g. TestSimpleBuild, use the -run
flag with go test
:
go test -v -tags=e2e -count=1 -race ./test/e2e/... -run=TestSimpleBuild
The e2e tests are used to test whether the Knative Observability components are functioning.
The e2e tests MUST:
- Provide frequent output describing what actions they are undertaking, especially before performing long running operations.
- Follow Golang best practices.