This test framework has a two-fold goal: provide a short iterating cycle for work on HyperShift operators locally as well as a quick validation harness for features that do not require cloud-provider-specific functionality.
The run.sh
script allows for local iteration on HyperShift - use a shell to set up the environment and keep it
running, while using other shells to interact with the environment or even iterate on tests.
Make sure you have kind
and some container image building utility (docker
, buildah
, podman
) installed.
Keep an eye out for too many open files
errors when launching HostedCluster
s and apply the remedy.
An image is built by copying local binaries into a base container. Ensure the script knows how to map your local operating system to a host container image, or you will have issues with dynamic linking.
Visit the web console to create a local pull secret - this is required to interrogate OCP release bundles.
Set up the following environment variables:
export PATH="${PATH}:$(realpath ./bin)"
export WORK_DIR=/tmp/integration # this directory is persistent between runs, cleared only as necessary
export PULL_SECRET="REPLACE-ME" # point this environment variable at the pull secret you generated
Run the following in a shell - the process will set up the kind
cluster and requisite hypershift
infrastructure,
then wait for SIGINT
indefinitely. On interrupt, the process will clean up after itself.
./test/integration/run.sh \
cluster-up \ # start the kind cluster
image \ # build the container image for HyperShift, load it into the cluster
setup # start the HyperShift operator and any HostedClusters for selected tests
Run the following for quick iteration - the test process will expect that setup is complete. Use ${GO_TEST_FLAGS}
to
specify what subset of the tests to run.
./test/integration/run.sh \
test # run tests
When running the setup
or test
targets in run.sh
, provide $GO_TEST_FLAGS='-run selector'
to only set up and run
some subset of tests.
When you've made changes to the HyperShift codebase and need to re-deploy the operators, run the following -
a new image will be built, loaded into the cluster, and all Pod
s deploying the image will be deleted, so
the new image is picked up on restart.
./test/integration/run.sh \
image \ # build the container image for HyperShift, load it into the cluster
reload # power-cycle all pods that should be running the image