Repository navigation
Conversation
…eport Signed-off-by: Sergey Morozov <sergey.morozov@flant.com>
ergoz
force-pushed
the
feat/report-operation-name-and-output
branch
from
October 23, 2026 12:44
dde9ad5 to
e6f00e3
Compare
Author
|
Is there any chance to get review for this PR? :) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This PR adds two things to the test report. This is an addition. Existing tests and existing report files stay valid.
namefield. The report uses thenameof an operation as its name. When an operation has noname, the report uses itsdescription. When an operation has neither, the report usesoperation <number>, as before. Before this PR, each operation in the report had the nameoperation <number>. Thus, a JUnit report with theJUNIT-OPERATIONformat showedmy-step / operation 1, and the reader did not know which check failed.system-outelement. Thus, a tool that reads JUnit reports had no log of the operation. For example, Allure showed an empty test body, and the unit test report of GitLab CI got nosystem-outof the test case. GitLab CI reads thesystem-outelement of a test case (see Unit test reports).Related issue
There is no issue for this change.
Proposed Changes
OperationBasegets the optional fieldname. A step already has anamefor the report and adescriptionfor the reader. With this PR, an operation has the same two fields.runOperationgives the name of the operation torunAction: thename, else thedescription.runActionwrites it to the operation report. When an operation has more than one resource, the name ends with the number of the resource, for exampleapply-resources (2/3).logging.WithRecorderwrites each log entry to a writer as plain text without colors. It also sends the entry to the logger that was in the context before. Thus, the console output does not change.runActionand the cleaner record the log of each operation that goes to the report. The new fieldOperationReport.Outputkeeps this log.JUNIT-OPERATIONformat, the log of an operation goes to thesystem-outelement of its test case.JUNIT-STEPformat, the logs of all operations of a step go to thesystem-outelement of the step test case.JSONformat, the log of an operation goes to the newoutputfield.make codegenupdated the CRDs, the JSON schemas and the API reference for the new field.Example. The step below:
Before this PR,
JUNIT-OPERATION:After this PR:
Proof: a real run of a e2e test with the changed Chainsaw. The test has a
nameon each operation. The JUnit report has 91 test cases, and each of them has asystem-outelement. Part of the report (the namespace name is replaced):Checklist
This is not a bug fix. The PR adds unit tests for the new behavior:
pkg/logging/recorder_test.go: the recorder writes the entry without colors and sends it to the next logger. It also works when the context has no logger.pkg/runner/operation_report_test.go: the report name of an operation is thename, else thedescription, elseoperation <number>, with the resource number when there is more than one resource.runOperationtakes the name from the operation of the test. The operation report keeps the log of the operation.pkg/cleanup/cleaner/cleaner_test.go: the operation report of a cleanup delete keeps the log of the delete.pkg/report/output_test.go: theJUNIT-OPERATION,JUNIT-STEPandJSONreports contain the names and the output. An operation without output has nosystem-outelement and nooutputfield.Further Comments
The operations of
catch,finallyandcleanupdo not go to the report. This PR does not change that. They userunCatch, which gives no step report torunAction. It is possible to add them to the report in a different PR. For the same reason, the operations ofcatchandfinallydo not get thenamefield: they use the typeCatchFinally, and their names do not go to a report.The log in the report has no time stamps. The console output has them, and the report has the start time and the end time of each operation.
make codegeninstallsgenref@latest. The current version ofgenrefalso changes parts ofwebsite/docs/reference/apis/that this PR does not touch, for example theClusters,CompilerandDefaultTimeoutssections ofv1alpha2. The same change occurs whenmake codegen-api-docsruns onmain. This PR keeps these generated changes, becausemake verify-codegenfails without them.