diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index e83c0ff78c..c4f3c4aaa3 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -35,16 +35,20 @@ jobs: run: | echo "test_env=$(python -c "print('${{ github.head_ref }}'.split('/')[1])")" >> $GITHUB_OUTPUT echo "concept_id=$(python -c "print('${{ github.head_ref }}'.split('/')[2])")" >> $GITHUB_OUTPUT + - name: install + id: install + run: | + poetry install - name: Execute tests id: run-tests + working-directory: tests env: TEST_ENV: ${{ steps.get-env-ccid.outputs.test_env }} CONCEPT_ID: ${{ steps.get-env-ccid.outputs.concept_id }} CMR_USER: ${{ secrets.CMR_USER }} CMR_PASS: ${{ secrets.CMR_PASS }} run: | - poetry install - poetry run pytest tests/verify_collection.py --concept_id $CONCEPT_ID --env $TEST_ENV --junitxml=$GITHUB_WORKSPACE/test-results/test_report.xml --html=$GITHUB_WORKSPACE/test-results/test_report.html || true + poetry run pytest verify_collection.py --concept_id $CONCEPT_ID --env $TEST_ENV --junitxml=$GITHUB_WORKSPACE/test-results/test_report.xml --html=$GITHUB_WORKSPACE/test-results/test_report.html || true - name: Publish Test Results id: publish-test uses: EnricoMi/publish-unit-test-result-action@v2 diff --git a/tests/conftest.py b/tests/conftest.py index f44a9b15c1..37f59de3ca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -79,7 +79,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): failed.extend([list(failed.keywords)[3] for failed in terminalreporter.stats.get('failed', [])]) success.extend([list(passed.keywords)[3] for passed in terminalreporter.stats.get('passed', [])]) - # Have temporal and spacial test if failed either one don't put in success + # Have temporal and spatial test if failed either one don't put in success # Convert lists to sets fail_set = set(failed) diff --git a/tests/get_associations.py b/tests/get_associations.py index 31028cd590..a9cb6c0f52 100644 --- a/tests/get_associations.py +++ b/tests/get_associations.py @@ -50,7 +50,7 @@ def get_associations(token, env): } service_concept_id = cmr.queries.ServiceQuery(mode=mode).provider('POCLOUD').name('PODAAC L2 Cloud Subsetter').get()[0].get('concept_id') - url = cmr.queries.CollectionQuery(mode=mode).service_concept_id(service_concept_id).provider('POCLOUD')._build_url() + url = cmr.queries.CollectionQuery(mode=mode).service_concept_id(service_concept_id)._build_url() collections_query = requests.get(url, headers=headers, params={'page_size': 2000}).json()['feed']['entry'] collections = [a.get('id') for a in collections_query] diff --git a/tests/skip/skip_spatial_ops.csv b/tests/skip/skip_spatial_ops.csv new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/skip/skip_spatial_uat.csv b/tests/skip/skip_spatial_uat.csv new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/skip/skip_temporal_ops.csv b/tests/skip/skip_temporal_ops.csv new file mode 100644 index 0000000000..d7177e14de --- /dev/null +++ b/tests/skip/skip_temporal_ops.csv @@ -0,0 +1,2 @@ +C2036882456-POCLOUD +C2205121315-POCLOUD \ No newline at end of file diff --git a/tests/skip/skip_temporal_uat.csv b/tests/skip/skip_temporal_uat.csv new file mode 100644 index 0000000000..38bbee652b --- /dev/null +++ b/tests/skip/skip_temporal_uat.csv @@ -0,0 +1,2 @@ +C1238658389-POCLOUD +C1238658392-POCLOUD \ No newline at end of file diff --git a/tests/verify_collection.py b/tests/verify_collection.py index 5eeb6f04e4..89e02bbe94 100644 --- a/tests/verify_collection.py +++ b/tests/verify_collection.py @@ -14,6 +14,7 @@ import pytest import requests import xarray +import csv from requests.auth import HTTPBasicAuth @@ -53,6 +54,25 @@ def request_session(): yield s +# Helper function to read a single CSV file and return a set of skip entries +def read_skip_list(csv_file): + with open(csv_file, newline='') as f: + reader = csv.reader(f) + return {row[0].strip() for row in reader} + + +# Fixture for the first skip list (skip_collections1.csv) +@pytest.fixture(scope="session") +def skip_temporal(env): + return read_skip_list(f"skip/skip_temporal_{env}.csv") + + +# Fixture for the second skip list (skip_collections2.csv) +@pytest.fixture(scope="session") +def skip_spatial(env): + return read_skip_list(f"skip/skip_spatial_{env}.csv") + + @pytest.fixture(scope="session") def bearer_token(env: str, request_session: requests.Session) -> str: tokens = [] @@ -367,9 +387,12 @@ def find_variable(ds, var_name): @pytest.mark.timeout(600) def test_spatial_subset(collection_concept_id, env, granule_json, collection_variables, - harmony_env, tmp_path: pathlib.Path, bearer_token): + harmony_env, tmp_path: pathlib.Path, bearer_token, skip_spatial): test_spatial_subset.__doc__ = f"Verify spatial subset for {collection_concept_id} in {env}" + if collection_concept_id in skip_spatial: + pytest.skip(f"Known collection to skip for spatial testing {collection_concept_id}") + logging.info("Using granule %s for test", granule_json['meta']['concept-id']) # Compute a box that is smaller than the granule extent bounding box @@ -523,8 +546,11 @@ def group_walk(groups, nc_d, current_group): @pytest.mark.timeout(600) def test_temporal_subset(collection_concept_id, env, granule_json, collection_variables, - harmony_env, tmp_path: pathlib.Path, bearer_token): - test_spatial_subset.__doc__ = f"Verify spatial subset for {collection_concept_id} in {env}" + harmony_env, tmp_path: pathlib.Path, bearer_token, skip_temporal): + test_spatial_subset.__doc__ = f"Verify temporal subset for {collection_concept_id} in {env}" + + if collection_concept_id in skip_temporal: + pytest.skip(f"Known collection to skip for temporal testing {collection_concept_id}") logging.info("Using granule %s for test", granule_json['meta']['concept-id'])