diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 0edd72a2d7..9c45783cdb 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -102,8 +102,8 @@ run_image_build() { # Conditional per-layer builds when running in CI. # The build_images.sh script skips any images that have been downloaded from the cache. - $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer1-base - $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer2-presubmit + $(dry_run) bash -x ./bin/build_images.sh -f -l ./image-blueprints/layer1-base + $(dry_run) bash -x ./bin/build_images.sh -f -l ./image-blueprints/layer2-presubmit if [[ "${CI_JOB_NAME}" =~ .*periodic.* ]]; then $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer3-periodic diff --git a/test/resources/optional-config.resource b/test/resources/optional-config.resource new file mode 100644 index 0000000000..7dc4ab8ec5 --- /dev/null +++ b/test/resources/optional-config.resource @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Keywords for reconfiguring MicroShift with per-suite +... optional components via kustomizePaths. + +Library Collections +Library String +Resource common.resource +Resource microshift-config.resource +Resource microshift-process.resource +*** Keywords *** +Setup MicroShift With Optionals + [Documentation] Reconfigure MicroShift to load only the specified optional + ... manifests.d directories, clean all data, and restart fresh. + ... Each argument is a directory name under /usr/lib/microshift/manifests.d/ + ... (e.g. 001-microshift-olm). Call with no arguments to run base MicroShift + ... without any optional components. + [Arguments] @{manifests_dirs} + Save Default MicroShift Config + ${kustomize_yaml}= Build Optionals Config @{manifests_dirs} + ${config}= Replace MicroShift Config ${kustomize_yaml} + Stop MicroShift + Upload MicroShift Config ${config} + Cleanup MicroShift --all --keep-images + Systemctl start microshift.service + Wait For MicroShift Service + Wait Until Keyword Succeeds 10x 10s + ... Setup Kubeconfig + Wait For MicroShift + +Teardown MicroShift With Optionals + [Documentation] Restore the original MicroShift config after a suite. + ... If setup never completed, the default config variable may not exist, + ... so fall back to clearing the config file. + ${exists}= Run Keyword And Return Status Variable Should Exist ${DEFAULT_MICROSHIFT_CONFIG} + IF ${exists} + Restore Default MicroShift Config + ELSE + Clear MicroShift Config + END + +Build Optionals Config + [Documentation] Build a config.yaml string with kustomizePaths containing + ... only the base manifests path and the specified manifests.d entries. + [Arguments] @{manifests_dirs} + @{lines}= Create List + ... manifests: + ... \ \ kustomizePaths: + ... \ \ \ \ - /usr/lib/microshift/manifests + FOR ${dir} IN @{manifests_dirs} + Append To List ${lines} \ \ \ \ - /usr/lib/microshift/manifests.d/${dir} + END + ${config}= Catenate SEPARATOR=\n @{lines} + RETURN ${config} diff --git a/test/suites/optional/cert-manager.robot b/test/suites/optional/cert-manager.robot index 6db4a5f8d0..2109feec75 100644 --- a/test/suites/optional/cert-manager.robot +++ b/test/suites/optional/cert-manager.robot @@ -13,10 +13,11 @@ Resource ../../resources/oc.resource Resource ../../resources/microshift-config.resource Resource ../../resources/microshift-network.resource Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Resource ../../resources/ostree-health.resource -Suite Setup Setup Suite With Namespace -Suite Teardown Teardown Suite With Namespace +Suite Setup Setup +Suite Teardown Teardown Test Tags cert-manager certificates tls @@ -96,6 +97,18 @@ Test Cert manager with local acme server *** Keywords *** +Setup + [Documentation] Setup cert-manager suite with only its required optionals + Setup Suite + Setup MicroShift With Optionals 060-microshift-cert-manager + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE + +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite With Namespace + Deploy Hello MicroShift [Documentation] Deploys the hello microshift application (service included) ... in the given namespace. diff --git a/test/suites/optional/gateway-api.robot b/test/suites/optional/gateway-api.robot index a673f38d6c..8dd8d26d34 100644 --- a/test/suites/optional/gateway-api.robot +++ b/test/suites/optional/gateway-api.robot @@ -2,10 +2,12 @@ Documentation Test Gateway API functionality Resource ../../resources/microshift-network.resource +Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Resource ../../resources/oc.resource -Suite Setup Setup Suite With Namespace -Suite Teardown Teardown Suite With Namespace +Suite Setup Setup +Suite Teardown Teardown Test Tags optional gateway-api @@ -38,6 +40,18 @@ Test Simple HTTP Route *** Keywords *** +Setup + [Documentation] Setup gateway-api suite with only its required optionals + Setup Suite + Setup MicroShift With Optionals 000-microshift-gateway-api + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE + +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite With Namespace + Deploy Hello MicroShift [Documentation] Deploys the hello microshift application (service included) ... in the given namespace. diff --git a/test/suites/optional/generic-device-plugin.robot b/test/suites/optional/generic-device-plugin.robot index 22947f9b9c..e43754f108 100644 --- a/test/suites/optional/generic-device-plugin.robot +++ b/test/suites/optional/generic-device-plugin.robot @@ -3,12 +3,13 @@ Documentation Generic Device Plugin Resource ../../resources/microshift-config.resource Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Resource ../../resources/ostree-health.resource Variables strings.py Library strings.py -Suite Setup Setup Suite With Namespace -Suite Teardown Teardown Suite With GDP Cleanup +Suite Setup Setup Suite With Optionals +Suite Teardown Teardown Suite With GDP Cleanup And Optionals Test Tags generic-device-plugin @@ -244,11 +245,17 @@ Create Pod And Verify Allocation # Verify node shows correct allocation Verify Node Device Allocation ${expected_total_allocated} -Teardown Suite With GDP Cleanup - [Documentation] Suite teardown that cleans up GDP configuration and restarts MicroShift - # Clean up any remaining GDP configuration +Setup Suite With Optionals + [Documentation] Setup suite with base MicroShift only (no optional components) + Setup Suite + Setup MicroShift With Optionals + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE + +Teardown Suite With GDP Cleanup And Optionals + [Documentation] Suite teardown that cleans up GDP configuration and restores optionals config Remove Drop In MicroShift Config 10-gdp - # Restart MicroShift to clean state for next suite Restart MicroShift Wait For MicroShift Healthcheck Success + Teardown MicroShift With Optionals Teardown Suite With Namespace diff --git a/test/suites/optional/healthchecks-disabled-service.robot b/test/suites/optional/healthchecks-disabled-service.robot index 7f1d4a0b62..45711cfeb2 100644 --- a/test/suites/optional/healthchecks-disabled-service.robot +++ b/test/suites/optional/healthchecks-disabled-service.robot @@ -3,10 +3,11 @@ Documentation Test if healthcheck exits quickly when MicroShift service is Resource ../../resources/common.resource Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Library DateTime -Suite Setup Setup Suite -Suite Teardown Teardown Suite +Suite Setup Setup +Suite Teardown Teardown *** Test Cases *** @@ -36,3 +37,15 @@ Healthchecks Should Exit Fast And Successful When MicroShift Is Disabled Should Contain ${stderr} microshift.service is not enabled END [Teardown] Enable MicroShift + + +*** Keywords *** +Setup + [Documentation] Setup suite with base MicroShift only (no optional components) + Setup Suite + Setup MicroShift With Optionals + +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite diff --git a/test/suites/optional/multus.robot b/test/suites/optional/multus.robot index b311b14f7d..5645b75392 100644 --- a/test/suites/optional/multus.robot +++ b/test/suites/optional/multus.robot @@ -5,9 +5,10 @@ Resource ../../resources/common.resource Resource ../../resources/multus.resource Resource ../../resources/microshift-process.resource Resource ../../resources/microshift-rpm.resource +Resource ../../resources/optional-config.resource Suite Setup Setup -Suite Teardown Teardown Suite With Namespace +Suite Teardown Teardown Test Tags vm-only @@ -111,7 +112,10 @@ Ipvlan *** Keywords *** Setup [Documentation] Setup test suite - Setup Suite With Namespace + Setup Suite + Setup MicroShift With Optionals + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE ${out}= Command Should Work ip route list default | cut -d' ' -f5 @{enps}= String.Split To Lines ${out} @@ -121,6 +125,11 @@ Setup VAR ${IPVLAN_MASTER}= ${enps[1]} scope=SUITE Verify MicroShift RPM Install +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite With Namespace + Template And Create NAD And Pod [Documentation] Template NAD and create it along with Pod [Arguments] ${nad_tpl} ${pod} diff --git a/test/suites/optional/observability.robot b/test/suites/optional/observability.robot index 6c13000cdd..fa897f8135 100644 --- a/test/suites/optional/observability.robot +++ b/test/suites/optional/observability.robot @@ -9,6 +9,8 @@ Library ../../resources/prometheus.py Library ../../resources/loki.py Resource ../../resources/kubeconfig.resource Resource ../../resources/common.resource +Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Resource ../../resources/systemd.resource Resource ../../resources/observability.resource Resource ../../resources/microshift-network.resource @@ -68,7 +70,10 @@ Logs Should Not Contain Receiver Errors Setup Suite And Prepare Test Host [Documentation] The service starts after MicroShift starts and thus will start generating pertinent log data ... right away. When the suite is executed, immediately get the cursor for the microshift-observability unit. - Setup Suite With Namespace + Setup Suite + Setup MicroShift With Optionals + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE # Configure the firewall for the Prometheus exporter Command Should Work sudo firewall-cmd --permanent --zone=public --add-port=8889/tcp Command Should Work sudo firewall-cmd --reload @@ -124,6 +129,7 @@ Set Test OTEL Configuration Teardown Suite And Revert Test Host [Documentation] Set back original OTEL config and teardown Suite Set Back Original OTEL Configuration + Teardown MicroShift With Optionals Teardown Suite With Namespace Set Back Original OTEL Configuration diff --git a/test/suites/optional/olm.robot b/test/suites/optional/olm.robot index 46f52b7d45..db98998f23 100644 --- a/test/suites/optional/olm.robot +++ b/test/suites/optional/olm.robot @@ -4,6 +4,7 @@ Documentation Operator Lifecycle Manager on MicroShift Resource ../../resources/common.resource Resource ../../resources/microshift-process.resource Resource ../../resources/microshift-rpm.resource +Resource ../../resources/optional-config.resource Resource ../../resources/oc.resource Library DataFormats.py @@ -148,6 +149,7 @@ Setup Login MicroShift Host Setup Kubeconfig Verify MicroShift RPM Install + Setup MicroShift With Optionals 001-microshift-olm Setup Test [Documentation] Test setup @@ -164,6 +166,7 @@ Setup Test Teardown [Documentation] Test suite teardown + Teardown MicroShift With Optionals Logout MicroShift Host Remove Kubeconfig diff --git a/test/suites/optional/sriov.robot b/test/suites/optional/sriov.robot index ec203ed8f2..97295ae1e1 100644 --- a/test/suites/optional/sriov.robot +++ b/test/suites/optional/sriov.robot @@ -2,9 +2,10 @@ Documentation MicroShift SR-IOV tests Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource -Suite Setup Setup Suite -Suite Teardown Teardown Suite +Suite Setup Setup +Suite Teardown Teardown Test Tags optional sriov slow @@ -47,6 +48,16 @@ Create VFs And Verify *** Keywords *** +Setup + [Documentation] Setup sriov suite with only its required optionals + Setup Suite + Setup MicroShift With Optionals 070-microshift-sriov + +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite + Cleanup SR-IOV Policy [Documentation] Deletes the policy Run With Kubeconfig oc delete -f ${OUTPUT_DIR}/final-sriov-policy.yaml -n sriov-network-operator diff --git a/test/suites/optional/tls-scanner.robot b/test/suites/optional/tls-scanner.robot index 1a26973871..4add7f2202 100644 --- a/test/suites/optional/tls-scanner.robot +++ b/test/suites/optional/tls-scanner.robot @@ -10,10 +10,12 @@ Library Process Library String Resource ../../resources/common.resource Resource ../../resources/kubeconfig.resource +Resource ../../resources/microshift-process.resource +Resource ../../resources/optional-config.resource Resource ../../resources/oc.resource -Suite Setup Setup Suite With Namespace -Suite Teardown Teardown Suite With Namespace +Suite Setup Setup +Suite Teardown Teardown Test Tags tls-scanner security optional @@ -51,6 +53,18 @@ TLS Scanner Host Scan Completes And Produces Artifacts *** Keywords *** +Setup + [Documentation] Setup suite with base MicroShift only (no optional components) + Setup Suite + Setup MicroShift With Optionals + ${ns}= Create Unique Namespace + VAR ${NAMESPACE}= ${ns} scope=SUITE + +Teardown + [Documentation] Restore config and teardown suite + Teardown MicroShift With Optionals + Teardown Suite With Namespace + Check Required Scanner Variables [Documentation] Fail if SCANNER_IMAGE is not set. Should Not Be Empty ${SCANNER_IMAGE}