|
8 | 8 | from pytest_operator.plugin import OpsTest |
9 | 9 | from tenacity import Retrying, stop_after_delay, wait_fixed |
10 | 10 |
|
11 | | -from . import markers |
12 | 11 | from .helpers import ( |
13 | 12 | DATABASE_APP_NAME, |
14 | 13 | build_and_deploy, |
|
24 | 23 | primary_changed, |
25 | 24 | run_command_on_unit, |
26 | 25 | ) |
| 26 | +from .juju_ import juju_major_version |
27 | 27 |
|
28 | 28 | logger = logging.getLogger(__name__) |
29 | 29 |
|
30 | 30 | MATTERMOST_APP_NAME = "mattermost" |
31 | | -SELF_SIGNED_CERTIFICATES_APP_NAME = "self-signed-certificates" |
32 | | -TLS_CERTIFICATES_APP_NAME = "tls-certificates-operator" |
| 31 | +if juju_major_version < 3: |
| 32 | + TLS_CERTIFICATES_APP_NAME = "tls-certificates-operator" |
| 33 | + TLS_CHANNEL = "legacy/stable" |
| 34 | + TLS_CONFIG = {"generate-self-signed-certificates": "true", "ca-common-name": "Test CA"} |
| 35 | +else: |
| 36 | + TLS_CERTIFICATES_APP_NAME = "self-signed-certificates" |
| 37 | + TLS_CHANNEL = "latest/stable" |
| 38 | + TLS_CONFIG = {"ca-common-name": "Test CA"} |
33 | 39 | APPLICATION_UNITS = 2 |
34 | 40 | DATABASE_UNITS = 3 |
35 | 41 |
|
@@ -72,9 +78,8 @@ async def test_mattermost_db(ops_test: OpsTest) -> None: |
72 | 78 | """ |
73 | 79 | async with ops_test.fast_forward(): |
74 | 80 | # Deploy TLS Certificates operator. |
75 | | - config = {"generate-self-signed-certificates": "true", "ca-common-name": "Test CA"} |
76 | 81 | await ops_test.model.deploy( |
77 | | - TLS_CERTIFICATES_APP_NAME, config=config, channel="legacy/stable" |
| 82 | + TLS_CERTIFICATES_APP_NAME, config=TLS_CONFIG, channel=TLS_CHANNEL |
78 | 83 | ) |
79 | 84 | # Relate it to the PostgreSQL to enable TLS. |
80 | 85 | await ops_test.model.relate(DATABASE_APP_NAME, TLS_CERTIFICATES_APP_NAME) |
@@ -171,20 +176,3 @@ async def test_mattermost_db(ops_test: OpsTest) -> None: |
171 | 176 | for unit in ops_test.model.applications[DATABASE_APP_NAME].units: |
172 | 177 | assert await check_tls(ops_test, unit.name, enabled=False) |
173 | 178 | assert await check_tls_patroni_api(ops_test, unit.name, enabled=False) |
174 | | - |
175 | | - |
176 | | -@markers.juju3 |
177 | | -@pytest.mark.group(1) |
178 | | -async def test_relation_with_self_signed_certificates_operator(ops_test: OpsTest) -> None: |
179 | | - """Test the relation with the Self Signed Certificates operator.""" |
180 | | - async with ops_test.fast_forward(fast_interval="60s"): |
181 | | - # Deploy Self Signed Certificates operator. |
182 | | - await ops_test.model.deploy(SELF_SIGNED_CERTIFICATES_APP_NAME) |
183 | | - # Relate it to the PostgreSQL to enable TLS. |
184 | | - await ops_test.model.relate(DATABASE_APP_NAME, SELF_SIGNED_CERTIFICATES_APP_NAME) |
185 | | - await ops_test.model.wait_for_idle(status="active", timeout=1500) |
186 | | - |
187 | | - # Wait for all units enabling TLS. |
188 | | - for unit in ops_test.model.applications[DATABASE_APP_NAME].units: |
189 | | - assert await check_tls(ops_test, unit.name, enabled=True) |
190 | | - assert await check_tls_patroni_api(ops_test, unit.name, enabled=True) |
0 commit comments