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

Results aggregation should consider the errors directory #936

Merged
merged 1 commit into from
Oct 3, 2019
Merged

Results aggregation should consider the errors directory #936

merged 1 commit into from
Oct 3, 2019

Conversation

johnSchnake
Copy link
Contributor

What this PR does / why we need it:
Whenever the aggregator itself deems that a plugin has failed,
(e.g. pods didnt start, timeouts, etc) then it writes its results
into an errors directory. This should be considered when doing
results aggregation so that they can be resulted as failures.

Otherwise, the plugin is just reported as having 0 results and
having an unknown status even though Sonobuoy may have been the one
to mark it as failure internally.

Which issue(s) this PR fixes
Related to #883
Fixes #897

Special notes for your reviewer:

Release note:

When inspecting plugin results (for reporting via `sonobuoy status` and `sonobuoy results`) errors saved in the `<plugin>/errors` directory which are reported by Sonobuoy itself are now considered. This should help make certain failure modes such as timeout more clear.

@johnSchnake johnSchnake requested a review from zubron October 3, 2019 18:57
// which should have the nodes as subdirectories. It returns an item for each node processed and an error
// only if it couldn't open the original directory. Any errors while processing a specific node are logged
// but not returned.
func processNodesWithProcessor(p plugin.Interface, baseDir, dir string, processor postProcessor, selector fileSelector) ([]Item, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is just code moved code, not new code. Extracted from the processPluginWithProcessor method.

if err != nil {
return Item{}, err
logrus.Warningf("Error processing results entries for plugin %v: %v", p.GetName(), err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: rather than log here, I want to return a slice of errors and just return them all and log at the parent if we want. Awkward to have lower level methods not pass up their errors.

I really just wanted to continue processing after errors so on my first pass I added logging rather than returning.

@codecov-io
Copy link

codecov-io commented Oct 3, 2019

Codecov Report

Merging #936 into master will increase coverage by 0.15%.
The diff coverage is 60.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #936      +/-   ##
==========================================
+ Coverage   47.72%   47.87%   +0.15%     
==========================================
  Files          76       76              
  Lines        5184     5226      +42     
==========================================
+ Hits         2474     2502      +28     
- Misses       2562     2570       +8     
- Partials      148      154       +6
Impacted Files Coverage Δ
pkg/client/results/reader.go 55.9% <ø> (ø) ⬆️
pkg/discovery/discovery.go 7.65% <0%> (+0.03%) ⬆️
pkg/client/results/processing.go 77.86% <67.69%> (-6.23%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69cc7ff...626709a. Read the comment docs.

Whenever the aggregator itself deems that a plugin has failed,
(e.g. pods didnt start, timeouts, etc) then it writes its results
into an errors directory. This should be considered when doing
results aggregation so that they can be resulted as failures.

Otherwise, the plugin is just reported as having 0 results and
having an unknown status even though Sonobuoy may have been the one
to mark it as failure internally.

Related to #883
Fixes #897

Signed-off-by: John Schnake <[email protected]>
@johnSchnake
Copy link
Contributor Author

Green tests, reasonable coverage. Going to just merge and move forward. Can fixup if desired but this is a blocker for the #883 which is a slightly larger change and I want ready for review soon.

@johnSchnake johnSchnake merged commit 2686723 into vmware-tanzu:master Oct 3, 2019
@johnSchnake johnSchnake deleted the aggregateErrorsDirToo branch October 3, 2019 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Result aggregation doesn't take into account the /errors directory
2 participants