e2e: remove JSON progress output on stdout

The original intention was to address "frustration of end users running the e2e
suite is that they take a significant amount of time and it is difficult to
gauge progress".

But Ginkgo's output is different now than it was in Kubernetes 1.19. If users
want to see progress, then "ginkgo --progress" might provide enough
information.

Printing to os.Stdout doesn't work as intended anyway when output redirection
is enabled (the default for parallel runs) and causes these JSON snippets to
appear as "show stdout" for each failed test in a Prow job, which is
distracting.
This commit is contained in:
Patrick Ohly 2022-10-19 17:01:40 +02:00
parent f14ebac384
commit 3e560e8341

View File

@ -62,19 +62,19 @@ func NewProgressReporter(progressReportURL string) *ProgressReporter {
return rep
}
// SendUpdates serializes the current progress and prints it to stdout and also posts it to the configured endpoint if set.
// SendUpdates serializes the current progress and posts it to the configured endpoint if set.
// It does not print to stdout because that interferes with progress reporting by Ginko
// and (when Ginkgo does output redirection) doesn't actually appear on the screen anyway.
func (reporter *ProgressReporter) SendUpdates() {
b := reporter.serialize()
fmt.Println(string(b))
go reporter.postProgressToURL(b)
}
func (reporter *ProgressReporter) postProgressToURL(b []byte) {
// If a progressURL and client is set/available then POST to it. Noop otherwise.
if reporter.client == nil || len(reporter.progressURL) == 0 {
return
}
b := reporter.serialize()
go reporter.postProgressToURL(b)
}
func (reporter *ProgressReporter) postProgressToURL(b []byte) {
resp, err := reporter.client.Post(reporter.progressURL, "application/json", bytes.NewReader(b))
if err != nil {
klog.Errorf("Failed to post progress update to %v: %v", reporter.progressURL, err)