Skip to content

Commit cc98bdd

Browse files
committed
openstack-test: migrate CI config to OTE (openshift-tests-extension)
Update the openstack-test main CI configuration to support the OTE migration in openshift/openstack-test#260. Changes: - binary_build_commands: build OTE extension binary via 'make tests-ext-build', package as tar.gz, and place at /usr/bin/ for payload discovery by openshift-tests - build test: verify the extension binary with --help instead of the removed openstack-tests binary - test/ccpmso jobs: use new openstack-test-openstack-ote step ref - dualstack jobs: override test phase with openshift-e2e-test + openstack-test-openstack-ote (replacing the old chain that used openstack-test-openstack) New step registry ref openstack-test-openstack-ote: - Runs from 'tests' image (openshift-tests) instead of 'openstack-tests' - Discovers the openstack-test extension from the release payload - Grants image-puller access for extension discovery - Supports same env vars: OS_CLOUD, OPENSTACK_TEST_SKIPS, CONFIG_TYPE - Runs 'openshift-tests run openstack-test/all' suite The old openstack-test-openstack step ref is preserved for older release branches that still use the standalone openstack-tests binary.
1 parent 62a0a71 commit cc98bdd

5 files changed

Lines changed: 115 additions & 4 deletions

File tree

ci-operator/config/openshift/openstack-test/openshift-openstack-test-main.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
binary_build_commands: go build -o /bin/openstack-tests ./cmd/openshift-tests
1+
binary_build_commands: make tests-ext-build && cd bin && tar -czvf openstack-test-test-extension.tar.gz
2+
openstack-test-tests-ext && cp openstack-test-test-extension.tar.gz /usr/bin/
23
build_root:
34
from_repository: true
45
use_build_cache: true
@@ -28,7 +29,7 @@ resources:
2829
memory: 200Mi
2930
tests:
3031
- as: build
31-
commands: openstack-tests --help
32+
commands: ./bin/openstack-test-tests-ext --help
3233
container:
3334
from: bin
3435
- as: verify
@@ -41,7 +42,7 @@ tests:
4142
env:
4243
CONFIG_TYPE: minimal
4344
test:
44-
- ref: openstack-test-openstack
45+
- ref: openstack-test-openstack-ote
4546
workflow: openshift-e2e-openstack-ipi
4647
- always_run: false
4748
as: e2e-openstack-ccpmso
@@ -61,13 +62,16 @@ tests:
6162
requests:
6263
cpu: 100m
6364
timeout: 7h0m0s
64-
- ref: openstack-test-openstack
65+
- ref: openstack-test-openstack-ote
6566
workflow: openshift-e2e-openstack-ipi
6667
- always_run: false
6768
as: e2e-openstack-dualstack
6869
optional: true
6970
steps:
7071
cluster_profile: openstack-hwoffload
72+
test:
73+
- ref: openshift-e2e-test
74+
- ref: openstack-test-openstack-ote
7175
workflow: openshift-e2e-openstack-dualstack
7276
- always_run: false
7377
as: e2e-openstack-dualstack-v6primary
@@ -76,6 +80,9 @@ tests:
7680
cluster_profile: openstack-hwoffload
7781
env:
7882
CONFIG_TYPE: dualstack-v6primary
83+
test:
84+
- ref: openshift-e2e-test
85+
- ref: openstack-test-openstack-ote
7986
workflow: openshift-e2e-openstack-dualstack
8087
zz_generated_metadata:
8188
branch: main
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
approvers:
2+
- openstack-approvers
3+
reviewers:
4+
- openstack-reviewers
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeuo pipefail
4+
5+
export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml"
6+
export PATH=/usr/libexec/origin:$PATH
7+
8+
declare TEST_ARGS=''
9+
10+
# Force the IPv6 endpoint
11+
if [[ "${CONFIG_TYPE}" == *"singlestackv6"* ]]; then
12+
export OS_CLOUD="${OS_CLOUD}-ipv6"
13+
fi
14+
15+
# For disconnected or otherwise unreachable environments, we want to
16+
# have steps use an HTTP(S) proxy to reach the API server. This proxy
17+
# configuration file should export HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
18+
# environment variables, as well as their lowercase equivalents (note
19+
# that libcurl doesn't recognize the uppercase variables).
20+
if test -f "${SHARED_DIR}/proxy-conf.sh"
21+
then
22+
# shellcheck disable=SC1090
23+
source "${SHARED_DIR}/proxy-conf.sh"
24+
fi
25+
26+
# Set up the test provider for OpenStack
27+
if test -n "${HTTP_PROXY:-}" -o -n "${HTTPS_PROXY:-}"; then
28+
export TEST_PROVIDER='{"type":"openstack","disconnected":true}'
29+
else
30+
export TEST_PROVIDER='{"type":"openstack"}'
31+
fi
32+
33+
# In order for openshift-tests to pull external binary images from the
34+
# payload, we need access enabled to the images on the build farm. In
35+
# order to do that, we need to unset the KUBECONFIG so we talk to the
36+
# build farm, not the cluster under test.
37+
echo "Granting access for image pulling from the build farm..."
38+
KUBECONFIG_BAK=$KUBECONFIG
39+
unset KUBECONFIG
40+
oc adm policy add-role-to-group system:image-puller system:unauthenticated --namespace "${NAMESPACE}" || echo "Warning: Failed to grant image puller access, continuing..."
41+
export KUBECONFIG=$KUBECONFIG_BAK
42+
43+
TEST_SUITE="openstack-test/all"
44+
45+
if [[ -n "${OPENSTACK_TEST_SKIPS}" ]]; then
46+
TESTS="$(openshift-tests run --dry-run --provider "${TEST_PROVIDER}" "${TEST_SUITE}")"
47+
echo "${TESTS}" | grep -v "${OPENSTACK_TEST_SKIPS}" >/tmp/tests
48+
echo "Skipping tests:"
49+
echo "${TESTS}" | grep "${OPENSTACK_TEST_SKIPS}" || { exit_code=$?; echo 'Error: no tests were found matching the OPENSTACK_TEST_SKIPS regex:'; echo "$OPENSTACK_TEST_SKIPS"; return $exit_code; }
50+
TEST_ARGS="${TEST_ARGS:-} --file /tmp/tests"
51+
fi
52+
53+
openshift-tests run "${TEST_SUITE}" ${TEST_ARGS:-} \
54+
--provider "${TEST_PROVIDER}" \
55+
--junit-dir "${ARTIFACT_DIR}/junit" \
56+
-o "${ARTIFACT_DIR}/e2e.log"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"path": "openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml",
3+
"owners": {
4+
"approvers": [
5+
"openstack-approvers"
6+
],
7+
"reviewers": [
8+
"openstack-reviewers"
9+
]
10+
}
11+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ref:
2+
as: openstack-test-openstack-ote
3+
from: tests
4+
cli: latest
5+
commands: openstack-test-openstack-ote-commands.sh
6+
resources:
7+
requests:
8+
cpu: "3"
9+
memory: 600Mi
10+
limits:
11+
memory: 10Gi
12+
env:
13+
- name: OS_CLOUD
14+
default: "openstack"
15+
documentation: Name of cloud to use from ${SHARED_DIR}/clouds.yaml file
16+
- name: OPENSTACK_TEST_SKIPS
17+
default: ""
18+
documentation: |
19+
Regular expression (POSIX basic regular expression) of tests to skip.
20+
It is suggested to test the regex to make sure that it matches with the available tests.
21+
Tests can be listed by using 'openshift-tests run --dry-run (...)'. Sometimes, the tests
22+
that are printed in Prow won't exactly match the list returned by openshift-tests.
23+
- name: CONFIG_TYPE
24+
default: ''
25+
documentation: |
26+
The type of config for the environment to deploy.
27+
28+
* 'dualstack' - Configure the install-config to enable dualstack clusters.
29+
* 'singlestackv6' - Configure the install-config to enable single-stack v6 clusters.
30+
documentation: |-
31+
Runs the OpenShift OpenStack-specific tests using the OTE (OpenShift Tests Extension)
32+
framework. Tests are discovered and run through openshift-tests which loads the
33+
openstack-test extension from the release payload.

0 commit comments

Comments
 (0)