Skip to content

Commit

Permalink
TMP: move test definition to make file
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed May 17, 2024
1 parent 754ea05 commit 60538da
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 49 deletions.
37 changes: 9 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,14 @@ jobs:
steps:
- setup_container
- run:
command: pytest -n 2 -m 'not es_tests and not needs_locales_compilation and not static_assets' -v src/olympia/addons/ src/olympia/versions/ src/olympia/files/ src/olympia/ratings/
command: make test_addons_versions_files_ratings

amo-lib-locales-and-signing:
<<: *defaults-with-autograph
steps:
- setup_container
- run:
command: pytest -n 2 -m 'not es_tests and not needs_locales_compilation and not static_assets' -v src/olympia/amo/ src/olympia/lib/ src/olympia/signing
command: make test_amo_lib_locales_and_signing
environment:
AUTOGRAPH_SERVER_URL: http://127.0.0.1:5500
# After having removed `tox`, we noticed that this job was a lot slower.
Expand All @@ -554,16 +554,15 @@ jobs:
- run: echo "export PATH=\"$(pyenv prefix)/bin:$PATH\"" >> $BASH_ENV
- run: make compile_locales
- run:
command: pytest -n 2 -m 'needs_locales_compilation' -v src/olympia/
command: make test_needs_locales_compilation

assets:
<<: *defaults-with-services
steps:
- setup_container
- run: make update_assets
- run:
command: pytest -m "static_assets" -v src/olympia/
- run: make run_js_tests
command: make test_static_assets

codestyle:
<<: *defaults
Expand All @@ -586,44 +585,26 @@ jobs:
steps:
- setup_container
- run:
command: pytest -n 2 -m 'not es_tests and not needs_locales_compilation and not static_assets' -v src/olympia/devhub/
command: make test_devhub

main:
<<: *defaults-with-services
steps:
- setup_container
- run:
command: |
pytest -n 2 -m 'not es_tests and not needs_locales_compilation and not static_assets and not internal_routes_allowed' \
-v src/olympia/ \
--ignore src/olympia/addons/ \
--ignore src/olympia/devhub/ \
--ignore src/olympia/files/ \
--ignore src/olympia/reviewers/ \
--ignore src/olympia/ratings/ \
--ignore src/olympia/amo/ \
--ignore src/olympia/lib/ \
--ignore src/olympia/signing \
--ignore src/olympia/versions/ \
--ignore src/olympia/zadmin
command: make test_main

reviewers-and-zadmin:
<<: *defaults-with-autograph
steps:
- setup_container
- run:
command: pytest -n 2 -m 'not es_tests and not needs_locales_compilation and not static_assets' -v src/olympia/reviewers/ src/olympia/zadmin/
command: make test_reviewers_and_zadmin
environment:
AUTOGRAPH_SERVER_URL: http://127.0.0.1:5500
- run:
name: internal_routes_allowed
command: |
# We need to change the setting in the file because we can't
# override an env variable here, and the next command requires
# `INTERNAL_ROUTES_ALLOWED` to be set to `True`.
sed -i 's/^INTERNAL_ROUTES_ALLOWED.*/INTERNAL_ROUTES_ALLOWED=True/' settings_test.py
pytest -m 'internal_routes_allowed' -v src/olympia/
command: make internal_routes_allowed
es-tests:
<<: *defaults-with-elasticsearch
steps:
Expand All @@ -632,7 +613,7 @@ jobs:
name: Wait for elasticsearch
command: dockerize -wait tcp://localhost:9200 -timeout 1m
- run:
command: pytest -m "es_tests and not needs_locales_compilation and not static_assets" -v src/olympia/
command: make test_es_tests

# Add to a workflow, if you want to test the docker build in circleci
build-image:
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/verify-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,3 @@ jobs:
version: ${{ steps.build.outputs.version }}
run: |
make check
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Docker image
id: build
uses: ./.github/actions/build-docker

- name: Run Test
uses: ./.github/actions/run-docker
with:
version: ${{ steps.build.outputs.version }}
services: ''
run: |
pytest \
-n auto \
-m 'not es_tests and not needs_locales_compilation and not static_assets and not internal_routes_allowed' \
-v src/olympia/amo
74 changes: 74 additions & 0 deletions Makefile-docker
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,80 @@ reload: ## force django code reload

reload-uwsgi: reload

.PHONY: test_addons_versions_files_ratings
test_addons_versions_files_ratings:
pytest \
-n 2 \
-m 'not es_tests and not needs_locales_compilation and not static_assets' \
-v src/olympia/addons/ src/olympia/versions/ src/olympia/files/ src/olympia/ratings/

.PHONY: test_amo_lib_locales_and_signing
test_amo_lib_locales_and_signing:
pytest \
-n 2 \
-m 'not es_tests and not needs_locales_compilation and not static_assets' \
-v src/olympia/amo/ src/olympia/lib/ src/olympia/signing

.PHONY: test_needs_locales_compilation
test_needs_locales_compilation:
pytest \
-n 2 \
-m 'needs_locales_compilation' \
-v src/olympia/

.PHONY: test_static_assets
test_static_assets: run_js_tests
pytest \
-n 2 \
-m 'static_assets' \
-v src/olympia/

.PHONY: test_devhub
test_devhub:
pytest \
-n 2 \
-m 'not es_tests and not needs_locales_compilation and not static_assets' \
-v src/olympia/devhub/

.PHONY: test_main
test_main:
pytest \
-n 2 \
-m 'not es_tests and not needs_locales_compilation and not static_assets and not internal_routes_allowed' \
-v src/olympia/ \
--ignore src/olympia/addons/ \
--ignore src/olympia/devhub/ \
--ignore src/olympia/files/ \
--ignore src/olympia/reviewers/ \
--ignore src/olympia/ratings/ \
--ignore src/olympia/amo/ \
--ignore src/olympia/lib/ \
--ignore src/olympia/signing \
--ignore src/olympia/versions/ \
--ignore src/olympia/zadmin

.PHONY: test_reviewers_and_zadmin
test_reviewers_and_zadmin:
pytest \
-n 2 \
-m 'not es_tests and not needs_locales_compilation and not static_assets' \
-v src/olympia/reviewers/ src/olympia/zadmin/

.PHONY: test_internal_routes_allowed
internal_routes_allowed:
# We need to change the setting in the file because we can't
# override an env variable here, and the next command requires
# `INTERNAL_ROUTES_ALLOWED` to be set to `True`.
sed -i 's/^INTERNAL_ROUTES_ALLOWED.*/INTERNAL_ROUTES_ALLOWED=True/' settings_test.py
pytest -m 'internal_routes_allowed' -v src/olympia/

.PHONY: test_es_tests
test_es_tests:
pytest \
-m "es_tests and not needs_locales_compilation and not static_assets" \
-v src/olympia/


.PHONY: test
test: ## run the entire test suite
pytest $(APP) $(ARGS)
Expand Down

0 comments on commit 60538da

Please sign in to comment.