This script would setup the environment, run all the available integration tests, and then cleans up everything.
./prow/test/integration/integration-test.sh
- Setup a local registry.
- Compile prow components, generate images, and push them to the registry.
- Create a local cluster using kind.
- Wait for prow components to be ready.
In order to set up the cluster, run the integration tests, and not teardown the cluster after use:
SKIP_TEARDOWN=true ./prow/test/integration/integration-test.sh
After prow is installed on top of the local cluster, run the integration tests under test directory
Optional parameters:
- --test_filter - Specifies a filter to forward to the test framework.
- --cache_test_results - Whether to cache test results.
./prow/test/integration/integration-test.sh run [--test_filter=TestHook] [--cache_test_results=no]
If the local cluster exists, run the tests and then delete the local cluster and the local registry by using:
SKIP_SETUP=true ./prow/test/integration/integration-test.sh
(Assume the component to be added is named most-awesome-component
)
- Add
most-awesome-component
attestimage-push
target, so that the component is pushed tolocalhost:5001
registry - Deploy
most-awesome-component
during integration test https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/setup-cluster.sh#L33, and cleanup the component after integration test https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/cleanup.sh#L23 - Add
most-awesome-component
deployment yaml at https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/prow/cluster, so that the deployment works. Modifications involve:most-awesome-component_service.yaml
andmost-awesome-component_rbac.yaml
can be symlinks from https://github.com/kubernetes/test-infra/tree/master/config/prow/cluster.most-awesome-component_deployment.yaml
will at least requires changing image registry tolocalhost:5001
like https://github.com/kubernetes/test-infra/blob/f9fb6d28ebbcf77dc0b99d741b8df5f5d85c739e/prow/test/integration/prow/cluster/hook_deployment.yaml#L41.- [If using github client]
github-endpoint
should be changed tofakeghserver
, which was from https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/fakeghserver.
- [If using github client] Existing fake github server only implemented partial github APIs, will need to add APIs that
most-awesome-component
uses at https://github.com/kubernetes/test-infra/tree/master/prow/test/integration/fakeghserver
Tests are implemented in Go, located at test
directory.
- [If this is a new component] Create a file called
most-awesome-component_test.go
- Add test in
most-awesome-component_test.go