ROX-11909: save kuttl JUnit XML to artifacts#2562
Conversation
|
Images are ready for the commit at 324572c. To use with deploy scripts, first |
|
/retest |
9a5f410 to
e732b8f
Compare
|
/retest |
.openshift-ci/ci_tests.py
Outdated
| ) | ||
|
|
||
| print("Storing test-e2e-deployed results in JUnit format") | ||
| self.run_with_graceful_kill( |
There was a problem hiding this comment.
Would be nice to refactor this print+run into a couple of methods:
- one in
OperatorE2eTestwhich contains pieces specific to kuttl artifacts, or perhaps specific to operator tests; it would delegate to: - another generic method in
BaseTestthat callsstore-artifacts.shand would potentially be useful to other subclasses.
| @@ -66,7 +67,15 @@ def run(self): | |||
| print("Executing operator upgrade test") | |||
| self.run_with_graceful_kill( | |||
There was a problem hiding this comment.
If a test fails I would expect this to raise an error and the junit logs would not be gathered. What about using the post_start_hook=set_dirs_after_start convention used elsewhere in this file? Or just set test_output_dirs in a OperatorE2eTest __init__()?
There was a problem hiding this comment.
Hm, good point, this will only gather logs when we don't need them, :-)
Another way would be to change this artifact gathering into a context manager, or something?
There was a problem hiding this comment.
@gavin-stackrox do you suggest creating new post_test like StoreTestResults? Because StoreArtifacts doesn't add them to JUnit panel
There was a problem hiding this comment.
@ivan-degtiarenko actually, now that I think about it a bit more, maybe a better approach for the operator e2e tests is something similar to what is done with UIE2eTest. i.e. it is just a wrapper around tests/e2e/run-ui-e2e.sh which can then do all the error handling and JUnit artifact saving via store_test_results().
e732b8f to
0d153c6
Compare
.openshift-ci/post_tests.py
Outdated
| print("Storing operator test results in JUnit format") | ||
| self.run_with_best_effort( | ||
| ["scripts/ci/store-artifacts.sh", "store_test_results", | ||
| "operator/build/kuttl-test-artifacts"], |
There was a problem hiding this comment.
I think based on @porridge changes there will be different dirs now for different tests. i.e. not all are "operator/build/kuttl-test-artifacts"
what about adding an array of junit test output passed to PostClusterTest() then this change is not so operator specific.
|
/retest |
1 similar comment
|
/retest |
|
/test openshift-newest-operator-e2e-tests |
porridge
left a comment
There was a problem hiding this comment.
LGTM overall, except it seems like this might better fit in the parent class...
.openshift-ci/ci_tests.py
Outdated
| "operator/build/kuttl-test-artifacts-upgrade", | ||
| ] | ||
| self.test_results = { | ||
| "operator/build/kuttl-test-artifacts": "kuttl-test-artifacts", |
There was a problem hiding this comment.
I think it might be better to have the dict the other way, since we primarily want to make sure the destination name is unique..
.openshift-ci/post_tests.py
Outdated
| collect_central_artifacts=True, | ||
| check_stackrox_logs=False, | ||
| artifact_destination_prefix=None, | ||
| add_test_result=True, |
There was a problem hiding this comment.
I think keeping this in plural to match the test_results argument name would be better for consistency.
| self.data_to_store = [] | ||
|
|
||
| def run(self, test_outputs=None): | ||
| def run(self, test_outputs=None, test_results=None): |
There was a problem hiding this comment.
This may be a bit confusing, since it does process test_outputs but not test_results. I can think of two ways:
- barf if
test_results is not None(better fail loud than silent), or - move the functionality to this class
.openshift-ci/post_tests.py
Outdated
| ) | ||
|
|
||
| def add_test_result(self, test_results): | ||
| print("Storing operator test results in JUnit format") |
There was a problem hiding this comment.
This is in general not operator specific.
| print("Storing operator test results in JUnit format") | |
| print("Storing test results in JUnit format") |
.openshift-ci/post_tests.py
Outdated
| for fromDir, toDir in test_results: | ||
| self.run_with_best_effort( | ||
| ["scripts/ci/store-artifacts.sh", "store_test_results", | ||
| fromDir, toDir], |
There was a problem hiding this comment.
The rest of this file seems to avoid camelCase.
| for fromDir, toDir in test_results: | |
| self.run_with_best_effort( | |
| ["scripts/ci/store-artifacts.sh", "store_test_results", | |
| fromDir, toDir], | |
| for from_dir, to_dir in test_results: | |
| self.run_with_best_effort( | |
| ["scripts/ci/store-artifacts.sh", "store_test_results", | |
| from_dir, to_dir], |
| self.central_is_responsive = False | ||
|
|
||
| def run(self, test_outputs=None): | ||
| def run(self, test_outputs=None, test_results=None): |
There was a problem hiding this comment.
Same comment as with the StoreArtifacts implementation.
| self._handle_e2e_progress_failures = handle_e2e_progress_failures | ||
|
|
||
| def run(self, test_outputs=None): | ||
| def run(self, test_outputs=None, test_results=None): |
|
And let's see whether this actually works in the operator jobs :-) |
|
Unfortunately: |
|
@ivan-degtiarenko: The following test failed, say
Full PR test history. Your PR dashboard. 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/test-infra repository. I understand the commands that are listed here. |
|
/test openshift-newest-operator-e2e-tests |
porridge
left a comment
There was a problem hiding this comment.
NICE!
Just a couple of nitpicks.
.openshift-ci/post_tests.py
Outdated
| self.handle_run_failure() | ||
|
|
||
| def add_test_results(self, test_results): | ||
| if test_results is None: |
There was a problem hiding this comment.
It's generally considered more pythonic to say:
| if test_results is None: | |
| if not test_results: |
This catches the empty list case too (and I guess it makes sense because we don't want to log the following line if we actually have nothing to store).
.openshift-ci/post_tests.py
Outdated
| self.add_test_results(test_results) | ||
| self.store_artifacts(test_outputs) |
There was a problem hiding this comment.
To keep the order consistent with StoreArtifacts.run:
| self.add_test_results(test_results) | |
| self.store_artifacts(test_outputs) | |
| self.store_artifacts(test_outputs) | |
| self.add_test_results(test_results) |
gavin-stackrox
left a comment
There was a problem hiding this comment.
LGTM!
I'd prefer to avoid the reformatting but I left the door open for that by not adding the formatter to CI: https://github.com/stackrox/stackrox/blob/master/.openshift-ci/README.md#workflow-aliases-for-testformatlint
It would be nice to have an example of a failed kuttl test result in the PR description as proof of work.
|
/test openshift-newest-operator-e2e-tests |
Let's see how #3362 goes |
|
Hm, these actually seem to have failed for some unrelated reason 🤔 Could this be a symptom of a necessary rebase @ivan-degtiarenko ? Or perhaps this message is a red herring.. let me try rerunning... |
|
@porridge thanks for testing 👍 Merging the PR |
Update SCANNER_VERSION and COLLECTOR_VERSION to reference images from their respective UBI9 migration PRs: - Scanner: 2.38.x-166-g16d772deeb (PR #2562) - includes arm64 build fix - Collector: 3.23.x-132-g98b7877e58 (PR #2815) This enables e2e tests to verify all three components work correctly together with UBI9. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
In UBI9, update-ca-trust requires the -o flag to specify the output directory when running as a non-root user. This matches the workaround applied in the scanner repo (PR #2562). See: https://bugzilla.redhat.com/show_bug.cgi?id=2241240 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Description
Prow can display tests that fail in its JUnit panel. e.g. https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/branch-ci-stackrox-stackrox-master-merge-go-unit-tests/1550162970292523008
For Prow to display tests that fail in its JUnit panel it needs files in JUnit XML format copied to $ARTIFACT_DIR. This PR does that for
openshift-4-operator-e2e-tests, which are run viakuttl.Checklist
- [ ] Unit test and regression tests added- [ ] Determined and documented upgrade steps- [ ] Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)If any of these don't apply, please comment below.
Testing Performed
ci/prow/openshift-4-operator-e2e-tests