diff --git a/docs/contributor/storage/default_csi_plugin.md b/docs/contributor/storage/default_csi_plugin.md index bd2a838c9e..127e690db8 100644 --- a/docs/contributor/storage/default_csi_plugin.md +++ b/docs/contributor/storage/default_csi_plugin.md @@ -161,7 +161,7 @@ spec: - sh - -c - sleep 1d - image: nginxinc/nginx-unprivileged:latest + image: quay.io/microshift/busybox:1.36 name: test-container securityContext: allowPrivilegeEscalation: false @@ -250,7 +250,7 @@ spec: - sh - -c - sleep 1d - image: nginxinc/nginx-unprivileged:latest + image: quay.io/microshift/busybox:1.36 name: test-container securityContext: allowPrivilegeEscalation: false diff --git a/test/assets/kustomizations/base/pod-base.yaml b/test/assets/kustomizations/base/pod-base.yaml index 8e01780051..2b11644349 100644 --- a/test/assets/kustomizations/base/pod-base.yaml +++ b/test/assets/kustomizations/base/pod-base.yaml @@ -9,7 +9,7 @@ spec: type: RuntimeDefault containers: - name: test-container - image: docker.io/nginxinc/nginx-unprivileged:latest + image: quay.io/microshift/busybox:1.36 securityContext: allowPrivilegeEscalation: false capabilities: diff --git a/test/assets/reboot/pod-with-pvc.yaml b/test/assets/reboot/pod-with-pvc.yaml index 04e160c09f..c5e1ab4c9f 100644 --- a/test/assets/reboot/pod-with-pvc.yaml +++ b/test/assets/reboot/pod-with-pvc.yaml @@ -21,7 +21,7 @@ spec: type: RuntimeDefault containers: - name: test-container - image: docker.io/nginxinc/nginx-unprivileged:latest + image: quay.io/microshift/busybox:1.36 securityContext: allowPrivilegeEscalation: false capabilities: diff --git a/test/bin/ci_phase_boot_and_test.sh b/test/bin/ci_phase_boot_and_test.sh index a3b10b0dc6..fa8a374b35 100755 --- a/test/bin/ci_phase_boot_and_test.sh +++ b/test/bin/ci_phase_boot_and_test.sh @@ -84,13 +84,27 @@ else progress="" fi +jobs_arg="" +scenario_action="create-and-run" +if [[ "${SCENARIO_SOURCES:-}" =~ .*releases.* ]]; then + # Release scenarios have grown (e.g. the router scenarios were split + # from 1 into 5) and no longer fit if every scenario's VMs stay up for + # the whole job. Shut down passed scenarios' VMs as they finish so the + # hypervisor only ever holds the still-running scenarios' VMs. + export GREENBOOT_TIMEOUT=1200 + jobs_arg="-j 20" + scenario_action="create-run-shutdown" +fi + TEST_OK=true +# shellcheck disable=SC2086 if ! parallel \ + ${jobs_arg} \ ${progress} \ --results "${SCENARIO_INFO_DIR}/{/.}/boot_and_run.log" \ --joblog "${BOOT_TEST_JOB_LOG}" \ --delay 5 \ - bash -x ./bin/scenario.sh create-and-run ::: "${SCENARIOS_TO_RUN}"/*.sh ; then + bash -x ./bin/scenario.sh "${scenario_action}" ::: "${SCENARIOS_TO_RUN}"/*.sh ; then TEST_OK=false fi diff --git a/test/bin/scenario.sh b/test/bin/scenario.sh index 65ba2c026a..d6c8151ae8 100755 --- a/test/bin/scenario.sh +++ b/test/bin/scenario.sh @@ -1032,6 +1032,30 @@ remove_vm() { fi } +# Power off all the VMs of the scenario without undefining them or +# removing their storage. Frees the vCPUs and memory on the hypervisor +# while keeping the domains and disks available for inspection. +shutdown_scenario_vms() { + local vmdir + local vmname + local full_vmname + for vmdir in "${SCENARIO_INFO_DIR}/${SCENARIO}"/vms/*; do + if [ ! -d "${vmdir}" ]; then + continue + fi + vmname="$(basename "${vmdir}")" + full_vmname="$(full_vm_name "${vmname}")" + if sudo virsh dumpxml "${full_vmname}" >/dev/null; then + if ! sudo virsh dominfo "${full_vmname}" | grep '^State' | grep -q 'shut off'; then + sudo virsh destroy --graceful "${full_vmname}" || true + fi + if ! sudo virsh dominfo "${full_vmname}" | grep '^State' | grep -q 'shut off'; then + sudo virsh destroy "${full_vmname}" || true + fi + fi + done +} + # Configure the firewall in the VM based on the instructions in the documentation. configure_vm_firewall() { local -r vmname="$1" @@ -1641,6 +1665,15 @@ case "${action}" in action_create "$@" action_run "$@" ;; + create-run-shutdown) + action_create "$@" + action_run "$@" + rc=0 + sos_report true || rc=1 + trap "close_junit" EXIT + shutdown_scenario_vms || echo "WARNING: failed to shut down the VMs for ${SCENARIO}" + exit "${rc}" + ;; *) error "Unknown instruction ${action}" usage diff --git a/test/resources/oc.resource b/test/resources/oc.resource index cba2eb13a8..24b90fb5d8 100644 --- a/test/resources/oc.resource +++ b/test/resources/oc.resource @@ -57,7 +57,7 @@ Oc Exec [Documentation] Run 'oc exec' on a specific pod in the curret test namespace ... Returns the command's combined STDOUT/STDER [Arguments] ${pod} ${cmd} ${ns}=${NAMESPACE} ${type}=pod - ${output}= Run With Kubeconfig oc exec -n ${ns} ${type}/${pod} -- /bin/bash -c '${cmd}' + ${output}= Run With Kubeconfig oc exec -n ${ns} ${type}/${pod} -- /bin/sh -c '${cmd}' RETURN ${output} Oc Wait