Skip to content

Commit 9d01f7f

Browse files
authored
chore(tests): Update test result file names to match correct naming scheme. (#12583)
Because - We want to collect test results and coverage reports for tracking on our Test Metrics Pipeline This commit - Changes the names of the test reports to conform to the required names for the Pipeline. Fixes #12577
1 parent acd516f commit 9d01f7f

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.circleci/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ commands:
4848
steps:
4949
- run:
5050
name: Create Workspace
51-
command: mkdir -p workspace/test-results
51+
command: |
52+
mkdir -p workspace/test-results
53+
mkdir -p dashboard/test-results
5254
5355
jobs:
5456
check_experimenter_x86_64:
@@ -412,6 +414,7 @@ jobs:
412414
poetry add pydantic==2.10.3
413415
poetry install
414416
poetry run pytest --junitxml=/Users/distiller/project/workspace/test-results/experimenter_ios_integration_tests.xml -k test_ios_integration.py --feature ios_enrollment
417+
cp experimenter_ios_integration_tests.xml dashboard/test-results/$(CIRCLE_BUILD_NUM)__$(EPOCH_TIME)__$(CIRCLE_PROJECT_REPONAME)__$(CIRCLE_WORKFLOW_ID)__)ios__integration__results.xml
415418
- run:
416419
name: Collect XCTest Results
417420
command: |

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ COMPOSE_INTEGRATION = ${COMPOSE_PROD} -f docker-compose-integration-test.yml $$(
1414
COMPOSE_INTEGRATION_RUN = ${COMPOSE_INTEGRATION} run --name experimenter_integration
1515
DOCKER_BUILD = docker buildx build
1616

17+
EPOCH_TIME := $(shell date +"%s")
18+
TEST_RESULTS_DIR ?= dashboard/test-results
19+
TEST_FILE_PREFIX := $(if $(CIRCLECI),$(CIRCLE_BUILD_NUM)__$(EPOCH_TIME)__$(CIRCLE_PROJECT_REPONAME)__$(CIRCLE_WORKFLOW_ID)__)
20+
UNIT_JUNIT_XML := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)unit__results.xml
21+
UNIT_COVERAGE_JSON := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)unit__coverage.json
22+
UI_COVERAGE_JSON := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)ui__coverage.json
23+
UI_JUNIT_XML := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)ui__results.xml
24+
INTEGRATION_JUNIT_XML := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)integration__results.xml
25+
1726
JOBS = 4
1827
PARALLEL = parallel --halt now,fail=1 --jobs ${JOBS} {} :::
1928
NOCOLOR= \033[0m
@@ -50,7 +59,6 @@ LOAD_LANGUAGES = python manage.py loaddata ./experimenter/base/fixtures/language
5059
LOAD_FEATURES = python manage.py load_feature_configs
5160
LOAD_DUMMY_EXPERIMENTS = [[ -z $$SKIP_DUMMY ]] && python manage.py load_dummy_experiments || python manage.py load_dummy_projects
5261

53-
5462
JETSTREAM_CONFIG_URL = https://github.com/mozilla/metric-hub/archive/main.zip
5563

5664
CLI_DIR = experimenter/experimenter/features/manifests/application-services
@@ -165,6 +173,10 @@ check_and_report: lint
165173
docker cp experimenter_test:/experimenter/experimenter_tests.xml workspace/test-results
166174
docker cp experimenter_test:/experimenter/experimenter/nimbus-ui/coverage_report workspace/test-results
167175
docker cp experimenter_test:/experimenter/experimenter/nimbus-ui/junit.xml workspace/test-results
176+
cp workspace/test-results/experimenter_coverage.json $(UNIT_COVERAGE_JSON)
177+
cp workspace/test-results/experimenter_tests.xml $(UNIT_JUNIT_XML)
178+
cp workspace/test-results/coverage_report/coverage-final.json $(UI_COVERAGE_JSON)
179+
cp workspace/test-results/junit.xml $(UI_JUNIT_XML)
168180
docker rm experimenter_test
169181

170182
test: build_test ## Run tests
@@ -246,9 +258,11 @@ integration_test_nimbus_sdk: build_integration_test build_prod
246258
integration_test_nimbus_fenix:
247259
poetry -C experimenter/tests/integration/ -vvv install --no-root
248260
poetry -C experimenter/tests/integration/ -vvv run pytest --html=workspace/test-results/report.htm --self-contained-html --reruns-delay 30 --driver Firefox experimenter/tests/integration/nimbus/android --junitxml=workspace/test-results/experimenter_fenix_integration_tests.xml -vvv
261+
cp experimenter_fenix_integration_tests.xml $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)fenix__integration__results.xml
249262

250263
make integration_test_and_report:
251264
docker cp experimenter_integration:/code/experimenter/tests/integration/test-reports/experimenter_integration_tests.xml workspace/test-results
265+
cp workspace/test-results/experimenter_integration_tests.xml $(INTEGRATION_JUNIT_XML)
252266
docker rm experimenter_integration
253267

254268
# cirrus
@@ -261,6 +275,8 @@ CIRRUS_PYTEST = pytest . --cov-config=.coveragerc --cov=cirrus --cov-report json
261275
CIRRUS_PYTHON_TYPECHECK = pyright -p .
262276
CIRRUS_PYTHON_TYPECHECK_CREATESTUB = pyright -p . --createstub cirrus
263277
CIRRUS_GENERATE_DOCS = python cirrus/generate_docs.py
278+
CIRRUS_COVERAGE_JSON := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)cirrus__unit__coverage.json
279+
CIRRUS_JUNIT_XML := $(TEST_RESULTS_DIR)/$(TEST_FILE_PREFIX)cirrus__integration__results.xml
264280

265281
cirrus_build: build_megazords
266282
$(CIRRUS_ENABLE) $(DOCKER_BUILD) --target deploy -f cirrus/server/Dockerfile -t cirrus:deploy cirrus/server/
@@ -289,6 +305,8 @@ cirrus_lint: cirrus_build_test
289305
cirrus_check_and_report: cirrus_lint
290306
docker cp experimenter_test:/cirrus/cirrus_pytest.xml workspace/test-results
291307
docker cp experimenter_test:/cirrus/cirrus_coverage.json workspace/test-results
308+
cp workspace/test-results/cirrus_pytest.xml $(CIRRUS_JUNIT_XML)
309+
cp workspace/test-results/cirrus_coverage.json $(CIRRUS_COVERAGE_JSON)
292310
docker rm experimenter_test
293311

294312
cirrus_code_format: cirrus_build

0 commit comments

Comments
 (0)