rundk
rundk
is a tool to run a test command from the test image, by using it
developers can reproduce the test flow as run in the CI environment.
Prerequisites
- Docker must be installed
- If you run this tool on MAC,
/tmp
directory must be added to Docker's File
Sharing settings to allow Docker accessing the temporary files created for
mount, see the
comment.
Installation
rundk
can be installed and upgraded by running:
go get knative.dev/toolbox/rundk
Usage
Usage of rundk:
--image string
The image we use to run the test flow. (default "gcr.io/knative-tests/test-infra/prow-tests:v20220331-8ed73402")
--entrypoint string
The entrypoint executable that runs the test commands. (default "runner.sh")
--enable-docker-in-docker
Enable running docker commands in the test flow.
By enabling this the container will share the same docker daemon in the host machine, so be careful when using it.
--use-local-gcloud-credentials
Use the same gcloud credentials as local.
It can be set either by setting env var GOOGLE_CLOUD_APPLICATION_CREDENTIALS or from ~/.config/gcloud
--use-local-kubeconfig
Use the same kubeconfig as local.
It can be set either by setting env var KUBECONFIG or from ~/.kube/config
--mounts source1:target1,source2:target2,source3:target3
A list of extra folders or files separated by comma that need to be mounted to run the test flow.
It must be in the format of source1:target1,source2:target2,source3:target3.
--mandatory-env-vars string
A list of env vars separated by comma that will be promoted to the container.
They must be set on the local, and users will get an error if they are not set.
--optional-env-vars string
A list of env vars separated by comma that will be promoted to the container.
They can be optionally set on the local, and users will not get an error if they are not set.
Example
Run E2E tests for a Knative repository:
rundk --use-local-gcloud-credentials -- ./test/e2e-tests.sh --gcp-project-id=one-project-for-testing
rundk --use-local-kubeconfig -- ./test/e2e-tests.sh --run-tests
Note: the rundk
command must be run under the root or sub directory of your
local Knative repository.