Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/contributor/storage/default_csi_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/assets/kustomizations/base/pod-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/assets/reboot/pod-with-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 15 additions & 1 deletion test/bin/ci_phase_boot_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
33 changes: 33 additions & 0 deletions test/bin/scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/resources/oc.resource
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down