diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index be79bd4fa..a5d415e0d 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -66,12 +66,7 @@ jobs: - name: Run e2e tests run: | - if [[ "${{ matrix.name }}" != "gazpacho" ]]; then - echo "Skip limit import tests due to Keystone API issue(list limit) in older versions" - rm -rf internal/controllers/limit/tests/limit-import* - fi - - make test-e2e + make test-e2e E2E_OPENSTACK_VERSION=$(echo ${{ matrix.openstack_version }} | cut -d/ -f2) make test-examples - name: Generate logs on failure diff --git a/Makefile b/Makefile index 333f78078..4abdc4a7c 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,9 @@ test: envtest # run. If not set, all discovered kuttl tests will run. # - E2E_KUTTL_TEST: if set, only run the specific named test, e.g. # 'create-full-v4'. If not set, all tests will run. +# - E2E_OPENSTACK_VERSION: if set, the known OpenStack versions range covering +# this version will be passed as a test run label `--test-run-labels min-version1=true,min-version2=true,max-version2=true,max-version3=true,`. +# See ./hack/e2e.sh . Test cases can be run/skipped with `testRunSelector` in `TestCase` based on it. .PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up. test-e2e: kuttl # go test ./test/e2e/ -v -ginkgo.v @@ -333,7 +336,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.20.1 ENVTEST_VERSION ?= release-0.23 GOLANGCI_LINT_VERSION ?= v2.11.4 MOCKGEN_VERSION ?= v0.6.0 -KUTTL_VERSION ?= v0.27.0 +KUTTL_VERSION ?= v0.28.0 GOVULNCHECK_VERSION ?= v1.1.4 OPERATOR_SDK_VERSION ?= v1.42.2 diff --git a/hack/e2e.sh b/hack/e2e.sh index 5422ae9c8..4b503220b 100755 --- a/hack/e2e.sh +++ b/hack/e2e.sh @@ -39,10 +39,39 @@ if [ -n "$E2E_KUTTL_DELETE_OPTION" ]; then E2E_KUTTL_DELETE_OPT="--delete ${E2E_KUTTL_DELETE_OPTION}" fi +# Add the OpenStack version to the test run labels if it is set. +# https://releases.openstack.org/ +# 2027.1 Indri +# 2026.2 Hibiscus +# 2026.1 Gazpacho +# 2025.2 Flamingo +# 2025.1 Epoxy +KNOWN_RELEASES=("2025.1" "2025.2" "2026.1" "2026.2" "2027.1") +E2E_KUTTL_TEST_RUN_LABELS= +if [ -n "${E2E_OPENSTACK_VERSION:-}" ]; then + OS_RELEASE="$E2E_OPENSTACK_VERSION" + labels= + + for release in "${KNOWN_RELEASES[@]}"; do + if [[ ! "$OS_RELEASE" < "$release" ]]; then + labels="${labels:+$labels,}min-${release}=true" + fi + if [[ ! "$OS_RELEASE" > "$release" ]]; then + labels="${labels:+$labels,}max-${release}=true" + fi + done + + if [ -n "$labels" ]; then + E2E_KUTTL_TEST_RUN_LABELS="--test-run-labels $labels" + fi +fi + # Export variables referenced in kuttl tests. export E2E_EXTERNAL_NETWORK_NAME export E2E_KUTTL_OSCLOUDS=${PREPARED_OSCLOUDS} export E2E_KUTTL_CACERT_OPT export E2E_KUTTL_FLAVOR -kubectl kuttl test $E2E_KUTTL_DIR $E2E_KUTTL_TIMEOUT_OPT $E2E_KUTTL_DELETE_OPT --test "$E2E_KUTTL_TEST" +set -x +kubectl kuttl test $E2E_KUTTL_DIR $E2E_KUTTL_TIMEOUT_OPT $E2E_KUTTL_DELETE_OPT $E2E_KUTTL_TEST_RUN_LABELS --test "$E2E_KUTTL_TEST" +set +x diff --git a/internal/controllers/limit/tests/limit-import-dependency/00-test-case.yaml b/internal/controllers/limit/tests/limit-import-dependency/00-test-case.yaml new file mode 100644 index 000000000..5b96ae3c7 --- /dev/null +++ b/internal/controllers/limit/tests/limit-import-dependency/00-test-case.yaml @@ -0,0 +1,9 @@ +# Skip limit import tests due to a Keystone API issue (list limit) in older versions +apiVersion: kuttl.dev/v1beta1 +kind: TestCase +testRunSelector: + matchExpressions: + - key: "max-2025.2" + operator: NotIn + values: + - "true" diff --git a/internal/controllers/limit/tests/limit-import-error/00-test-case.yaml b/internal/controllers/limit/tests/limit-import-error/00-test-case.yaml new file mode 100644 index 000000000..5b96ae3c7 --- /dev/null +++ b/internal/controllers/limit/tests/limit-import-error/00-test-case.yaml @@ -0,0 +1,9 @@ +# Skip limit import tests due to a Keystone API issue (list limit) in older versions +apiVersion: kuttl.dev/v1beta1 +kind: TestCase +testRunSelector: + matchExpressions: + - key: "max-2025.2" + operator: NotIn + values: + - "true" diff --git a/internal/controllers/limit/tests/limit-import/00-test-case.yaml b/internal/controllers/limit/tests/limit-import/00-test-case.yaml new file mode 100644 index 000000000..5b96ae3c7 --- /dev/null +++ b/internal/controllers/limit/tests/limit-import/00-test-case.yaml @@ -0,0 +1,9 @@ +# Skip limit import tests due to a Keystone API issue (list limit) in older versions +apiVersion: kuttl.dev/v1beta1 +kind: TestCase +testRunSelector: + matchExpressions: + - key: "max-2025.2" + operator: NotIn + values: + - "true"