Skip to content

Commit

Permalink
cli: fix TestUnavailableZip failed
Browse files Browse the repository at this point in the history
This patch fixes issue introduced in da0e542
where code (that handles unparsed entries due to errors) was added in "if error" block
instead of below it. It was wrong because in case of timeout error, `entries` variable
is always nil.
Now logic that handles partially failed entries parsing moved outside and
invoked only if no timeout error happens.

Release note: None
  • Loading branch information
koorosh committed Feb 4, 2024
1 parent 15961a1 commit eaea30e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/cli/zip_per_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,19 @@ func (zc *debugZipContext) collectPerNodeData(
if err := zc.z.createError(sf, name, requestErr); err != nil {
return err
}
// Log out the list of errors that occurred during log entries request.
if len(entries.ParseErrors) > 0 {
sf.shout("%d parsing errors occurred:", len(entries.ParseErrors))
for _, err := range entries.ParseErrors {
sf.shout("%s", err)
}
parseErr := fmt.Errorf("%d errors occurred:\n%s", len(entries.ParseErrors), strings.Join(entries.ParseErrors, "\n"))
if err := zc.z.createError(sf, name, parseErr); err != nil {
return err
}
}
continue
}
// Log the list of errors that occurred during log entries request.
if len(entries.ParseErrors) > 0 {
sf.shout("%d parsing errors occurred:", len(entries.ParseErrors))
for _, err := range entries.ParseErrors {
sf.shout("%s", err)
}
parseErr := fmt.Errorf("%d errors occurred:\n%s", len(entries.ParseErrors), strings.Join(entries.ParseErrors, "\n"))
if err := zc.z.createError(sf, name, parseErr); err != nil {
return err
}
}
sf.progress("writing output: %s", name)
warnRedactLeak := false
if err := func() error {
Expand Down

0 comments on commit eaea30e

Please sign in to comment.