Skip to content

Commit 709739b

Browse files
authored
Merge pull request #19321 from liggitt/quota-flake
Fix flake in cluster resource quota test
2 parents 35f2751 + 0ba9d95 commit 709739b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/cmd/quota.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ os::test::junit::declare_suite_start "cmd/quota"
1313

1414
os::test::junit::declare_suite_start "cmd/quota/clusterquota"
1515

16+
# This tests creating a clusterresourcequota against an existing namespace with a known number of resources
1617
os::cmd::expect_success 'oc new-project quota-foo --as=deads --as-group=system:authenticated --as-group=system:authenticated:oauth'
1718
os::cmd::expect_success 'oc label namespace/quota-foo owner=deads'
19+
os::cmd::try_until_text 'oc get secrets -o name -n quota-foo | wc -l' '9'
1820
os::cmd::expect_success 'oc create clusterquota for-deads --project-label-selector=owner=deads --hard=secrets=10'
1921
os::cmd::try_until_text 'oc get appliedclusterresourcequota -n quota-foo --as deads -o name' "for-deads"
20-
os::cmd::try_until_text 'oc get secrets -o name --all-namespaces; oc describe appliedclusterresourcequota/for-deads -n quota-foo --as deads' "secrets.*9"
22+
os::cmd::try_until_text 'oc get secrets --all-namespaces; oc get appliedclusterresourcequota/for-deads -n quota-foo --as deads -o jsonpath=used={.status.total.used.secrets}' "used=9"
2123

2224
os::cmd::expect_failure_and_text 'oc create clusterquota for-deads-malformed --project-annotation-selector="openshift.#$%/requester=deads"' "prefix part a DNS-1123 subdomain must consist of lower case alphanumeric characters"
2325
os::cmd::expect_failure_and_text 'oc create clusterquota for-deads-malformed --project-annotation-selector=openshift.io/requester=deads,openshift.io/novalue' "Malformed annotation selector"
@@ -33,7 +35,7 @@ os::cmd::try_until_text 'oc get appliedclusterresourcequota -n quota-asmail --as
3335
# the create_dockercfg controller can issue multiple creates if the token controller doesn't fill them in, but the creates are duplicates
3436
# since an annotation tracks the intended secrets to be created. That results in multi-counting quota until reconciliation runs
3537
# do not go past 26. If you get to 27, you might be selecting an extra namespace.
36-
os::cmd::try_until_text 'oc get secrets -o name --all-namespaces; oc describe appliedclusterresourcequota/for-deads-by-annotation -n quota-bar --as deads' "secrets.*(1[0-9]|20|21|22|23|24|25|26)"
38+
os::cmd::try_until_text 'oc get secrets --all-namespaces; oc get appliedclusterresourcequota/for-deads-by-annotation -n quota-bar --as deads -o jsonpath=used={.status.total.used.secrets}' "used=(1[0-9]|20|21|22|23|24|25|26)"
3739
os::cmd::expect_success 'oc delete project quota-foo'
3840
os::cmd::try_until_not_text 'oc get clusterresourcequota/for-deads-by-annotation -o jsonpath="{.status.namespaces[*].namespace}"' 'quota-foo'
3941
os::cmd::expect_success 'oc delete project quota-bar'

0 commit comments

Comments
 (0)