Skip to content
This repository was archived by the owner on Jul 10, 2020. It is now read-only.

Files

Latest commit

d9d9d57 · Aug 2, 2019

History

History

test

Test

This directory contains tests and testing docs for Knative Observability:

Running unit tests

To run all unit tests:

go test ./...

By default go test will not run the e2e tests, which need -tags=e2e to be enabled.

Running End to End Tests

Environment Setup

Setting up a running Knative Observability cluster.

  1. A Kubernetes cluster v1.10 or newer with the ValidatingAdmissionWebhook admission controller enabled. kubectl v1.10 is also required.

  2. Deploy Knative Observability components as mentioned in Deploying Sink Resources

Go e2e tests

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.

YAML e2e tests

These tests asserts the validation logic for applying the various sink CRDs.

./test/crd/test.sh

One test case

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

Developing End to End Tests

The e2e tests are used to test whether the Knative Observability components are functioning.

The e2e tests MUST:

  1. Provide frequent output describing what actions they are undertaking, especially before performing long running operations.
  2. Follow Golang best practices.