Skip to content

Commit

Permalink
test fix, limitating error
Browse files Browse the repository at this point in the history
  • Loading branch information
josep-tecnativa committed Jun 20, 2024
1 parent aa52dbb commit b91a15d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,13 @@ jobs:
- "3.10"
- 3.11
odoo-version:
- 11.0
- 12.0
- 13.0
- 14.0
- 15.0
- 16.0
include:
- python-version: "3.10"
odoo-version: 17.0
- python-version: 3.11
odoo-version: 17.0
traefik_version:
- 1
- 2
- 3
steps:
# Shared steps
Expand Down Expand Up @@ -95,7 +88,9 @@ jobs:
- run: poetry run invoke test
env:
SELECTED_ODOO_VERSIONS: ${{ matrix.odoo-version }}
TRAEFIK_VERSION: ${{ matrix.traefik_version }}
# Concurrent tests (isolated)
- run: poetry run invoke test --sequential
env:
SELECTED_ODOO_VERSIONS: ${{ matrix.odoo-version }}
TRAEFIK_VERSION: ${{ matrix.traefik_version }}
20 changes: 10 additions & 10 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ odoo_proxy:
Which proxy will you use to deploy odoo?
traefik_version:
default: 3
type: int
when: &odoo_proxy_specific "{{ odoo_proxy == 'traefik' }}"
help: >-
Indicate traefik version
choices:
- 1
- 2
- 3
traefik_version:
default: 3
type: int
when: &odoo_proxy_specific "{{ odoo_proxy == 'traefik' }}"
help: >-
Indicate traefik version
choices:
- 1
- 2
- 3

odoo_initial_lang:
default: en_US
Expand Down
32 changes: 26 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import pytest
import yaml
from packaging import version
from plumbum import ProcessExecutionError, local
from plumbum.cmd import git, invoke
from python_on_whales import DockerClient
Expand All @@ -24,6 +23,9 @@
# Different tests test different Odoo versions
OLDEST_SUPPORTED_ODOO_VERSION = 11.0
ALL_ODOO_VERSIONS = tuple(COPIER_SETTINGS["odoo_version"]["choices"])
# ALL_TRAEFIK_VERSIONS = tuple(COPIER_SETTINGS["traefik_version"]["choices"])
TRAEFIK_VERSION = os.getenv("TRAEFIK_VERSION", "3")

SUPPORTED_ODOO_VERSIONS = tuple(
v for v in ALL_ODOO_VERSIONS if v >= OLDEST_SUPPORTED_ODOO_VERSION
)
Expand Down Expand Up @@ -69,7 +71,7 @@
}

# Traefik versions matrix
ALL_TRAEFIK_VERSIONS = ("latest", "2.4", "1.7")
# ALL_TRAEFIK_VERSIONS = ("3.0", "2.4", "1.7")


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -147,13 +149,31 @@ def versionless_odoo_autoskip(request):
pytest.skip("version-independent test in old versioned odoo test session")


@pytest.fixture(params=ALL_TRAEFIK_VERSIONS)
@pytest.fixture(params=TRAEFIK_VERSION)
def traefik_host(request):
"""Fixture to indicate where to find a running traefik instance."""
docker = DockerClient()
if request.param == "latest" or version.parse(request.param) >= version.parse("2"):
if request.param == "3":
traefik_container = docker.run(
"traefik:v3.0",
detach=True,
privileged=True,
networks=["inverseproxy_shared"],
volumes=[("/var/run/docker.sock", "/var/run/docker.sock", "ro")],
command=[
"--accessLog=true",
"--entryPoints.web-alt.address=:8080",
"--entryPoints.web-insecure.address=:80",
"--entryPoints.web-main.address=:443",
"--log.level=debug",
"--providers.docker.exposedByDefault=false",
"--providers.docker.network=inverseproxy_shared",
"--providers.docker=true",
],
)
elif request.param == "2":
traefik_container = docker.run(
f"traefik:{request.param}",
"traefik:v2.4",
detach=True,
privileged=True,
networks=["inverseproxy_shared"],
Expand All @@ -171,7 +191,7 @@ def traefik_host(request):
)
else:
traefik_container = docker.run(
f"traefik:{request.param}",
"traefik:v1.7",
detach=True,
privileged=True,
networks=["inverseproxy_shared"],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def test_multiple_domains(
"project_name": uuid.uuid4().hex,
f"domains_{environment}": [
# main0 has no TLS
{"hosts": [f"main0.{base_domain}"], "cert_resolver": False},
{"cert_resolver": "false", "hosts": [f"main0.{base_domain}"]},
{
"cert_resolver": "false",
"hosts": [f"alt0.main0.{base_domain}", f"alt1.main0.{base_domain}"],
"cert_resolver": None,
"redirect_to": f"main0.{base_domain}",
},
# main1 has self-signed certificates
Expand Down

0 comments on commit b91a15d

Please sign in to comment.