Skip to content

Commit 3184541

Browse files
authored
[MISC] Switch to SaaS landscape (#435)
* Switch to Saas landscape * Set per device priority
1 parent 8fea63a commit 3184541

File tree

3 files changed

+17
-36
lines changed

3 files changed

+17
-36
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
fail-fast: false
5252
matrix:
5353
juju:
54-
- agent: 2.9.46 # renovate: latest juju 2
54+
- agent: 2.9.49 # renovate: latest juju 2
5555
libjuju: ==2.9.46.1 # renovate: latest libjuju 2
5656
allure: false
5757
- agent: 3.1.7 # renovate: latest juju 3
@@ -76,6 +76,8 @@ jobs:
7676
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
7777
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
7878
"UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}",
79+
"LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}",
80+
"LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}",
7981
}
8082
permissions:
8183
contents: write # Needed for Allure Report beta

tests/integration/ha_tests/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def cut_network_from_unit_without_ip_change(machine_name: str) -> None:
288288
subprocess.check_call(limit_set_command.split())
289289
limit_set_command = f"lxc config device set {machine_name} eth0 limits.ingress=1kbit"
290290
subprocess.check_call(limit_set_command.split())
291-
limit_set_command = f"lxc config set {machine_name} limits.network.priority=10"
291+
limit_set_command = f"lxc config device set {machine_name} eth0 limits.priority=10"
292292
subprocess.check_call(limit_set_command.split())
293293

294294

@@ -627,7 +627,7 @@ def restore_network_for_unit_without_ip_change(machine_name: str) -> None:
627627
subprocess.check_call(limit_set_command.split())
628628
limit_set_command = f"lxc config device set {machine_name} eth0 limits.ingress="
629629
subprocess.check_call(limit_set_command.split())
630-
limit_set_command = f"lxc config set {machine_name} limits.network.priority="
630+
limit_set_command = f"lxc config device set {machine_name} eth0 limits.priority="
631631
subprocess.check_call(limit_set_command.split())
632632

633633

tests/integration/test_subordinates.py

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
# See LICENSE file for licensing details.
44

55
import logging
6-
import subprocess
76
from asyncio import gather
8-
from base64 import b64encode
97

108
import pytest
119
from pytest_operator.plugin import OpsTest
1210

1311
from .helpers import (
1412
CHARM_SERIES,
15-
get_unit_address,
1613
scale_application,
1714
)
1815

@@ -26,50 +23,32 @@
2623
@pytest.mark.group(1)
2724
@pytest.mark.abort_on_fail
2825
async def test_deploy(ops_test: OpsTest, charm: str, github_secrets):
29-
landscape_config = {
30-
"admin_email": "[email protected]",
31-
"admin_name": "Admin",
32-
"admin_password": "qweqwepoipoi",
33-
}
3426
await gather(
3527
ops_test.model.deploy(
3628
charm,
3729
application_name=DATABASE_APP_NAME,
3830
num_units=3,
3931
series=CHARM_SERIES,
40-
config={"profile": "testing"},
4132
),
42-
ops_test.model.deploy("landscape-scalable"),
4333
ops_test.model.deploy(
4434
UBUNTU_PRO_APP_NAME,
4535
config={"token": github_secrets["UBUNTU_PRO_TOKEN"]},
36+
channel="latest/edge",
37+
num_units=0,
38+
),
39+
ops_test.model.deploy(
40+
LS_CLIENT,
41+
config={
42+
"account-name": github_secrets["LANDSCAPE_ACCOUNT_NAME"],
43+
"registration-key": github_secrets["LANDSCAPE_REGISTRATION_KEY"],
44+
"ppa": "ppa:landscape/self-hosted-beta",
45+
},
46+
channel="latest/edge",
4647
num_units=0,
4748
),
48-
ops_test.model.deploy(LS_CLIENT, num_units=0),
49-
)
50-
await ops_test.model.applications["landscape-server"].set_config(landscape_config)
51-
52-
await ops_test.model.wait_for_idle(
53-
apps=["landscape-server", "haproxy", DATABASE_APP_NAME], status="active", timeout=3000
5449
)
55-
haproxy_unit = ops_test.model.applications["haproxy"].units[0]
56-
haproxy_addr = get_unit_address(ops_test, haproxy_unit.name)
57-
haproxy_host = haproxy_unit.machine.hostname
58-
cert = subprocess.check_output([
59-
"lxc",
60-
"exec",
61-
haproxy_host,
62-
"cat",
63-
"/var/lib/haproxy/selfsigned_ca.crt",
64-
])
65-
ssl_public_key = f"base64:{b64encode(cert).decode()}"
6650

67-
await ops_test.model.applications[LS_CLIENT].set_config({
68-
"account-name": "standalone",
69-
"ping-url": f"http://{haproxy_addr}/ping",
70-
"url": f"https://{haproxy_addr}/message-system",
71-
"ssl-public-key": ssl_public_key,
72-
})
51+
await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=2000)
7352
await ops_test.model.relate(f"{DATABASE_APP_NAME}:juju-info", f"{LS_CLIENT}:container")
7453
await ops_test.model.relate(
7554
f"{DATABASE_APP_NAME}:juju-info", f"{UBUNTU_PRO_APP_NAME}:juju-info"

0 commit comments

Comments
 (0)