[Bug]: Race condition in report code
bug
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
If the matter is security sensitive, please disclose it privately to a security contact: https://github.com/kudobuilder/kuttl/blob/master/SECURITY_CONTACTS
-->
**What happened**:
On a doc-only update PR the e2e test [failed](https://github.com/kudobuilder/kuttl/actions/runs/12118493894/job/33785270307?pr=583) like this, showing unsorted `testcase` content:
```
--- kuttl-report-test.json.golden 2024-12-02 12:19:29.551188641 +0000
+++ kuttl-report-test.json.normalized 2024-12-02 12:21:34.080524663 +0000
@@ -13,12 +13,6 @@
"testcase": [
{
"classname": "suite1",
- "name": "test0",
- "timestamp": "2000-01-01T00:00:00.00000000+00:00",
- "time": "1.0"
- },
- {
- "classname": "suite1",
"name": "test1",
"timestamp": "2000-01-01T00:00:00.00000000+00:00",
"time": "1.0",
@@ -29,6 +23,12 @@
},
{
"classname": "suite1",
+ "name": "test0",
+ "timestamp": "2000-01-01T00:00:00.00000000+00:00",
+ "time": "1.0"
+ },
+ {
+ "classname": "suite1",
"name": "test2",
"timestamp": "2000-01-01T00:00:00.00000000+00:00",
"time": "1.0",
```
**What you expected to happen**:
The test cases in a suite should be sorted.
**How to reproduce it (as minimally and precisely as possible)**:
Run e2e test and get (un)lucky.
**Anything else we need to know?**:
The reporter code should lock the parent `Testsuite` and sort the `Testcases` slice after each modification.
**Environment**:
- Kubernetes version (use `kubectl version`):
- KUTTL version (use `kubectl kuttl version`):
- Cloud provider or hardware configuration:
- OS (e.g. from /etc/os-release):
- Kernel (e.g. `uname -a`):
- Install tools:
- Others:
关闭于 2024-12-03 0 条评论