Skip to content

Commit

Permalink
Merge pull request #449 from SaschaSchwarze0/sascha-e2e-eventually-ea…
Browse files Browse the repository at this point in the history
…rly-exit

Early exit Eventually block if target condition cannot be reached any more
  • Loading branch information
openshift-merge-robot authored Oct 21, 2020
2 parents 50419d7 + cec694b commit 1775c91
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/e2e/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func validateBuildRunToSucceed(
f := framework.Global

trueCondition := corev1.ConditionTrue
falseCondition := corev1.ConditionFalse

// Ensure the BuildRun has been created
err := f.Client.Create(goctx.TODO(), testBuildRun, cleanupOptions(ctx, timeout, retry))
Expand All @@ -195,6 +196,8 @@ func validateBuildRunToSucceed(
err = clientGet(buildRunNsName, testBuildRun)
Expect(err).ToNot(HaveOccurred(), "Error retrieving a buildRun")

Expect(testBuildRun.Status.Succeeded).ToNot(Equal(falseCondition))

return testBuildRun.Status.Succeeded
}, time.Duration(1100*getTimeoutMultiplier())*time.Second, 5*time.Second).Should(Equal(trueCondition), "BuildRun did not succeed")

Expand All @@ -215,6 +218,8 @@ func validateBuildRunToFail(
retry time.Duration,
) {
f := framework.Global

trueCondition := corev1.ConditionTrue
falseCondition := corev1.ConditionFalse

// Create the BuildRun
Expand All @@ -227,6 +232,8 @@ func validateBuildRunToFail(
err = clientGet(buildRunNsName, testBuildRun)
Expect(err).ToNot(HaveOccurred(), "Error retrieving build run")

Expect(testBuildRun.Status.Succeeded).ToNot(Equal(trueCondition))

return testBuildRun.Status.Succeeded
}, time.Duration(550*getTimeoutMultiplier())*time.Second, 5*time.Second).Should(Equal(falseCondition), "BuildRun did not fail")

Expand Down

0 comments on commit 1775c91

Please sign in to comment.