Skip to content

Commit 8bd1368

Browse files
committed
parallel tests
1 parent a36f9d5 commit 8bd1368

File tree

7 files changed

+180
-8
lines changed

7 files changed

+180
-8
lines changed

e2e_batch/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44

55
APIGEE_ACCESS_TOKEN ?= $(shell export SSO_LOGIN_URL=https://login.apigee.com && eval get_token -u $(APIGEE_USERNAME))
66
AWS_DOMAIN_NAME=https://$(shell make -C ../terraform -s output name=service_domain_name || true)
7+
PARALLEL_WORKERS=4
78

89
print-token:
910
@echo "APIGEE_ACCESS_TOKEN=$(APIGEE_ACCESS_TOKEN)"
1011

1112
run-immunization-batch:
12-
ENVIRONMENT=$(environment) poetry run python -m unittest -v -c
13+
# ENVIRONMENT=$(environment) poetry run python -m unittest -v -c
14+
ENVIRONMENT=$(ENVIRONMENT) poetry run unittest-parallel -v -j $(PARALLEL_WORKERS)
1315

1416
test:
15-
ENVIRONMENT=$(environment) poetry run python -m unittest -v -c
17+
# @echo "PR_NUMBER=$(PR_NUMBER)"
18+
# @echo "ENVIRONMENT=$(ENVIRONMENT)"
19+
# ENVIRONMENT=$(ENVIRONMENT) poetry run python -m unittest -v -c
20+
ENVIRONMENT=$(ENVIRONMENT) poetry run unittest-parallel -v -j $(PARALLEL_WORKERS)
21+
22+

e2e_batch/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
CONFIG_BUCKET = "imms-internal-dev-supplier-config"
1818
PERMISSIONS_CONFIG_FILE_KEY = "permissions_config.json"
1919

20+
print(f"SAW. Debug {SOURCE_BUCKET}")
21+
print(f"SAW. Debug {ACK_BUCKET}")
22+
print(f"SAW. Debug {environment}")
23+
2024

2125
def create_row(unique_id, fore_name, dose_amount, action_flag, header):
2226
"""Helper function to create a single row with the specified UNIQUE_ID and ACTION_FLAG."""

e2e_batch/per_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def monitor(nameMarker):
1818
"marker": nameMarker,
1919
"elapsed_time": elapsed_ms
2020
}
21+
logger.info(f"Perf end [{nameMarker}]: {elapsed_ms} ms")
22+
2123
logger.info(json.dumps(out_msg))
2224
del marker[nameMarker] # <-- remove the marker after logging
2325
else:
26+
logger.info(f"Perf start [{nameMarker}]")
2427
marker[nameMarker] = t

e2e_batch/poetry.lock

Lines changed: 146 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e_batch/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ description = "End-to-end tests for immunization-batch"
55
authors = ["Your Name <[email protected]>"]
66
license = "MIT"
77
readme = "README.md"
8+
package-mode = false
89

910
[tool.poetry.dependencies]
1011
python = "~3.11"
1112
boto3 = "~1.38.42"
1213
pandas = "^2.3.0"
14+
dotenv = "^0.9.9"
15+
unittest-parallel = "^1.7.5"
16+
17+
[tool.poetry.group.dev.dependencies]
18+
unittest-parallel = "^1.7.5"
19+

e2e_batch/test_e2e_batch.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
import unittest
3+
34
from utils import (
45
generate_csv,
56
upload_file_to_s3,
@@ -24,9 +25,13 @@
2425
FILE_NAME_VAL_ERROR,
2526
environment
2627
)
28+
# load dotenv for run from desktop
29+
# from dotenv import load_dotenv
30+
# load_dotenv()
2731

2832

2933
class TestE2EBatch(unittest.TestCase):
34+
3035
def setUp(self):
3136
self.uploaded_files = [] # Tracks uploaded input keys
3237
self.ack_files = [] # Tracks ack keys
@@ -41,9 +46,8 @@ def tearDown(self):
4146
def test_create_success(self):
4247
"""Test CREATE scenario."""
4348
monitor("test_create_success")
44-
input_file = generate_csv("PHYLIS", "0.3",
45-
"RSV", "YGM41",
46-
action_flag="CREATE")
49+
input_file = generate_csv("PHYLIS", "0.3", "CREATE",
50+
"RSV", "YGM41")
4751

4852
key = upload_file_to_s3(input_file, SOURCE_BUCKET, INPUT_PREFIX)
4953
self.uploaded_files.append(key)
@@ -239,7 +243,6 @@ def test_invalid_permission(self):
239243
def test_end_to_end_speed_test_with_100000_rows(self):
240244
monitor("test_end_to_end_speed_test_with_100000_rows")
241245
"""Test end_to_end_speed_test_with_100000_rows scenario with full integration"""
242-
file_name = f"RSV_Vaccinations_v5_YGM41_{timestamp}.csv" if not file_name else file_name
243246
input_file = generate_csv_with_ordered_100000_rows(None)
244247

245248
key = upload_file_to_s3(input_file, SOURCE_BUCKET, INPUT_PREFIX)

0 commit comments

Comments
 (0)