Skip to content

Commit

Permalink
Upgrade test status set to skip if errors found
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed May 20, 2020
1 parent bdb9bb6 commit 41b2242
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/upgrade/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
readyMessage = "prober ready"
)

func TestProbe(t *testing.T) {
func TestContinuousEventsPropagationWithProber(t *testing.T) {
// We run the prober as a golang test because it fits in nicely with
// the rest of our integration tests, and AssertProberDefault needs
// a *testing.T. Unfortunately, "go test" intercepts signals, so we
Expand Down
33 changes: 22 additions & 11 deletions test/upgrade/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type Prober interface {
// Finish send finished event
Finish()

// ReportError will reports found errors in proper way
ReportError(t *testing.T, err error)
// ReportErrors will reports found errors in proper way
ReportErrors(t *testing.T, errors []error)

// deploy a prober to a cluster
deploy()
Expand Down Expand Up @@ -92,12 +92,14 @@ func AssertEventProber(t *testing.T, prober Prober) {
if len(errors) == 0 {
t.Logf("All %d events propagated well", events)
} else {
t.Logf("There ware %v errors. Listing them below.", len(errors))
}
for _, err := range errors {
prober.ReportError(t, err)
t.Logf(
"There were %d errors, %d events propageted. Listing them below.",
len(errors), events,
)
}

prober.ReportErrors(t, errors)

prober.remove()
}

Expand All @@ -114,11 +116,20 @@ func (p *prober) servingClient() resources.ServingClient {
}
}

func (p *prober) ReportError(t *testing.T, err error) {
if p.config.FailOnMissingEvents {
t.Error(err)
} else {
p.log.Warnf("Silenced FAIL: %v", err)
func (p *prober) ReportErrors(t *testing.T, errors []error) {
for _, err := range errors {
if p.config.FailOnMissingEvents {
t.Error(err)
} else {
p.log.Warnf("Silenced FAIL: %v", err)
}
}
errsNum := len(errors)
if errsNum > 0 && !p.config.FailOnMissingEvents {
t.Skipf(
"Found %d errors, but FailOnMissingEvents == false. Skipping test.",
errsNum,
)
}
}

Expand Down

0 comments on commit 41b2242

Please sign in to comment.