From 1a6a31cdc7a7527d9300843d5f82c6e397094191 Mon Sep 17 00:00:00 2001 From: Owen Littlejohns Date: Mon, 21 Oct 2024 16:57:51 -0400 Subject: [PATCH 1/2] net2cog - Ensure test suite does not fail for unconfigured environments. --- CHANGELOG.md | 7 +++ test/net2cog/net2cog_Regression.ipynb | 73 +++++++++++++-------------- test/net2cog/version.txt | 2 +- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35edd08..7437522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ versioning. Rather than a static releases, this repository contains of a number of regression tests that are each semi-independent. This CHANGELOG file should be used to document pull requests to this repository. +## 2024-10-21 ([#106](https://github.com/nasa/harmony-regression-tests/pull/106)) + +- Updates the net2cog regression test suite to ensure that failures do not + happen for environments against which the test suite is not configured. Prior + to this change an undefined variable was causing issues when running the test + suite against production. + ## 2024-10-16 ([#105](https://github.com/nasa/harmony-regression-tests/pull/105)) - Updates the HyBIG regression test suite to include a test specifying a variable diff --git a/test/net2cog/net2cog_Regression.ipynb b/test/net2cog/net2cog_Regression.ipynb index b2f9fa2..6d42ef1 100644 --- a/test/net2cog/net2cog_Regression.ipynb +++ b/test/net2cog/net2cog_Regression.ipynb @@ -165,7 +165,9 @@ " print(harmony_client.request_as_curl(smap_request))\n", "\n", " smap_job_id = harmony_client.submit(smap_request)\n", - " harmony_client.wait_for_processing(smap_job_id, show_progress=True)" + " harmony_client.wait_for_processing(smap_job_id, show_progress=True)\n", + "else:\n", + " print('Skipping test: net2cog is not configured for environment')" ] }, { @@ -175,35 +177,38 @@ "metadata": {}, "outputs": [], "source": [ - "with TemporaryDirectory() as temp_dir:\n", - " downloaded_cog_outputs = [\n", - " file_future.result()\n", - " for file_future in harmony_client.download_all(\n", - " smap_job_id, overwrite=True, directory=temp_dir\n", - " )\n", - " ]\n", + "if environment_information is not None:\n", + " with TemporaryDirectory() as temp_dir:\n", + " downloaded_cog_outputs = [\n", + " file_future.result()\n", + " for file_future in harmony_client.download_all(\n", + " smap_job_id, overwrite=True, directory=temp_dir\n", + " )\n", + " ]\n", "\n", - " for cog_file in downloaded_cog_outputs:\n", - " utility.validate_cog(cog_file)\n", + " for cog_file in downloaded_cog_outputs:\n", + " utility.validate_cog(cog_file)\n", "\n", - " expected_metadata = {\n", - " 'driver': 'GTiff',\n", - " 'dtype': 'float32',\n", - " 'nodata': -9999.0,\n", - " 'width': 1440,\n", - " 'height': 720,\n", - " 'count': 1,\n", - " 'crs': CRS.from_epsg(4326),\n", - " 'transform': Affine(0.25, 0.0, 0.0, 0.0, 0.25, -90.0),\n", - " }\n", - " reference_file = Path(\n", - " './reference_data',\n", - " 'RSS_smap_SSS_L3_8day_running_2020_005_FNL_v04.0_converted_sss_smap.tiff',\n", - " )\n", + " expected_metadata = {\n", + " 'driver': 'GTiff',\n", + " 'dtype': 'float32',\n", + " 'nodata': -9999.0,\n", + " 'width': 1440,\n", + " 'height': 720,\n", + " 'count': 1,\n", + " 'crs': CRS.from_epsg(4326),\n", + " 'transform': Affine(0.25, 0.0, 0.0, 0.0, 0.25, -90.0),\n", + " }\n", + " reference_file = Path(\n", + " './reference_data',\n", + " 'RSS_smap_SSS_L3_8day_running_2020_005_FNL_v04.0_converted_sss_smap.tiff',\n", + " )\n", "\n", - " utility.assert_dataset_produced_correct_results(\n", - " cog_file, expected_metadata, reference_file\n", - " )" + " utility.assert_dataset_produced_correct_results(\n", + " cog_file, expected_metadata, reference_file\n", + " )\n", + "else:\n", + " print('Skipping verification: net2cog is not configured for this environment')" ] }, { @@ -249,16 +254,10 @@ " assert (\n", " raised_expected_error\n", " ), 'Expected request to raise an exception but it did not.'\n", - " utility.print_success('All variables raised expected error')" + " utility.print_success('All variables raised expected error')\n", + "else:\n", + " print('Skipping test: net2cog is not configured for environment')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a0caf714", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -278,7 +277,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.15" } }, "nbformat": 4, diff --git a/test/net2cog/version.txt b/test/net2cog/version.txt index 17e51c3..d917d3e 100644 --- a/test/net2cog/version.txt +++ b/test/net2cog/version.txt @@ -1 +1 @@ -0.1.1 +0.1.2 From 1bf67db069e2b22b221edd4a444f5d549ce2abdd Mon Sep 17 00:00:00 2001 From: Owen Littlejohns Date: Mon, 21 Oct 2024 17:10:09 -0400 Subject: [PATCH 2/2] net2cog - Fix PR reference in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7437522..3e31a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ versioning. Rather than a static releases, this repository contains of a number of regression tests that are each semi-independent. This CHANGELOG file should be used to document pull requests to this repository. -## 2024-10-21 ([#106](https://github.com/nasa/harmony-regression-tests/pull/106)) +## 2024-10-21 ([#107](https://github.com/nasa/harmony-regression-tests/pull/107)) - Updates the net2cog regression test suite to ensure that failures do not happen for environments against which the test suite is not configured. Prior