Skip to content

Commit

Permalink
[WIP] test: add test for entrypoint.d python script with compile true…
Browse files Browse the repository at this point in the history
… (prod)
  • Loading branch information
ap-wtioit committed Jul 4, 2022
1 parent 28b16c8 commit 6915fe6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,19 @@ def test_aggregate_permissions(self):
("autoaggregate",),
)

def test_entrypoint_python(self):
symlink_dir = join(SCAFFOLDINGS_DIR, "entrypoint")
for sub_env in matrix():
self.compose_test(
symlink_dir,
dict(sub_env, UID=str(os.getuid()), GID=str(os.getgid())),
(
"ls",
"-la",
"/opt/odoo/custom/entrypoint.d/",
),
)


if __name__ == "__main__":
unittest.main()
2 changes: 2 additions & 0 deletions tests/scaffoldings/entrypoint/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG ODOO_VERSION
FROM tecnativa/doodba:${ODOO_VERSION}-onbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import doodbalib

doodbalib.logger.info("custom entrypoint ran")
Empty file.
30 changes: 30 additions & 0 deletions tests/scaffoldings/entrypoint/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2.1"
services:
odoo:
build:
context: ./
args:
# compile causes the creation of __pycache__ in entrypoint.d for this test
COMPILE: "true"
ODOO_VERSION: $ODOO_MINOR
WITHOUT_DEMO: "false"
tty: true
depends_on:
- db
environment:
PYTHONOPTIMIZE: ""
UNACCENT: "false"
volumes:
- filestore:/var/lib/odoo:z

db:
image: postgres:${DB_VERSION}-alpine
environment:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoopassword
volumes:
- db:/var/lib/postgresql/data:z

volumes:
db:
filestore:

0 comments on commit 6915fe6

Please sign in to comment.