Skip to content

Commit 33f8c04

Browse files
committed
Re-run flaky E2E tests up to 3 times
Also, report slowest tests and use standard verbose logging for maximum insight into progress. This feels a little like giving up, but realistically right now ~80% of our E2E test runs fail. When they do, we mostly just re-run the entire failed suites. Each suite run takes ~20-25 mins to complete. This argument will only re-run the specific test that failed, automatically. This should result in less time spent running and waiting for E2Es overall. Signed-off-by: Nic Cope <[email protected]>
1 parent e776324 commit 33f8c04

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

Earthfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,18 @@ e2e:
7171
WITH DOCKER --load crossplane-e2e/crossplane:latest=(+image --CROSSPLANE_VERSION=v0.0.0-e2e)
7272
# TODO(negz:) Set GITHUB_ACTIONS=true and use RUN --raw-output when
7373
# https://github.com/earthly/earthly/issues/4143 is fixed.
74-
RUN gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS}
74+
RUN gotestsum \
75+
--rerun-fails=3 \
76+
--no-color=false \
77+
--format standard-verbose \
78+
--jsonfile e2e-tests.json \
79+
--junitfile e2e-tests.xml \
80+
--raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS}
7581
END
7682
FINALLY
7783
SAVE ARTIFACT --if-exists e2e-tests.xml AS LOCAL _output/tests/e2e-tests.xml
7884
END
85+
RUN gotestsum tool slowest --jsonfile e2e-tests.json
7986

8087
# hack builds Crossplane, and deploys it to a kind cluster. It runs in your
8188
# local environment, not a container. The kind cluster will keep running until

test/e2e/README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,6 @@ $ apk add kubectl
8989
# Now you can use kubectl to access the cluster
9090
```
9191

92-
### Test Logging
93-
94-
The E2E tests are run using [`gotestsum`] that helps output the test results in
95-
a format that integrates easily with CI systems. The downside though is that
96-
test logging statements, like `t.Logf("foo")`, are not streamed in real time and
97-
they are only included in the output if there is a failure.
98-
99-
To change this behavior when running the E2E tests locally, you can update the
100-
`Earthfile` to call `gotestsum` with a format like `--format standard-verbose`
101-
instead, for example:
102-
103-
```Dockerfile
104-
RUN gotestsum --no-color=false --format standard-verbose ...
105-
```
106-
10792
### Running Tests Directly
10893

10994
The E2E tests are typically run via `earthly` for convenience and consistency.

0 commit comments

Comments
 (0)