12
12
import yaml
13
13
from pytest_operator .plugin import OpsTest
14
14
15
- from . import juju_
15
+ from . import architecture , juju_ , markers
16
16
from .helpers import (
17
17
APPLICATION_DEFAULT_APP_NAME ,
18
18
MYSQL_DEFAULT_APP_NAME ,
33
33
RETRY_TIMEOUT = 3 * 60
34
34
35
35
if juju_ .is_3_or_higher :
36
- TLS_APP_NAME = "self-signed-certificates"
37
- TLS_CONFIG = {"ca-common-name" : "Test CA" }
36
+ tls_app_name = "self-signed-certificates"
37
+ if architecture .architecture == "arm64" :
38
+ tls_channel = "latest/edge"
39
+ else :
40
+ tls_channel = "latest/stable"
41
+ tls_config = {"ca-common-name" : "Test CA" }
38
42
else :
39
- TLS_APP_NAME = "tls-certificates-operator"
40
- TLS_CONFIG = {"generate-self-signed-certificates" : "true" , "ca-common-name" : "Test CA" }
43
+ tls_app_name = "tls-certificates-operator"
44
+ if architecture .architecture == "arm64" :
45
+ tls_channel = "legacy/edge"
46
+ else :
47
+ tls_channel = "legacy/stable"
48
+ tls_config = {"generate-self-signed-certificates" : "true" , "ca-common-name" : "Test CA" }
41
49
42
50
43
51
@pytest .mark .group (1 )
52
+ # TODO: remove amd64_only after these issues fixed:
53
+ # https://github.com/canonical/mysql-router-k8s-operator/issues/282
54
+ # https://github.com/canonical/grafana-agent-k8s-operator/issues/309
55
+ @markers .amd64_only
44
56
@pytest .mark .abort_on_fail
45
57
async def test_exporter_endpoint (ops_test : OpsTest ) -> None :
46
58
"""Test that the exporter endpoint works when related with TLS"""
@@ -125,21 +137,21 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
125
137
"Issuer: CN = MySQL_Router_Auto_Generated_CA_Certificate" in issuer
126
138
), "Expected mysqlrouter autogenerated certificate"
127
139
128
- logger .info (f"Deploying { TLS_APP_NAME } " )
140
+ logger .info (f"Deploying { tls_app_name } " )
129
141
await ops_test .model .deploy (
130
- TLS_APP_NAME ,
131
- application_name = TLS_APP_NAME ,
132
- channel = "stable" ,
133
- config = TLS_CONFIG ,
142
+ tls_app_name ,
143
+ application_name = tls_app_name ,
144
+ channel = tls_channel ,
145
+ config = tls_config ,
134
146
series = "jammy" ,
135
147
)
136
148
137
- await ops_test .model .wait_for_idle ([TLS_APP_NAME ], status = "active" , timeout = SLOW_TIMEOUT )
149
+ await ops_test .model .wait_for_idle ([tls_app_name ], status = "active" , timeout = SLOW_TIMEOUT )
138
150
139
- logger .info (f"Relating mysqlrouter with { TLS_APP_NAME } " )
151
+ logger .info (f"Relating mysqlrouter with { tls_app_name } " )
140
152
141
153
await ops_test .model .relate (
142
- f"{ MYSQL_ROUTER_APP_NAME } :certificates" , f"{ TLS_APP_NAME } :certificates"
154
+ f"{ MYSQL_ROUTER_APP_NAME } :certificates" , f"{ tls_app_name } :certificates"
143
155
)
144
156
145
157
unit_address = await get_unit_address (ops_test , mysql_router_app .units [0 ].name )
@@ -198,7 +210,7 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
198
210
)
199
211
assert (
200
212
"CN = Test CA" in issuer
201
- ), f"Expected mysqlrouter certificate from { TLS_APP_NAME } "
213
+ ), f"Expected mysqlrouter certificate from { tls_app_name } "
202
214
203
215
logger .info ("Removing relation between mysqlrouter and grafana agent" )
204
216
await mysql_router_app .remove_relation (
@@ -220,9 +232,9 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
220
232
else :
221
233
assert False , "❌ can connect to metrics endpoint without relation with cos"
222
234
223
- logger .info (f"Removing relation between mysqlrouter and { TLS_APP_NAME } " )
235
+ logger .info (f"Removing relation between mysqlrouter and { tls_app_name } " )
224
236
await mysql_router_app .remove_relation (
225
- f"{ MYSQL_ROUTER_APP_NAME } :certificates" , f"{ TLS_APP_NAME } :certificates"
237
+ f"{ MYSQL_ROUTER_APP_NAME } :certificates" , f"{ tls_app_name } :certificates"
226
238
)
227
239
228
240
for attempt in tenacity .Retrying (
0 commit comments