From 6233a7fad4571ac08e2f8fc04ca8461a91e9133b Mon Sep 17 00:00:00 2001 From: Andreas Perhab Date: Tue, 5 Mar 2024 11:16:43 +0100 Subject: [PATCH] [IMP] tests: add test for screencast and verify artifacts are stored --- tests/__init__.py | 41 +++++++++++++++++++ tests/scaffoldings/test_artifacts/Dockerfile | 2 + .../test_artifacts/custom/src/addons.yaml | 0 .../test_artifacts/docker-compose.yaml | 33 +++++++++++++++ .../test_artifacts/test-artifacts/.gitkeep | 0 5 files changed, 76 insertions(+) create mode 100644 tests/scaffoldings/test_artifacts/Dockerfile create mode 100644 tests/scaffoldings/test_artifacts/custom/src/addons.yaml create mode 100644 tests/scaffoldings/test_artifacts/docker-compose.yaml create mode 100644 tests/scaffoldings/test_artifacts/test-artifacts/.gitkeep diff --git a/tests/__init__.py b/tests/__init__.py index 684288ea..3b90f172 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -769,6 +769,47 @@ def test_entrypoint_python(self): ), ) + def test_screencasts(self): + test_artifacts_dir = join(SCAFFOLDINGS_DIR, "test_artifacts") + for sub_env in matrix(odoo_skip={"11.0", "12.0", "13.0", "14.0"}): + self.compose_test( + test_artifacts_dir, + dict(sub_env, UID=str(os.getuid()), GID=str(os.getgid())), + # remove artifacts from previous tests + ( + "find", + "/opt/odoo/auto/test-artifacts", + "-type", + "f", + "-exec", + "rm", + "-v", + "{}", + ";", + ), + # install odoo base module + ( + "odoo", + "-i", + "base", + "--stop-after-init", + ), + # run odoo test for screencast + ( + "odoo", + "--test-tags", + ".test_screencasts", + "--stop-after-init", + ), + # verify screencast is saved in container + ( + "grep", + "-Rl", + ".", + "/opt/odoo/auto/test-artifacts", + ), + ) + if __name__ == "__main__": unittest.main() diff --git a/tests/scaffoldings/test_artifacts/Dockerfile b/tests/scaffoldings/test_artifacts/Dockerfile new file mode 100644 index 00000000..4916c47a --- /dev/null +++ b/tests/scaffoldings/test_artifacts/Dockerfile @@ -0,0 +1,2 @@ +ARG ODOO_VERSION +FROM tecnativa/doodba:${ODOO_VERSION}-onbuild diff --git a/tests/scaffoldings/test_artifacts/custom/src/addons.yaml b/tests/scaffoldings/test_artifacts/custom/src/addons.yaml new file mode 100644 index 00000000..e69de29b diff --git a/tests/scaffoldings/test_artifacts/docker-compose.yaml b/tests/scaffoldings/test_artifacts/docker-compose.yaml new file mode 100644 index 00000000..f228b913 --- /dev/null +++ b/tests/scaffoldings/test_artifacts/docker-compose.yaml @@ -0,0 +1,33 @@ +version: "2.1" +services: + odoo: + build: + context: ./ + args: + COMPILE: "false" + ODOO_VERSION: $ODOO_MINOR + WITHOUT_DEMO: "false" + # enable creating test artifact directories with correct permissions + UID: "${UID:-1000}" + GID: "${GID:-1000}" + tty: true + depends_on: + - db + environment: + PYTHONOPTIMIZE: "" + UNACCENT: "false" + volumes: + - filestore:/var/lib/odoo:z + - ./test-artifacts:/opt/odoo/auto/test-artifacts:z + + db: + image: postgres:${DB_VERSION}-alpine + environment: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoopassword + volumes: + - db:/var/lib/postgresql/data:z + +volumes: + db: + filestore: diff --git a/tests/scaffoldings/test_artifacts/test-artifacts/.gitkeep b/tests/scaffoldings/test_artifacts/test-artifacts/.gitkeep new file mode 100644 index 00000000..e69de29b