Skip to content

Commit

Permalink
Fix flaky unit tests (#2904)
Browse files Browse the repository at this point in the history
* Fix flaky TestResolver unit test

Signed-off-by: Christoph Blecker <cblecker@redhat.com>

* Fix flaky TestUpdates unit test

Signed-off-by: Christoph Blecker <cblecker@redhat.com>

Signed-off-by: Christoph Blecker <cblecker@redhat.com>
  • Loading branch information
cblecker committed Dec 6, 2022
1 parent afbb609 commit 4da774f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/controller/operators/olm/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3923,9 +3923,10 @@ func TestUpdates(t *testing.T) {
simulateSuccessfulRollout(current, op.opClient)
}
for current.Status.Phase != e.whenIn.phase {
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
csvsToSync = syncCSVs(csvsToSync, deletedCSVs(e.shouldBe))
current = csvsToSync[e.whenIn.name]
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
time.Sleep(1 * time.Millisecond)
}

// sync the other csvs until they're in the expected status
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/registry/resolver/step_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ func TestResolver(t *testing.T) {
steps: [][]*v1alpha1.Step{},
subs: []*v1alpha1.Subscription{},
errAssert: func(t *testing.T, err error) {
assert.Contains(t, err.Error(), "failed to populate resolver cache from source @existing/catsrc-namespace: csv catsrc-namespace/a.v1")
assert.Contains(t, err.Error(), "failed to populate resolver cache from source @existing/catsrc-namespace: csv")
assert.Contains(t, err.Error(), "in phase Failed instead of Replacing")
},
},
Expand Down

0 comments on commit 4da774f

Please sign in to comment.