diff --git a/.github/workflows/test-migrations.yml b/.github/workflows/test.yml similarity index 83% rename from .github/workflows/test-migrations.yml rename to .github/workflows/test.yml index 7e749ca5..e40a244d 100644 --- a/.github/workflows/test-migrations.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,16 @@ jobs: - name: Healthcheck run: wget --no-check-certificate https://localhost/oapif/collections/signalo_core.pole/items + - name: Run conformance test suite + run: docker compose -f docker-compose.tests.yml up --build conformance_test + + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: emailable-report + path: | + ./_test_outputs/**/emailable-report.html + - name: Failure logs if: failure() run: docker-compose logs diff --git a/.gitignore b/.gitignore index 423fb5d0..9846211a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __pycache__ static media +_test_outputs diff --git a/README.md b/README.md index 466dbf3a..aef71fb9 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,13 @@ Once up and running, you can use it from QGIS like this: - Version: `OGC API - Features` - Click OK and ignore choose to ignore the invalid certificate error and store the exception - You should see the two layers in the list, select them and choose `add`. + +## Run tests + +You can run the OGC API conformance test suite like this: + +``` +docker compose -f docker-compose.tests.yml up --build conformance_test +``` + +Results will be stored to `_test_outputs\testng\...\emailable-report.html diff --git a/conformance-tests/Dockerfile b/conformance-tests/Dockerfile new file mode 100644 index 00000000..87e2f3f7 --- /dev/null +++ b/conformance-tests/Dockerfile @@ -0,0 +1,35 @@ +# Courtesy of https://github.com/opengeospatial/ets-ogcapi-features10/issues/197 + +FROM maven:3.8-openjdk-18 + +# Copy actual source files +ARG VERSION=1.4 +RUN git clone --depth 1 --branch ${VERSION} https://github.com/opengeospatial/ets-ogcapi-features10.git /build + +WORKDIR /build/ + +# COPY pom.xml . # checkedout already + +RUN mvn --version + +# Pre-download all dependencies to increase caching in docker builds +RUN mvn dependency:resolve dependency:resolve-plugins dependency:copy-dependencies dependency:go-offline -Pdocker + +# Copy actual source files +# COPY ./src ./src # checkedout already + +# Install offline to avoid triggering new dependency update +RUN mvn install -DskipTests -Dmaven.javadoc.skip + +# TODO: Should get the version from build context +# ARG VERSION=1.5-SNAPSHOT # done above +ARG OUTPUT_DIR=/build/run/output +ARG TEST_RUN_PROPS=/build/run/test-run-props.xml + +ENV VERSION=${VERSION} +ENV OUTPUT_DIR=${OUTPUT_DIR} +ENV TEST_RUN_PROPS=${TEST_RUN_PROPS} + +ADD ./test-run-props.xml /build/run/test-run-props.xml + +CMD ["sh", "-c", "java -jar /build/target/ets-ogcapi-features10-${VERSION}-aio.jar -o ${OUTPUT_DIR} -h true ${TEST_RUN_PROPS}"] diff --git a/conformance-tests/test-run-props.xml b/conformance-tests/test-run-props.xml new file mode 100644 index 00000000..35888b8a --- /dev/null +++ b/conformance-tests/test-run-props.xml @@ -0,0 +1,6 @@ + + + + Test run arguments + http://django:8000/oapif/ + diff --git a/docker-compose.tests.yml b/docker-compose.tests.yml new file mode 100644 index 00000000..714f17c1 --- /dev/null +++ b/docker-compose.tests.yml @@ -0,0 +1,7 @@ +services: + + conformance_test: + build: ./conformance-tests + volumes: + - ./_test_outputs:/build/run/output + # - .:/build/run/test-run-props.xml diff --git a/src/signalo/settings.py b/src/signalo/settings.py index 0877d3f8..5a43a37b 100644 --- a/src/signalo/settings.py +++ b/src/signalo/settings.py @@ -26,7 +26,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ["localhost"] +ALLOWED_HOSTS = ["localhost", "django"] # Application definition