Skip to content

Commit

Permalink
Fix apache#921: fix flacky test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro authored and lburgazzoli committed Dec 19, 2019
1 parent d43872f commit 8a71906
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions e2e/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,15 @@ func deletePlatform(ns string) func() bool {
}
}

func setPlatformVersion(ns string, version string) error {
p := platform(ns)()
if p == nil {
return errors.New("no platform found")
func setPlatformVersion(ns string, version string) func()error {
return func() error {
p := platform(ns)()
if p == nil {
return errors.New("no platform found")
}
p.Status.Version = version
return testClient.Status().Update(testContext, p)
}
p.Status.Version = version
return testClient.Status().Update(testContext, p)
}

func platformVersion(ns string) func() string {
Expand Down
2 changes: 1 addition & 1 deletion e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestPlatformUpgrade(t *testing.T) {
Eventually(operatorPod(ns)).Should(BeNil())

// Change the version to an older one
Expect(setPlatformVersion(ns, "an.older.one")).Should(BeNil())
Eventually(setPlatformVersion(ns, "an.older.one")).Should(BeNil())
Eventually(platformVersion(ns)).Should(Equal("an.older.one"))

// Scale the operator up
Expand Down

0 comments on commit 8a71906

Please sign in to comment.