From 063c60b73d4209daddfbb10c03c7aa0a93297e0a Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Fri, 26 Jan 2024 10:51:57 -0600 Subject: [PATCH] Add functionality for running against local CRC instances --- docs/configuration.md | 11 +++++++++++ script/run-container.sh | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 6159e01e2a..5b1885083b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -107,6 +107,17 @@ export TNF_ENABLE_XML_CREATION=true This will create a file named `cnf-certification-test/cnf-certification-tests_junit.xml`. + +#### Enable running container against OpenShift Local + +While running the test suite as a container, you can enable the container to be able to reach the local CRC instance by setting: + +```shell +export TNF_ENABLE_CRC_TESTING=true +``` + +This utilizes the `--add-host` flag in Docker to be able to point `api.crc.testing` to the host gateway. + ### Exceptions These options allow adding exceptions to skip several checks for different resources. The exceptions must be justified in order to pass the CNF Certification. diff --git a/script/run-container.sh b/script/run-container.sh index 0335e20144..e79286978a 100755 --- a/script/run-container.sh +++ b/script/run-container.sh @@ -160,6 +160,10 @@ if [ -n "${DNS_ARG}" ]; then DNS_ARG="--dns $DNS_ARG" fi +if [ -n "${TNF_ENABLE_CRC_TESTING}" ]; then + ADD_HOST_ARG="--add-host api.crc.testing:host-gateway" +fi + set -x # shellcheck disable=SC2068,SC2086 # Double quote array expansions. ${TNF_CONTAINER_CLIENT} run --rm $DNS_ARG \ @@ -168,6 +172,7 @@ ${TNF_CONTAINER_CLIENT} run --rm $DNS_ARG \ ${container_tnf_dockercfg_volumes_cmd_args[@]} \ $CONFIG_VOLUME_MOUNT_ARG \ $TNF_OFFLINE_DB_MOUNT_ARG \ + $ADD_HOST_ARG \ -v $OUTPUT_LOC:$CONTAINER_TNF_DIR/claim:Z \ -e KUBECONFIG=$CONTAINER_TNF_KUBECONFIG \ -e PFLT_DOCKERCONFIG=$CONTAINER_TNF_DOCKERCFG \