@@ -13,7 +13,7 @@ Composition, etc. They should not take dependencies on 'real' Crossplane
1313providers or external systems. Instead they use 'fake' providers like
1414` provider-nop ` and ` provider-dummy ` .
1515
16- All Crossplane features must be exercised by these tests, as well as unit tests.
16+ All Crossplane features must be exercised by these tests, as well as unit tests.
1717
1818## Running Tests
1919
@@ -38,7 +38,7 @@ earthly -P +e2e --FLAGS="-labels area=apiextensions"
3838earthly -P +e2e --FLAGS=" -feature=ConfigurationWithDependency"
3939
4040# Stop immediately on first test failure, and leave the kind cluster to debug.
41- earthly -i -P +e2e --FLAGS=" -test.failfast -destroy-kind-cluster=false"
41+ earthly -i -P +e2e --FLAGS=" -test.failfast -fail-fast - destroy-kind-cluster=false"
4242
4343# Run a specific test suite.
4444earthly -P +e2e --FLAGS=" -test.v -test-suite=composition-webhook-schema-validation"
@@ -89,6 +89,44 @@ $ 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+
107+ ### Running Tests Directly
108+
109+ The E2E tests are typically run via ` earthly ` for convenience and consistency.
110+ However, this introduces additional layers that can make it challenging to debug
111+ issues (see [ Accessing the Test Cluster] ( #accessing-the-test-cluster ) above). An
112+ alternative is to run the tests more directly by basically manually running a
113+ couple critical commands that ` earthly ` would normally run for you inside of its
114+ build container.
115+
116+ First compile the E2E test binary:
117+ ``` shell
118+ go test -c -o e2e ./test/e2e
119+ ```
120+
121+ Then run the ` e2e ` test binary, passing your specific flags and specific tests
122+ you want to execute if desired:
123+ ``` shell
124+ ./e2e -v=4 -test.v -test.failfast -fail-fast -destroy-kind-cluster=false -test.run ^TestPropagateFieldsRemovalToXRAfterUpgrade
125+ ```
126+
127+ Note the command above doesn't clean up the ` kind ` cluster when finished, so
128+ you'll need to manually delete it when you're done.
129+
92130## Test Parallelism
93131
94132` earthly -P +e2e ` runs all defined E2E tests serially. Tests do not run in
@@ -98,7 +136,7 @@ etc. It's easier and less error-prone to write tests when you don't have to
98136worry about one test potentially conflicting with another - for example by
99137installing the same provider another test would install.
100138
101- The [ CI GitHub workflow] uses a matrix strategy to run multiple jobs in parallel,
139+ The [ CI GitHub workflow] uses a matrix strategy to run multiple jobs in parallel,
102140each running a test suite, see the dedicated section for more details.
103141
104142We are currently splitting the tests to be able to run all basic tests against
@@ -112,7 +150,7 @@ the area to the matrix or spinning multiple kind clusters for each job.
112150## Test Suite
113151
114152In order to be able to run specific subsets of tests, we introduced the concept
115- of test suites. To run a specific test suite use the ` -test-suite ` flag.
153+ of test suites. To run a specific test suite use the ` -test-suite ` flag.
116154
117155A test suite is currently defined by:
118156- A key to be used as value of the ` -test-suite ` flag.
@@ -292,3 +330,4 @@ Refer to the [E2E one-pager] for more context.
292330[ `testing` ] : https://pkg.go.dev/testing
293331[ `e2e-framework` ] : https://pkg.go.dev/sigs.k8s.io/e2e-framework
294332[ E2e one-pager ] : ../../design/one-pager-e2e-tests.md
333+ [ `gotestsum` ] : https://github.com/gotestyourself/gotestsum
0 commit comments