Skip to content

Commit 1d7c183

Browse files
amoralejopenshift-merge-bot[bot]
authored andcommitted
Rename watcher appcred in kuttl test to avoid automatic deletion
In the kuttl tests, we are creating appcred and watcher out of the openstackcontrolplane. The openstack-operator has logic to delete the appcred ac-watcher if watcher is disabled in the openstackcontrolplane. In order to be able to execute the kuttl tests properly, I'm renaming the appcred to ac-watcher-test. Signed-off-by: Alfredo Moralejo <amoralej@redhat.com>
1 parent 2d3f3fd commit 1d7c183

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

test/kuttl/test-suites/default/appcred-tests/02-assert.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ commands:
66
set -euo pipefail
77
NS="${NAMESPACE}"
88
9-
echo "Waiting for KeystoneApplicationCredential ac-watcher to be Ready..."
10-
oc wait -n "${NS}" appcred/ac-watcher --for=condition=Ready --timeout=300s
9+
echo "Waiting for KeystoneApplicationCredential ac-watcher-test to be Ready..."
10+
oc wait -n "${NS}" appcred/ac-watcher-test --for=condition=Ready --timeout=300s
1111
12-
ac_id=$(oc get -n "${NS}" appcred/ac-watcher -o jsonpath='{.status.acID}')
12+
ac_id=$(oc get -n "${NS}" appcred/ac-watcher-test -o jsonpath='{.status.acID}')
1313
if [ -z "${ac_id}" ]; then
1414
echo "ERROR: appcred/ac-watcher.status.acID is empty"
1515
exit 1
1616
fi
1717
echo "ac-watcher.status.acID=${ac_id}"
1818
19-
oc get -n "${NS}" secret/ac-watcher-secret >/dev/null
20-
secret_ac_id=$(oc get -n "${NS}" secret/ac-watcher-secret -o jsonpath='{.data.AC_ID}' | base64 -d)
19+
oc get -n "${NS}" secret/ac-watcher-test-secret >/dev/null
20+
secret_ac_id=$(oc get -n "${NS}" secret/ac-watcher-test-secret -o jsonpath='{.data.AC_ID}' | base64 -d)
2121
if [ "${secret_ac_id}" != "${ac_id}" ]; then
2222
echo "ERROR: Secret AC_ID (${secret_ac_id}) != appcred.status.acID (${ac_id})"
2323
exit 1

test/kuttl/test-suites/default/appcred-tests/02-deploy-appcred.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ commands:
1818
apiVersion: keystone.openstack.org/v1beta1
1919
kind: KeystoneApplicationCredential
2020
metadata:
21-
name: ac-watcher
21+
name: ac-watcher-test
2222
spec:
2323
secret: osp-secret
2424
passwordSelector: WatcherPassword
@@ -29,4 +29,4 @@ commands:
2929
unrestricted: false
3030
EOF
3131
32-
oc patch watcher watcher-kuttl -n "${NS}" --type=merge -p '{"spec":{"auth":{"applicationCredentialSecret":"ac-watcher-secret"}}}'
32+
oc patch watcher watcher-kuttl -n "${NS}" --type=merge -p '{"spec":{"auth":{"applicationCredentialSecret":"ac-watcher-test-secret"}}}'

test/kuttl/test-suites/default/appcred-tests/03-assert.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ commands:
1414
1515
echo "Waiting for ac-watcher.status.acID to change..."
1616
for _ in $(seq 1 60); do
17-
ac_id=$(oc get -n "${NS}" appcred/ac-watcher -o jsonpath='{.status.acID}')
17+
ac_id=$(oc get -n "${NS}" appcred/ac-watcher-test -o jsonpath='{.status.acID}')
1818
if [ -n "${ac_id}" ] && [ "${ac_id}" != "${prev_acid}" ]; then
1919
break
2020
fi
2121
sleep 5
2222
done
23-
ac_id=$(oc get -n "${NS}" appcred/ac-watcher -o jsonpath='{.status.acID}')
23+
ac_id=$(oc get -n "${NS}" appcred/ac-watcher-test -o jsonpath='{.status.acID}')
2424
if [ -z "${ac_id}" ] || [ "${ac_id}" = "${prev_acid}" ]; then
2525
echo "ERROR: ACID did not change after forcing rotation"
2626
echo " prev=${prev_acid}"
@@ -29,7 +29,7 @@ commands:
2929
fi
3030
echo "✓ ACID rotated: ${prev_acid} -> ${ac_id}"
3131
32-
secret_ac_id=$(oc get -n "${NS}" secret/ac-watcher-secret -o jsonpath='{.data.AC_ID}' | base64 -d)
32+
secret_ac_id=$(oc get -n "${NS}" secret/ac-watcher-test-secret -o jsonpath='{.data.AC_ID}' | base64 -d)
3333
if [ "${secret_ac_id}" != "${ac_id}" ]; then
3434
echo "ERROR: Secret AC_ID (${secret_ac_id}) != rotated appcred.status.acID (${ac_id})"
3535
exit 1

test/kuttl/test-suites/default/appcred-tests/03-rotate-appcred.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ commands:
88
old_api_uid=$(oc get pod -n "${NS}" watcher-kuttl-api-0 -o jsonpath='{.metadata.uid}')
99
old_applier_uid=$(oc get pod -n "${NS}" watcher-kuttl-applier-0 -o jsonpath='{.metadata.uid}')
1010
old_de_uid=$(oc get pod -n "${NS}" watcher-kuttl-decision-engine-0 -o jsonpath='{.metadata.uid}')
11-
old_acid=$(oc get -n "${NS}" appcred/ac-watcher -o jsonpath='{.status.acID}')
11+
old_acid=$(oc get -n "${NS}" appcred/ac-watcher-test -o jsonpath='{.status.acID}')
1212
1313
oc create configmap appcred-watcher-rotate-pre \
1414
--from-literal=api_uid="${old_api_uid}" \
@@ -17,5 +17,5 @@ commands:
1717
--from-literal=ac_id="${old_acid}" \
1818
--dry-run=client -o yaml | oc apply -n "${NS}" -f -
1919
20-
oc patch -n "${NS}" keystoneapplicationcredential ac-watcher --type=merge --subresource=status \
20+
oc patch -n "${NS}" keystoneapplicationcredential ac-watcher-test --type=merge --subresource=status \
2121
-p '{"status":{"expiresAt":"2001-05-19T00:00:00Z"}}'

test/kuttl/test-suites/default/appcred-tests/04-cleanup.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ kind: TestStep
33
delete:
44
- apiVersion: keystone.openstack.org/v1beta1
55
kind: KeystoneApplicationCredential
6-
name: ac-watcher
6+
name: ac-watcher-test
77
namespace: watcher-kuttl-default
88
- apiVersion: v1
99
kind: Secret
10-
name: ac-watcher-secret
10+
name: ac-watcher-test-secret
1111
namespace: watcher-kuttl-default
1212
- apiVersion: watcher.openstack.org/v1beta1
1313
kind: Watcher

0 commit comments

Comments
 (0)