Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade test status set to skip if errors found #3180

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
30 changes: 19 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,12 @@ 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 events propagated, but %d errors occured. "+
"Listing them below.", events, len(errors))
}

prober.ReportErrors(t, errors)

prober.remove()
}

Expand All @@ -114,11 +114,19 @@ 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)
}
}
if len(errors) > 0 && !p.config.FailOnMissingEvents {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to have a different config option for FailOnErrors? Right now it has double meaning and without reading the code it's hard to know that setting that flag results on this behaviour?
Maybe it would be better to either have:

  • FailOnErrors and FailOnMissingEvents config options
  • rename FailOnMissingEvents to FailOnErrors?

I think it's fine to get this in to make progress, just some thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've missed that. I've should have renamed that to FailOnErrors

t.Skipf(
"Found %d errors, but FailOnMissingEvents is false. Skipping test.",
len(errors),
)
}
}

Expand Down