triage/summarize: fix duplicate failures when multiple test files passed to loadTests#37133
triage/summarize: fix duplicate failures when multiple test files passed to loadTests#37133immanuwell wants to merge 1 commit into
Conversation
…ilures Signed-off-by: Immanuel Tikhonov <pchpr.00@list.ru>
|
Welcome @immanuwell! |
|
Hi @immanuwell. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: immanuwell The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
loadTestsintriage/summarize/files.gotakes a slice of test file paths (fromflag.Args()), butjsonFailureswas declared outside the loop and never reset between files.The conversion loop then iterated over all accumulated failures, not just the current file's - so failures from file N get inserted once for every remaining file.
With 2 files you get file 1 duplicated, with 3 files tripled, etc.
Also
defer file.Close()inside the loop deferred until function return, keeping all files open simultaneously.Fix: move
jsonFailuresdeclaration inside the loop (fresh slice per file) and replace deferred close with explicitfile.Close()calls.Reproduce: run triage with two test files where file1 has failures. Entries from file1 appear twice in the output clustered results.