Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(nimbus): Fix for macos integration-tests #10549

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -159,7 +159,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -181,7 +181,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -202,7 +202,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -223,7 +223,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -244,7 +244,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -265,7 +265,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -286,7 +286,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand All @@ -308,7 +308,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
no_output_timeout: 30m
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm
Expand All @@ -330,7 +330,7 @@ jobs:
name: Run integration tests
command: |
cp .env.integration-tests .env
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand Down Expand Up @@ -372,7 +372,7 @@ jobs:
command: |
cp .env.integration-tests .env
export CIRRUS=1
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus PYTEST_ARGS="$PYTEST_ARGS"
make refresh SKIP_DUMMY=1 PYTEST_SENTRY_DSN=$PYTEST_SENTRY_DSN CIRCLECI=$CIRCLECI up_prod_detached integration_test_nimbus_ci PYTEST_ARGS="$PYTEST_ARGS"
- store_artifacts:
path: ~/experimenter/experimenter/tests/integration/test-reports/report.htm

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,13 @@ integration_vnc_up_detached: build_prod
integration_test_legacy: build_prod
MOZ_HEADLESS=1 $(COMPOSE_INTEGRATION) run firefox sh -c "sudo apt-get -qqy update && sudo apt-get -qqy install tox;sudo chmod -R a+rwx /code/experimenter/tests/integration/;sudo mkdir -m a+rwx /code/experimenter/tests/integration/test-reports;tox -c experimenter/tests/integration -e integration-test-legacy $(TOX_ARGS) -- -n 2 $(PYTEST_ARGS)"

integration_test_nimbus: build_prod
integration_test_nimbus_ci: build_prod
MOZ_HEADLESS=1 $(COMPOSE_INTEGRATION) run firefox sh -c "if [ \"$$UPDATE_FIREFOX_VERSION\" = \"true\" ]; then sudo ./experimenter/tests/integration/nimbus/utils/nightly-install.sh; fi; firefox -V; sudo apt-get -qqy update && sudo apt-get -qqy install tox;sudo chmod a+rwx /code/experimenter/tests/integration/.tox;sudo mkdir -m a+rwx /code/experimenter/tests/integration/test-reports;PYTEST_SENTRY_DSN=$(PYTEST_SENTRY_DSN) PYTEST_SENTRY_ALWAYS_REPORT=$(PYTEST_SENTRY_ALWAYS_REPORT) CIRCLECI=$(CIRCLECI) tox -c experimenter/tests/integration -e integration-test-nimbus $(TOX_ARGS) -- $(PYTEST_ARGS)"

integration_test_nimbus_dev:
$(COMPOSE_INTEGRATION) up -d
INTEGRATION_TEST_NGINX_URL="https://localhost" INTEGRATION_TEST_KINTO_URL="http://localhost:8888/v1" tox -c experimenter/tests/integration -e integration-test-nimbus-local $(TOX_ARGS) -- $(PYTEST_ARGS)

integration_test_nimbus_rust: build_integration_test build_prod
MOZ_HEADLESS=1 $(COMPOSE_INTEGRATION) run -it rust-sdk tox -vv -c experimenter/tests/integration -e integration-test-nimbus-rust $(TOX_ARGS) -- -n 2 $(PYTEST_ARGS)

Expand Down
41 changes: 17 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,49 +427,37 @@ yarn workspace @experimenter/nimbus-ui test:cov

For a full reference of all the common commands that can be run inside the container, refer to [this section of the Makefile](https://github.com/mozilla/experimenter/blob/main/Makefile#L16-L38)

### Testing

#### make integration_test_legacy

Run the integration test suite for experimenter inside a containerized instance of Firefox. You must also be already running a `make up` dev instance in another shell to run the integration tests.

#### make FIREFOX_VERSION integration_test_nimbus
#### make FIREFOX_VERSION integration_test_nimbus_dev

Run the integration test suite for nimbus inside a containerized instance of Firefox. You must also be already running a `make up` dev instance in another shell to run the integration tests.

FIREFOX_VERSION should either be `nimbus-firefox-release` or `nimbus-firefox-beta`. If you want to run your tests against nightly, please set the variable `UPDATE_FIREFOX_VERSION` to `true` and include it in the make command.

#### make FIREFOX_VERSION integration_test_nimbus_rust

Run the Nimbus SDK integration tests, which tests the advanced targeting configurations against the Nimbus SDK.

FIREFOX_VERSION should either be `nimbus-firefox-release` or `nimbus-firefox-beta`. If you want to run your tests against nightly, please set the variable `UPDATE_FIREFOX_VERSION` to `true` and include it in the make command.

#### make FIREFOX_VERSION integration_vnc_up

First start a prod instance of Experimenter with:
You must run the following commands before this:

```bash
make refresh&&make up_prod_detached
make refresh build_integration_tests up_prod_detached
```

Then start the VNC service:

After this you can view the test run at `http://localhost:7902`, the password is `secret`. You can now make changes and run your test directly by changing the `PYTEST_ARGS` variable.
Example:
```bash
make FIREFOX_VERSION integration_vnc_up
make integration_test_nimbus_dev PYTEST_ARGS="-k test-name-here"
```

Then open your VNC client (Safari does this on OSX or just use [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/)) and open `vnc://localhost:5900` with password `secret`. Right click on the desktop and select `Applications > Shell > Bash` and enter:
Be sure to add the client you want to test against, refer to the tests in the `.circleci/config.yml` file for examples of clients. Put your test name followed by the client in square brackets, `PYTEST_ARGS"-k test-name-here[FIREFOX_DESKTOP]"`

```bash
cd experimenter
sudo apt get update
sudo apt install tox
chmod a+rwx tests/integration/.tox
tox -c tests/integration/ -e integration-test-nimbus
```
#### make FIREFOX_VERSION integration_test_nimbus_rust

This should run the integration tests and watch them run in a Firefox instance you can watch and interact with.
Run the Nimbus SDK integration tests, which tests the advanced targeting configurations against the Nimbus SDK.

To use NoVNC, navgate to this url `http://localhost:7902` with the password `secret`. Then you can follow the same steps as above.
FIREFOX_VERSION should either be `nimbus-firefox-release` or `nimbus-firefox-beta`. If you want to run your tests against nightly, please set the variable `UPDATE_FIREFOX_VERSION` to `true` and include it in the make command.

### Running Integration tests locally

Expand Down Expand Up @@ -506,6 +494,11 @@ Firefox should pop up and start running through your test! You can change the fi
firefox_options.binary = "path/to/firefox-bin"
```

You can also do this using a make command, specifically `integration_test_nimbus_dev`. The following is an example that will run the `remote_settings` tests.
```sh
PYTEST_ARGS="-k FIREFOX_DESKTOP -m remote_settings --reruns 1" make integration_test_nimbus_dev
```

#### Integration Test options

- `TOX_ARGS`: [Tox](https://tox.readthedocs.io/en/latest/config.html#tox) commandline variables.
Expand Down