diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a0e250178aef8b109ff21c96c40f25393e97e15..6797e8f509a57c5af6a13686f4ae8037cbec5a4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,7 @@ docker_build_and_release_tests: - if: '$CI_COMMIT_BRANCH != "master"' when: never - changes: + - test/Dockerfile - test/**/* .deploy_template: @@ -91,6 +92,10 @@ docker_build_and_release_tests: - with-ssh-key env TESTDATA_DIR=$BUILD_DIR/testdata $BUILD_DIR/float/test-driver test $BUILD_DIR $PWD/playbooks/ai3-test.yml tags: [ai3] retry: 2 + artifacts: + when: always + reports: + junit: ai3test.xml environment: name: review/$VMINE_TAG/$CI_COMMIT_REF_SLUG action: verify diff --git a/playbooks/ai3-test.yml b/playbooks/ai3-test.yml index 7ff6540884d19493257860a3105cf918ef313bc1..bedef537304f23592339e30ec8a0b2b93ed86f10 100644 --- a/playbooks/ai3-test.yml +++ b/playbooks/ai3-test.yml @@ -9,10 +9,31 @@ dest: /tmp/test-config.yml content: "{{ vars|to_nice_yaml }}" - - name: Setup test Docker image - command: "float-pull-image registry.git.autistici.org/ai3/config:integration-test" + - name: Create test artifact directory + file: + path: "/artifacts" + state: directory + mode: "01777" + + - name: Pull the test suite container image + command: "float-pull-image {{ test_image }}" register: test_container_image failed_when: "test_container_image.rc not in [0, 42]" - name: Run tests - command: "docker run --rm --net host --mount type=bind,source=/tmp/test-config.yml,destination=/test-config.yml registry.git.autistici.org/ai3/config:integration-test" + command: "podman run --rm --net host --mount type=bind,source=/tmp/test-config.yml,destination=/test-config.yml --mount type=bind,source=/artifacts,destination=/artifacts {{ test_image }}" + + - name: Retrieve test result + slurp: + src: "/artifacts/ai3test.xml" + register: ai3test_xml + + - name: Store test results locally + local_action: + module: copy + dest: "ai3test.xml" + content: "{{ ai3test_xml['content'] | b64decode }}" + + vars: + test_image: "registry.git.autistici.org/ai3/config:integration-test" + diff --git a/test/Dockerfile b/test/Dockerfile index e615d056d98b4753f2b99154268af66367001a78..89c135f55e8edaafaa79c2da69614781e8be2a6f 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -6,4 +6,4 @@ RUN python3 setup.py install ENV TEST_CONFIG=/test-config.yml ENV PYTHONPATH=/src -CMD ["nosetests3", "-v", "ai3test"] +CMD ["pytest", "-v", "--junitxml=/artifacts/ai3test.xml", "ai3test"]