From a57015accd73789a3a9747ba1b9ff92a4acf11e4 Mon Sep 17 00:00:00 2001 From: Ayush Mishra Date: Wed, 25 Sep 2024 22:35:48 +0530 Subject: [PATCH] update e2e tests --- .github/workflows/batch-score-oss-ci.yaml | 2 +- .../components/driver/tests/e2e/conftest.py | 25 ++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/batch-score-oss-ci.yaml b/.github/workflows/batch-score-oss-ci.yaml index 7c74aac0b3..f41b2ce5b5 100644 --- a/.github/workflows/batch-score-oss-ci.yaml +++ b/.github/workflows/batch-score-oss-ci.yaml @@ -64,7 +64,7 @@ jobs: RESOURCE_GROUP: ${{ env.resource_group }} WORKSPACE_NAME: ${{ env.workspace }} - name: Run e2e tests - run: python -m pytest --junitxml=${{ env.pytest_report_folder }}/${{ env.pytest_report_file }} ${{ env.testsRootPath }} --strict-markers -v -s -m "smoke" -o log_level=DEBUG -n 8 + run: python -m pytest --junitxml=${{ env.pytest_report_folder }}/${{ env.pytest_report_file }} ${{ env.testsRootPath }} --strict-markers -v -s -m "smoke" -o log_level=DEBUG -o log_cli=true -n 8 env: SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} diff --git a/assets/batch_score_oss/components/driver/tests/e2e/conftest.py b/assets/batch_score_oss/components/driver/tests/e2e/conftest.py index 713bbe76b1..3781ed613d 100644 --- a/assets/batch_score_oss/components/driver/tests/e2e/conftest.py +++ b/assets/batch_score_oss/components/driver/tests/e2e/conftest.py @@ -15,7 +15,6 @@ BATCH_SCORE_COMPONENT_YAML_NAME = "batch_score_oss" -COMPONENT_VERSION = datetime.now().strftime("%m_%d_%Y_%H_%M_%S") # Marks all tests in this directory as e2e tests @@ -67,9 +66,6 @@ def pytest_configure(): pytest.copied_batch_score_component_filepath = os.path.join(tmp_dir, f"spec_copy_{str(uuid.uuid4())}.yml") - # register components - register_components() - def pytest_unconfigure(): """Tear down pytest configuration.""" @@ -82,9 +78,10 @@ def pytest_unconfigure(): pass -def register_components(): - """Register components for the tests.""" - _register_component(BATCH_SCORE_COMPONENT_YAML_NAME, COMPONENT_VERSION) +@pytest.fixture(scope="session") +def asset_version(): + """Return the asset version for this run.""" + return datetime.now().strftime("%m_%d_%Y_%H_%M_%S") def _register_component(component_yml_name, asset_version): @@ -111,13 +108,13 @@ def _register_component(component_yml_name, asset_version): @pytest.fixture(scope="session") -def llm_batch_score_yml_component(): +def llm_batch_score_yml_component(asset_version): """Return the component version for batch_score_llm.yml.""" - return _get_component_metadata(BATCH_SCORE_COMPONENT_YAML_NAME, COMPONENT_VERSION) + return _register_and_return_component_metadata( + BATCH_SCORE_COMPONENT_YAML_NAME, + asset_version, + ) -def _get_component_metadata(component_yml_name, asset_version): - batch_score_component_filepath = os.path.join( - pytest.source_dir, component_yml_name, "spec.yaml" - ) - return _get_component_name(batch_score_component_filepath), asset_version +def _register_and_return_component_metadata(component_yml_name, asset_version): + return _register_component(component_yml_name, asset_version)