Skip to content

Commit 70e1f59

Browse files
authored
Merge pull request crossplane#6405 from negz/cowardice
Re-run flaky E2E tests up to 3 times
2 parents e776324 + fd88bd1 commit 70e1f59

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ jobs:
288288
- name: Run E2E Tests
289289
run: |
290290
earthly --strict --allow-privileged --remote-cache ghcr.io/crossplane/earthly-cache:${{ github.job }}-${{ matrix.test-suite}} \
291-
+e2e --FLAGS="-test.failfast -fail-fast -prior-crossplane-version=${CROSSPLANE_PRIOR_VERSION} --test-suite ${{ matrix.test-suite }}"
291+
+e2e --GOTESTSUM_FORMAT="testname" --FLAGS="-test.failfast -fail-fast -prior-crossplane-version=${CROSSPLANE_PRIOR_VERSION} --test-suite ${{ matrix.test-suite }}"
292292
293293
- name: Publish E2E Test Flakes
294294
if: '!cancelled()'

Earthfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ e2e:
5151
ARG GOARCH=${TARGETARCH}
5252
ARG GOOS=${TARGETOS}
5353
ARG FLAGS="-test-suite=base"
54+
ARG GOTESTSUM_FORMAT="standard-verbose"
5455
# Using earthly image to allow compatibility with different development environments e.g. WSL
5556
FROM earthly/dind:alpine-3.20-docker-26.1.5-r0
5657
RUN wget https://dl.google.com/go/go${GO_VERSION}.${GOOS}-${GOARCH}.tar.gz
@@ -71,7 +72,12 @@ e2e:
7172
WITH DOCKER --load crossplane-e2e/crossplane:latest=(+image --CROSSPLANE_VERSION=v0.0.0-e2e)
7273
# TODO(negz:) Set GITHUB_ACTIONS=true and use RUN --raw-output when
7374
# 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}
75+
RUN gotestsum \
76+
--rerun-fails \
77+
--no-color=false \
78+
--format ${GOTESTSUM_FORMAT} \
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

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)