From def05a20e22f069a60f4190755e8c7244d18781c Mon Sep 17 00:00:00 2001 From: Alexander Zielenski Date: Thu, 15 Feb 2024 13:58:29 -0800 Subject: [PATCH] flake: avoid flake by ensuring params appear in the initial list sometimes they would not appear in the initial list if they were added while the informer was starting up due to ObjectTracker race --- .../pkg/admission/plugin/policy/validating/admission_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/policy/validating/admission_test.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/policy/validating/admission_test.go index cc8ee5ccbe4..21fb787bb3f 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/policy/validating/admission_test.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/policy/validating/admission_test.go @@ -1646,14 +1646,14 @@ func testParamRefCase(t *testing.T, paramIsClusterScoped, nameIsSet, namespaceIs newClusterScopedParam(matchingParamName+"5", otherNonmatchingLabels), } - require.NoError(t, testContext.UpdateAndWait(&policy, &binding)) - for _, p := range params { // Don't wait for these sync the informers would not have been // created unless bound to a policy require.NoError(t, testContext.Update(p)) } + require.NoError(t, testContext.UpdateAndWait(&policy, &binding)) + namespacedRequestObject := newParam("some param", nonMatchingNamespace, nil) clusterScopedRequestObject := newClusterScopedParam("other param", nil)