Skip to content

Commit 5e9c44d

Browse files
authored
Don't cache the tests that are part of the e2e testsuite. (#1185)
* Don't cache the tests that are part of the e2e testsuite. This prevents spurious errors when running the tests repeatedly. * add a small comment on what '-count=1' means and why we need it.
1 parent 09fb1ee commit 5e9c44d

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

make/sandbox-ui.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ e2e-run-sandbox-ui:
112112
$(GOPATH)/bin/playwright install firefox
113113

114114
@echo "Running Developer Sandbox UI setup e2e tests..."
115-
SANDBOX_UI_NS=${SANDBOX_UI_NS} go test "./test/e2e/sandbox-ui/setup" -v -timeout=10m -failfast
115+
SANDBOX_UI_NS=${SANDBOX_UI_NS} go test "./test/e2e/sandbox-ui/setup" -v -timeout=10m -failfast -count=1
116116

117117
@echo "Running Developer Sandbox UI e2e tests in firefox..."
118118
SSO_USERNAME=${SSO_USERNAME} SSO_PASSWORD=${SSO_PASSWORD} BASE_URL=${RHDH} BROWSER=firefox envsubst < deploy/sandbox-ui/ui-e2e-tests/.env > testsupport/sandbox-ui/.env
119-
go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast
119+
# NOTE: The "-count=1" is the idiomatic way of turning off the test result cache according to https://pkg.go.dev/cmd/go#hdr-Testing_flags.
120+
go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast -count=1
120121
@oc delete usersignup ${SSO_USERNAME} -n ${HOST_NS}
121122

122123
@echo "The Developer Sandbox UI e2e tests successfully finished"
@@ -159,4 +160,4 @@ test-sandbox-ui-in-container: build-sandbox-ui-e2e-tests
159160
-e TMP=/tmp/ \
160161
-e PUSH_SANDBOX_IMAGE=false \
161162
-e RUNNING_IN_CONTAINER=true \
162-
$(UNIT_TEST_IMAGE_NAME)
163+
$(UNIT_TEST_IMAGE_NAME)

make/test.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ execute-tests:
164164
@echo "Status of ToolchainStatus"
165165
-oc get ToolchainStatus -n ${HOST_NS} -o yaml
166166
@echo "Starting test $(shell date)"
167-
MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} SECOND_MEMBER_MODE=${SECOND_MEMBER_MODE} go test ${TESTS_TO_EXECUTE} -run ${TESTS_RUN_FILTER_REGEXP} -p 1 -v -timeout=90m -failfast || \
167+
# NOTE: The "-count=1" is the idiomatic way of turning off the test result cache according to https://pkg.go.dev/cmd/go#hdr-Testing_flags.
168+
# One might wonder whether the word "idiomatic" shouldn't have been spelled with 2 letters less there.
169+
# We need to turn off the cache because the e2e tests depend on running the migration setup. If the results of the migration tests were
170+
# cached, it might happen that the cluster is in an unprepared state when the e2e tests start running.
171+
MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} SECOND_MEMBER_MODE=${SECOND_MEMBER_MODE} go test ${TESTS_TO_EXECUTE} -run ${TESTS_RUN_FILTER_REGEXP} -p 1 -v -timeout=90m -failfast -count=1 || \
168172
($(MAKE) print-logs HOST_NS=${HOST_NS} MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} && exit 1)
169173

170174
.PHONY: print-logs

test/e2e/sandbox-ui/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Developer Sandbox UI E2E Tests
2+
23
The UI E2E tests are executed against the Developer Sandbox UI running in OpenShift.
34

45
*Prerequisites*:
56

6-
1. You need a OCP cluster
7+
1. You need a OCP cluster
78
- ROSA cluster from ClusterBot will not work since we are not able to modify the OAuth configuration of ROSA clusters created by the ClusterBot.
89
2. Ensure you are using Node.js version 22
910
- to easily manage it, you can run `nvm use 22`
1011
3. Ensure you have `yarn` installed
11-
4. Make sure you can log in at https://sso.devsandbox.dev/auth/realms/sandbox-dev/account using your SSO_USERNAME and SSO_PASSWORD
12+
4. Make sure you can log in at <https://sso.devsandbox.dev/auth/realms/sandbox-dev/account> using your SSO_USERNAME and SSO_PASSWORD
1213
5. Make sure you do not have any toolchain resources deployed on your cluster
1314

1415
### Running UI E2E Tests locally
16+
1517
`make test-ui-e2e SSO_USERNAME=${SSO_USERNAME} SSO_PASSWORD=${SSO_PASSWORD}`
1618

1719
If you want to run and test the Developer Sandbox UI from your local rhdh-plugins repo, run `make test-ui-e2e-local SSO_USERNAME=${SSO_USERNAME} SSO_PASSWORD=${SSO_PASSWORD}`
@@ -23,25 +25,30 @@ For now, the UI E2E tests are running only through the Firefox browser.
2325
`make test-sandbox-ui-in-container SSO_USERNAME=<SSO_USERNAME> SSO_PASSWORD=<SSO_PASSWORD>`
2426

2527
### Running UI E2E Tests against dev/stage/prod
28+
2629
If you want to run the UI E2E tests against dev/stage/prod, please follow the next steps:
30+
2731
- have a new Red Hat account or an account that was deactivated
2832
- fill `testsupport/sandbox-ui/.env`, note that to run the UI E2E tests against dev/stage/prod, you need to set the ENVIRONMENT to dev.
33+
2934
```
3035
SSO_USERNAME=<your-username>
3136
SSO_PASSWORD=<your-password>
3237
BASE_URL=https://sandbox.redhat.com/
3338
ENVIRONMENT=dev
3439
BROWSER=firefox
3540
```
36-
- run `go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast`
41+
42+
- run `go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast -count=1`
3743

3844
`make test-sandbox-ui-in-container SSO_USERNAME=<SSO_USERNAME> SSO_PASSWORD=<SSO_PASSWORD>`
3945

4046
### Deploy Developer Sandbox UI in E2E mode
47+
4148
`make deploy-sandbox-ui HOST_NS=<HOST_NS>`
4249

4350
Please note that OCP cluster does not have a valid CA, so when accessing the Developer Sandbox UI, you need to:
44-
51+
4552
- accept to proceed unsafely
4653

4754
![private-connection](https://github.com/user-attachments/assets/5b35a65f-6703-42cf-a165-b7326fd4faab)
@@ -51,4 +58,6 @@ Please note that OCP cluster does not have a valid CA, so when accessing the Dev
5158
![registration-service](https://github.com/user-attachments/assets/6c2f7446-1de2-4701-ace7-2d6796f49eeb)
5259

5360
### Clean Developer Sandbox UI
54-
`make clean-sandbox-ui HOST_NS=<HOST_NS> SSO_USERNAME=<SSO_USERNAME>`
61+
62+
`make clean-sandbox-ui HOST_NS=<HOST_NS> SSO_USERNAME=<SSO_USERNAME>`
63+

0 commit comments

Comments
 (0)