Skip to content

Commit 9a31397

Browse files
committed
fix: add-model issue
1 parent 9730b2d commit 9a31397

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

tests/integration/terraform/conftest.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,20 @@ def deploy_cluster(
9191
terraform_deployer.cleanup()
9292

9393
config = get_terraform_config(split_mode=(kraft_mode == "multi"))
94-
config["ingress_offer"] = ingress_offer
94+
config["ingress_offer"] = ingress_offer.split(":")[-1] # Remove the controller: prefix
9595
tfvars_file = terraform_deployer.create_tfvars(config)
9696

9797
terraform_deployer.terraform_init()
9898
terraform_deployer.terraform_apply(tfvars_file)
9999

100100

101101
@pytest.fixture()
102-
def enable_terraform_tls(juju: jubilant.Juju, model_uuid: str, kraft_mode):
102+
def enable_terraform_tls(model_uuid: str, kraft_mode: KRaftMode):
103103
"""Deploy a tls endpoint and update terraform."""
104-
jubilant.Juju().add_model(model=CORE_MODEL_NAME)
105-
tls_model = jubilant.Juju(model=CORE_MODEL_NAME)
106-
tls_model.deploy(CERTIFICATES_APP_NAME, config={"ca-common-name": "test-ca"}, channel="stable")
107-
tls_model.wait(
108-
lambda status: all_active_idle(status, CERTIFICATES_APP_NAME),
109-
delay=5,
110-
successes=5,
111-
timeout=600,
112-
)
113-
tls_model.offer(f"{CORE_MODEL_NAME}.{CERTIFICATES_APP_NAME}", endpoint="certificates")
104+
core_juju = jubilant.Juju(model=CORE_MODEL_NAME)
114105

115106
# Store the CA cert for requests
116-
result = tls_model.run(f"{CERTIFICATES_APP_NAME}/0", "get-ca-certificate")
107+
result = core_juju.run(f"{CERTIFICATES_APP_NAME}/0", "get-ca-certificate")
117108
ca = result.results.get("ca-certificate")
118109
open(CA_FILE, "w").write(ca)
119110

tests/integration/terraform/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def cleanup(self):
170170

171171

172172
def deploy_core_apps(deploy_ingress: bool = True) -> None:
173+
jubilant.Juju().add_model(model=CORE_MODEL_NAME)
173174
core_juju = jubilant.Juju(model=CORE_MODEL_NAME)
174175
core_juju.deploy(
175176
CERTIFICATES_APP_NAME, config={"ca-common-name": "test-ca"}, channel="1/stable"

0 commit comments

Comments
 (0)