diff --git a/.gitignore b/.gitignore index f09af2a95b..46eb58c2e1 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ __pycache__ /tests/.tox/ /tests/.vscode /sonobuoy-output +*.tmp diff --git a/scripts/test b/scripts/test index e7463e1b71..5cc3cf2a67 100755 --- a/scripts/test +++ b/scripts/test @@ -13,19 +13,18 @@ mkdir -p $artifacts # --- +[ "$ARCH" = 'arm' ] && \ + early-exit "Skipping sonobuoy, images not available for $ARCH." + E2E_OUTPUT=$artifacts test-run-sonobuoy # --- -if [ "$DRONE_BUILD_EVENT" = 'tag' ]; then - printf "\033[33mSkipping remaining tests on tag.\033[m\n" - exit 0 -fi +[ "$DRONE_BUILD_EVENT" = 'tag' ] && \ + early-exit 'Skipping remaining tests on tag.' -if [ "$ARCH" != 'amd64' ]; then - printf "\033[33mSkipping remaining tests, images not available for $ARCH.\033[m\n" - exit 0 -fi +[ "$ARCH" != 'amd64' ] && \ + early-exit "Skipping remaining tests, images not available for $ARCH." # --- diff --git a/scripts/test-helpers b/scripts/test-helpers index 060cc39e15..f14380861e 100755 --- a/scripts/test-helpers +++ b/scripts/test-helpers @@ -437,6 +437,14 @@ export -f provision-cluster # --- +early-exit() { + printf "\033[33m$1\033[m\n" + exit $2 +} +export -f early-exit + +# --- + run-test() { export PROVISION_LOCK=$(mktemp) ./scripts/test-runner $@ & @@ -454,27 +462,27 @@ export -f run-test # --- e2e-test() { - local label=$label - if [ -n "$LABEL_SUFFIX" ]; then - label="$label-$LABEL_SUFFIX" - fi - local logOutput= - if [ -n "$E2E_OUTPUT" ]; then - logOutput=$E2E_OUTPUT/$logName - fi - LABEL=$label LOG_OUTPUT=$logOutput run-test $@ + local label=$label + if [ -n "$LABEL_SUFFIX" ]; then + label="$label-$LABEL_SUFFIX" + fi + local logOutput= + if [ -n "$E2E_OUTPUT" ]; then + logOutput=$E2E_OUTPUT/$logName + fi + LABEL=$label LOG_OUTPUT=$logOutput run-test $@ } # --- run-e2e-tests() { - label=PARALLEL \ - logName=e2e-STATUS-${ARCH}-parallel.log \ - e2e-test ${sonobuoyParallelArgs[@]} + label=PARALLEL \ + logName=e2e-STATUS-${ARCH}-parallel.log \ + e2e-test ${sonobuoyParallelArgs[@]} - label=SERIAL \ - logName=e2e-STATUS-${ARCH}-serial.log \ - e2e-test ${sonobuoySerialArgs[@]} + label=SERIAL \ + logName=e2e-STATUS-${ARCH}-serial.log \ + e2e-test ${sonobuoySerialArgs[@]} } export -f run-e2e-tests diff --git a/scripts/test-run-basics b/scripts/test-run-basics index 02fcbe29c4..a02a66beb3 100755 --- a/scripts/test-run-basics +++ b/scripts/test-run-basics @@ -1,14 +1,39 @@ #!/bin/bash +all_services=( + coredns + local-path-provisioner + metrics-server + nginx-ingress-controller + nginx-ingress-default-backend +) + export NUM_SERVERS=1 export NUM_AGENTS=1 -export SERVER_ARGS='--no-deploy=traefik,coredns,local-storage,metrics-server' +export WAIT_SERVICES="${all_services[@]}" start-test() { docker exec $(cat $TEST_DIR/servers/1/metadata/name) check-config || true verify-valid-versions $(cat $TEST_DIR/servers/1/metadata/name) + verify-airgap-images $(cat $TEST_DIR/{servers,agents}/*/metadata/name) } export -f start-test +# -- check for changes to the airgap image list +verify-airgap-images() { + local airgap_image_list='scripts/airgap/image-list.txt' + + for name in $@; do + docker exec $name crictl images -o json \ + | jq -r '.images[].repoTags[0] | select(. != null)' + done | sort -u >$airgap_image_list.tmp + + if ! diff $airgap_image_list{,.tmp}; then + echo '[ERROR] Failed airgap image check' + return 1 + fi +} +export -f verify-airgap-images + # --- create a basic cluster and check for valid versions LABEL=BASICS run-test