Skip to content

Commit

Permalink
Merge pull request #16924 from bparees/fix_extended
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

check for pending, not running, state in next build start tests
  • Loading branch information
openshift-merge-robot authored Oct 20, 2017
2 parents 747a173 + e3f96da commit 7dac14f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/extended/builds/run_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
exutil "github.com/openshift/origin/test/extended/util"
)

// this test is very latency sensitive so run it by itself (serially).
var _ = g.Describe("[Feature:Builds][Slow][Serial] using build configuration runPolicy", func() {
var _ = g.Describe("[Feature:Builds][Slow] using build configuration runPolicy", func() {
defer g.GinkgoRecover()
var (
// Use invalid source here as we don't care about the result
Expand Down Expand Up @@ -152,7 +151,7 @@ var _ = g.Describe("[Feature:Builds][Slow][Serial] using build configuration run
o.Expect(build.Status.CompletionTimestamp).ToNot(o.BeNil(), "completed builds should have a valid completion time")
sawCompletion = true
}
if build.Status.Phase == buildapi.BuildPhaseRunning {
if build.Status.Phase == buildapi.BuildPhaseRunning || build.Status.Phase == buildapi.BuildPhasePending {
latency := lastCompletion.Sub(time.Now())
o.Expect(latency).To(o.BeNumerically("<", 20*time.Second), "next build should have started less than 20s after last completed build")

Expand Down Expand Up @@ -256,6 +255,17 @@ var _ = g.Describe("[Feature:Builds][Slow][Serial] using build configuration run
select {
case event := <-buildWatch.ResultChan():
build := event.Object.(*buildapi.Build)
if build.Status.Phase == buildapi.BuildPhasePending {
if build.Name == "sample-serial-build-fail-2" {
duration := time.Now().Sub(failTime)
o.Expect(duration).To(o.BeNumerically("<", 20*time.Second), "next build should have started less than 20s after failed build")
}
if build.Name == "sample-serial-build-fail-3" {
duration := time.Now().Sub(failTime2)
o.Expect(duration).To(o.BeNumerically("<", 20*time.Second), "next build should have started less than 20s after failed build")
}
}

if build.Status.Phase == buildapi.BuildPhaseFailed {
if build.Name == "sample-serial-build-fail-1" {
// this may not be set on the first build modified to failed event because
Expand Down Expand Up @@ -301,7 +311,6 @@ var _ = g.Describe("[Feature:Builds][Slow][Serial] using build configuration run
o.Expect(timestamps1).To(o.BeTrue(), "failed builds should have start and completion timestamps set")
o.Expect(timestamps2).To(o.BeTrue(), "failed builds should have start and completion timestamps set")
o.Expect(timestamps3).To(o.BeTrue(), "failed builds should have start and completion timestamps set")

})
})

Expand Down Expand Up @@ -362,7 +371,7 @@ var _ = g.Describe("[Feature:Builds][Slow][Serial] using build configuration run
}
}
// Only first and third build should actually run (serially).
if build.Status.Phase == buildapi.BuildPhaseRunning {
if build.Status.Phase == buildapi.BuildPhaseRunning || build.Status.Phase == buildapi.BuildPhasePending {
// Ignore events from complete builds (if there are any) if we already
// verified the build.
if _, exists := buildVerified[build.Name]; exists {
Expand Down

0 comments on commit 7dac14f

Please sign in to comment.