Provisioning: Improve flakey test (#103498)

improve flakey test
pull/103496/head^2
Ryan McKinley 1 month ago committed by GitHub
parent 8eea0c9a3d
commit b329b78ef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      pkg/tests/apis/provisioning/helper_test.go

@ -129,14 +129,15 @@ func (h *provisioningTestHelper) AwaitJobs(t *testing.T, repoName string) {
list, err := h.Jobs.Resource.List(context.Background(), metav1.ListOptions{})
if assert.NoError(collect, err, "failed to list active jobs") {
for _, elem := range list.Items {
// TODO: Use the spec field of the job.
if elem.GetLabels()["repository"] == repoName {
repo, _, err := unstructured.NestedString(elem.Object, "spec", "repository")
require.NoError(t, err)
if repo == repoName {
collect.Errorf("there are still remaining jobs for %s: %+v", repoName, elem)
return
}
}
}
}, time.Second*5, time.Millisecond*20)
}, time.Second*10, time.Millisecond*25, "job queue must be empty")
// Then, as all jobs are now historic jobs, we make sure they are successful.
result, err := h.Repositories.Resource.Get(context.Background(), repoName, metav1.GetOptions{}, "jobs")

Loading…
Cancel
Save