From 806e04900d0b73d2e384a26770a6165ec3761187 Mon Sep 17 00:00:00 2001 From: Pablo Acevedo Montserrat Date: Mon, 18 May 2026 20:36:40 +0200 Subject: [PATCH 1/3] USHIFT-6979: Add shared keywords for per-suite optional component config Add optional-config.resource with keywords to reconfigure MicroShift's kustomizePaths so each test suite loads only its required manifests.d directories. This avoids running all optional controllers simultaneously, reducing API server contention from concurrent controller wake-ups. --- test/resources/optional-config.resource | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/resources/optional-config.resource diff --git a/test/resources/optional-config.resource b/test/resources/optional-config.resource new file mode 100644 index 0000000000..2eb061223b --- /dev/null +++ b/test/resources/optional-config.resource @@ -0,0 +1,54 @@ +*** 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 +Resource ostree-health.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 Healthcheck Success + Setup Kubeconfig + +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} + VAR @{lines}= + ... 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} From f28ea214517468fcc5ec28fec58bd05152a7c092 Mon Sep 17 00:00:00 2001 From: Pablo Acevedo Montserrat Date: Mon, 18 May 2026 20:36:50 +0200 Subject: [PATCH 2/3] USHIFT-6979: Configure per-suite kustomizePaths in optional test suites Each optional test suite now reconfigures MicroShift at setup to load only its own manifests.d directory, cleans etcd data, and restarts fresh. Suites that don't need optional components run with base manifests only. Bump TEST_EXECUTION_TIMEOUT to 60m to account for the per-suite restart overhead. Suite-to-manifests.d mapping: - olm.robot: 001-microshift-olm - cert-manager.robot: 060-microshift-cert-manager - gateway-api.robot: 000-microshift-gateway-api - sriov.robot: 070-microshift-sriov - observability.robot: 003-microshift-observability - multus, healthchecks, tls-scanner, GDP: base only --- .../el9/presubmits/el98-src@optional.sh | 5 ++++ test/scenarios/periodics/el98-src@optional.sh | 5 ++++ test/suites/optional/cert-manager.robot | 17 ++++++++++++-- test/suites/optional/gateway-api.robot | 18 +++++++++++++-- .../optional/generic-device-plugin.robot | 19 ++++++++++----- .../healthchecks-disabled-service.robot | 17 ++++++++++++-- test/suites/optional/multus.robot | 18 ++++++++++++--- test/suites/optional/observability.robot | 23 ++++++++++++------- test/suites/optional/olm.robot | 3 +++ test/suites/optional/sriov.robot | 15 ++++++++++-- test/suites/optional/tls-scanner.robot | 18 +++++++++++++-- 11 files changed, 131 insertions(+), 27 deletions(-) diff --git a/test/scenarios-bootc/el9/presubmits/el98-src@optional.sh b/test/scenarios-bootc/el9/presubmits/el98-src@optional.sh index 9e535bcde0..85f7b5d5db 100644 --- a/test/scenarios-bootc/el9/presubmits/el98-src@optional.sh +++ b/test/scenarios-bootc/el9/presubmits/el98-src@optional.sh @@ -2,6 +2,11 @@ # Sourced from scenario.sh and uses functions defined there. +# Each optional suite restarts MicroShift with its own kustomizePaths config, +# adding ~10 minutes of restart overhead to the total execution time. +# shellcheck disable=SC2034 # used elsewhere +TEST_EXECUTION_TIMEOUT=60m + # shellcheck disable=SC2034 # used elsewhere # Increase greenboot timeout for optional packages (more services to start) GREENBOOT_TIMEOUT=1200 diff --git a/test/scenarios/periodics/el98-src@optional.sh b/test/scenarios/periodics/el98-src@optional.sh index 209b12cdff..5952472fe0 100644 --- a/test/scenarios/periodics/el98-src@optional.sh +++ b/test/scenarios/periodics/el98-src@optional.sh @@ -2,6 +2,11 @@ # Sourced from scenario.sh and uses functions defined there. +# Each optional suite restarts MicroShift with its own kustomizePaths config, +# adding ~10 minutes of restart overhead to the total execution time. +# shellcheck disable=SC2034 # used elsewhere +TEST_EXECUTION_TIMEOUT=60m + # Redefine network-related settings to use the dedicated network bridge VM_BRIDGE_IP="$(get_vm_bridge_ip "${VM_MULTUS_NETWORK}")" # shellcheck disable=SC2034 # used elsewhere 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..ded6a0506c 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..607902d9b2 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,15 +112,26 @@ 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 + Setup Network Interfaces + Verify MicroShift RPM Install +Setup Network Interfaces + [Documentation] Detect network interfaces for macvlan and ipvlan tests ${out}= Command Should Work ip route list default | cut -d' ' -f5 @{enps}= String.Split To Lines ${out} ${len}= Get Length ${enps} Should Be True ${len}>=2 VAR ${MACVLAN_MASTER}= ${enps[0]} scope=SUITE 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 diff --git a/test/suites/optional/observability.robot b/test/suites/optional/observability.robot index 6c13000cdd..d1ffb51be0 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,19 +70,23 @@ 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 - # Configure the firewall for the Prometheus exporter + Setup Suite + Setup MicroShift With Optionals 003-microshift-observability + ${ns} Create Unique Namespace + VAR ${NAMESPACE} ${ns} scope=SUITE + Configure Firewall And Observability + Create Hello MicroShift Pod + Expose Hello MicroShift + ${cur} Get Journal Cursor unit=microshift-observability + VAR ${JOURNAL_CUR} ${cur} scope=SUITE + +Configure Firewall And Observability + [Documentation] Configure firewall for Prometheus exporter and set up observability Command Should Work sudo firewall-cmd --permanent --zone=public --add-port=8889/tcp Command Should Work sudo firewall-cmd --reload - # Configure observability settings Check Required Observability Variables Ensure Loki Is Ready Set Test OTEL Configuration - # We need to do something to the cluster to generate new kube events - Create Hello MicroShift Pod - Expose Hello MicroShift - ${cur} Get Journal Cursor unit=microshift-observability - VAR ${JOURNAL_CUR} ${cur} scope=SUITE Check Required Observability Variables [Documentation] Check if the required proxy variables are set @@ -124,6 +130,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 63a64e68fc..4443f1eb59 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 @@ -46,6 +47,7 @@ Setup Login MicroShift Host Setup Kubeconfig Verify MicroShift RPM Install + Setup MicroShift With Optionals 001-microshift-olm Setup Test [Documentation] Test setup @@ -62,6 +64,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} From affc77a0a02820df489ce9734f64a4a4a6216808 Mon Sep 17 00:00:00 2001 From: Pablo Acevedo Montserrat Date: Mon, 18 May 2026 20:36:59 +0200 Subject: [PATCH 3/3] USHIFT-6979: Filter healthcheck optional workloads by kustomizePaths The healthcheck previously determined which optional workloads to wait for by checking whether manifests.d directories exist on the filesystem. This ignored the kustomizePaths configuration, causing the healthcheck to wait for components that were not configured to be deployed. Now the healthcheck also verifies that each optional component path is included in the resolved kustomizePaths before adding it to the wait list. This allows selective loading of optional components via config without the healthcheck timing out on unconfigured ones. --- .../microshift_optional_workloads.go | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/pkg/healthcheck/microshift_optional_workloads.go b/pkg/healthcheck/microshift_optional_workloads.go index 6a60434267..80e2d9a3b0 100644 --- a/pkg/healthcheck/microshift_optional_workloads.go +++ b/pkg/healthcheck/microshift_optional_workloads.go @@ -1,6 +1,7 @@ package healthcheck import ( + "github.com/openshift/microshift/pkg/config" "github.com/openshift/microshift/pkg/util" "k8s.io/klog/v2" ) @@ -40,16 +41,39 @@ var optionalWorkloadPaths = map[string]optionalWorkloads{ } // fillOptionalMicroShiftWorkloads assembles list of optional MicroShift workloads -// existing on the filesystem as manifests (in comparison to Multus which -// manifests are part of MicroShift binary). +// that are both present on the filesystem and included in the configured +// kustomizePaths. This ensures the healthcheck only waits for optional +// components that MicroShift was configured to deploy. func fillOptionalMicroShiftWorkloads(workloadsToCheck map[string]NamespaceWorkloads) error { + cfg, err := config.ActiveConfig() + if err != nil { + return err + } + + configuredPaths, err := cfg.Manifests.GetKustomizationPaths() + if err != nil { + return err + } + + configuredSet := make(map[string]bool, len(configuredPaths)) + for _, p := range configuredPaths { + configuredSet[p] = true + } + for path, ow := range optionalWorkloadPaths { if exists, err := util.PathExists(path); err != nil { return err - } else if exists { - klog.Infof("Optional component path exists: %s - expecting %v in namespace %q", path, ow.Workloads.String(), ow.Namespace) - workloadsToCheck[ow.Namespace] = ow.Workloads + } else if !exists { + continue + } + + if !configuredSet[path] { + klog.Infof("Optional component path exists but is not in configured kustomizePaths: %s - skipping", path) + continue } + + klog.Infof("Optional component path exists and is configured: %s - expecting %v in namespace %q", path, ow.Workloads.String(), ow.Namespace) + workloadsToCheck[ow.Namespace] = ow.Workloads } return nil }