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
This commit is contained in:
Alexander Zielenski 2024-02-15 13:58:29 -08:00
parent ad6477e342
commit def05a20e2

View File

@ -1646,14 +1646,14 @@ func testParamRefCase(t *testing.T, paramIsClusterScoped, nameIsSet, namespaceIs
newClusterScopedParam(matchingParamName+"5", otherNonmatchingLabels), newClusterScopedParam(matchingParamName+"5", otherNonmatchingLabels),
} }
require.NoError(t, testContext.UpdateAndWait(&policy, &binding))
for _, p := range params { for _, p := range params {
// Don't wait for these sync the informers would not have been // Don't wait for these sync the informers would not have been
// created unless bound to a policy // created unless bound to a policy
require.NoError(t, testContext.Update(p)) require.NoError(t, testContext.Update(p))
} }
require.NoError(t, testContext.UpdateAndWait(&policy, &binding))
namespacedRequestObject := newParam("some param", nonMatchingNamespace, nil) namespacedRequestObject := newParam("some param", nonMatchingNamespace, nil)
clusterScopedRequestObject := newClusterScopedParam("other param", nil) clusterScopedRequestObject := newClusterScopedParam("other param", nil)