Skip to content

Commit 4da774f

Browse files
authored
Fix flaky unit tests (#2904)
* Fix flaky TestResolver unit test Signed-off-by: Christoph Blecker <[email protected]> * Fix flaky TestUpdates unit test Signed-off-by: Christoph Blecker <[email protected]> Signed-off-by: Christoph Blecker <[email protected]>
1 parent afbb609 commit 4da774f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/controller/operators/olm/operator_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3923,9 +3923,10 @@ func TestUpdates(t *testing.T) {
39233923
simulateSuccessfulRollout(current, op.opClient)
39243924
}
39253925
for current.Status.Phase != e.whenIn.phase {
3926-
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
39273926
csvsToSync = syncCSVs(csvsToSync, deletedCSVs(e.shouldBe))
39283927
current = csvsToSync[e.whenIn.name]
3928+
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
3929+
time.Sleep(1 * time.Millisecond)
39293930
}
39303931

39313932
// sync the other csvs until they're in the expected status

pkg/controller/registry/resolver/step_resolver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ func TestResolver(t *testing.T) {
11821182
steps: [][]*v1alpha1.Step{},
11831183
subs: []*v1alpha1.Subscription{},
11841184
errAssert: func(t *testing.T, err error) {
1185-
assert.Contains(t, err.Error(), "failed to populate resolver cache from source @existing/catsrc-namespace: csv catsrc-namespace/a.v1")
1185+
assert.Contains(t, err.Error(), "failed to populate resolver cache from source @existing/catsrc-namespace: csv")
11861186
assert.Contains(t, err.Error(), "in phase Failed instead of Replacing")
11871187
},
11881188
},

0 commit comments

Comments
 (0)