From 60538da67c989dd922ae05694f0a9a21ca283efb Mon Sep 17 00:00:00 2001 From: Kevin Meinhardt Date: Thu, 16 May 2024 17:40:34 +0200 Subject: [PATCH] TMP: move test definition to make file --- .circleci/config.yml | 37 +++--------- .github/workflows/verify-docker-image.yml | 21 ------- Makefile-docker | 74 +++++++++++++++++++++++ 3 files changed, 83 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3078928379..638d704da10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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. @@ -554,7 +554,7 @@ 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 @@ -562,8 +562,7 @@ jobs: - 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 @@ -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: @@ -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: diff --git a/.github/workflows/verify-docker-image.yml b/.github/workflows/verify-docker-image.yml index 06a4d4c195f..98db5226df0 100644 --- a/.github/workflows/verify-docker-image.yml +++ b/.github/workflows/verify-docker-image.yml @@ -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 diff --git a/Makefile-docker b/Makefile-docker index 3324c18bf02..5468278cb41 100644 --- a/Makefile-docker +++ b/Makefile-docker @@ -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)