Open-EO / openeo-geopyspark-driver

OpenEO driver for GeoPySpark (Geotrellis)
Apache License 2.0
26 stars 4 forks source link

improve tests/deploy/test_deploy.py wrt/ jar file metadata #336

Open bossie opened 1 year ago

bossie commented 1 year ago

In the context of https://github.com/Open-EO/openeo-geotrellis-extensions/issues/109, I created a new branch for openeo-geotrellis-extensions, in which I changed the versions of its submodules to 2.3.0_2.12-spark331, as to not interfere with other (-SNAPSHOT) versions in Artifactory.

To run the tests in openeo-geopyspark-driver against these jars, I created a new branch there, in which I updated pre_test.sh. It seems, however, that there are a couple of tests in tests/deploy/test_deploy.py that run against the actual jar files that pre_test.sh downloads; they fail because the jars have versions that no longer match the expected (-SNAPSHOT) versions in the tests so I had to make the tests more lenient as well:

def test_get_jar_versions():
        paths = JAR_DIR.glob("geotrellis-*.jar")
        versions = get_jar_versions(paths)
>       assert versions == DictSubSet({
            "geotrellis-backend-assembly": RegexMatcher(r"\d+\.\d+\.\d+-openeo"),
            "geotrellis-extensions": RegexMatcher(r"\d+\.\d+.\d+_\d+\.\d+-SNAPSHOT"),
        })
E       AssertionError: assert {'geotrellis-backend-assembly': '0.4.6-openeo', 'geotrellis-extensions': '2.3.0_2.12-spark331 c292cd9'} == {'geotrellis-backend-assembly': \d+\.\d+\.\d+-openeo, 'geotrellis-extensions': \d+\.\d+.\d+_\d+\.\d+-SNAPSHOT}
E        +  where {'geotrellis-backend-assembly': \d+\.\d+\.\d+-openeo, 'geotrellis-extensions': \d+\.\d+.\d+_\d+\.\d+-SNAPSHOT} = DictSubSet({'geotrellis-backend-assembly': \d+\.\d+\.\d+-openeo, 'geotrellis-extensions': \d+\.\d+.\d+_\d+\.\d+-SNAPSHOT})

tests/deploy/test_deploy.py:87: AssertionError

Maybe we should run those tests against dedicated jar files that just contain a META-INF/MANIFEST.MF instead of the real ones. That way we're no longer tied to particular versions and we can tighten the tests again.

soxofaan commented 1 year ago

I think it's also ok to just drop the regex part about -SNAPSHOT and just check for \d+\.\d+.\d+_\d+\.\d+ which is probably tight enough