Skip to content

Commit

Permalink
Switch to Saas landscape
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirp committed Apr 11, 2024
1 parent 8fea63a commit 24f2896
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
fail-fast: false
matrix:
juju:
- agent: 2.9.46 # renovate: latest juju 2
- agent: 2.9.49 # renovate: latest juju 2
libjuju: ==2.9.46.1 # renovate: latest libjuju 2
allure: false
- agent: 3.1.7 # renovate: latest juju 3
Expand All @@ -76,6 +76,8 @@ jobs:
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
"UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}",
"LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}",
"LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}",
}
permissions:
contents: write # Needed for Allure Report beta
45 changes: 12 additions & 33 deletions tests/integration/test_subordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
# See LICENSE file for licensing details.

import logging
import subprocess
from asyncio import gather
from base64 import b64encode

import pytest
from pytest_operator.plugin import OpsTest

from .helpers import (
CHARM_SERIES,
get_unit_address,
scale_application,
)

Expand All @@ -26,50 +23,32 @@
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_deploy(ops_test: OpsTest, charm: str, github_secrets):
landscape_config = {
"admin_email": "[email protected]",
"admin_name": "Admin",
"admin_password": "qweqwepoipoi",
}
await gather(
ops_test.model.deploy(
charm,
application_name=DATABASE_APP_NAME,
num_units=3,
series=CHARM_SERIES,
config={"profile": "testing"},
),
ops_test.model.deploy("landscape-scalable"),
ops_test.model.deploy(
UBUNTU_PRO_APP_NAME,
config={"token": github_secrets["UBUNTU_PRO_TOKEN"]},
channel="latest/edge",
num_units=0,
),
ops_test.model.deploy(
LS_CLIENT,
config={
"account-name": github_secrets["LANDSCAPE_ACCOUNT_NAME"],
"registration-key": github_secrets["LANDSCAPE_REGISTRATION_KEY"],
"ppa": "ppa:landscape/self-hosted-beta",
},
channel="latest/edge",
num_units=0,
),
ops_test.model.deploy(LS_CLIENT, num_units=0),
)
await ops_test.model.applications["landscape-server"].set_config(landscape_config)

await ops_test.model.wait_for_idle(
apps=["landscape-server", "haproxy", DATABASE_APP_NAME], status="active", timeout=3000
)
haproxy_unit = ops_test.model.applications["haproxy"].units[0]
haproxy_addr = get_unit_address(ops_test, haproxy_unit.name)
haproxy_host = haproxy_unit.machine.hostname
cert = subprocess.check_output([
"lxc",
"exec",
haproxy_host,
"cat",
"/var/lib/haproxy/selfsigned_ca.crt",
])
ssl_public_key = f"base64:{b64encode(cert).decode()}"

await ops_test.model.applications[LS_CLIENT].set_config({
"account-name": "standalone",
"ping-url": f"http://{haproxy_addr}/ping",
"url": f"https://{haproxy_addr}/message-system",
"ssl-public-key": ssl_public_key,
})
await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=2000)
await ops_test.model.relate(f"{DATABASE_APP_NAME}:juju-info", f"{LS_CLIENT}:container")
await ops_test.model.relate(
f"{DATABASE_APP_NAME}:juju-info", f"{UBUNTU_PRO_APP_NAME}:juju-info"
Expand Down

0 comments on commit 24f2896

Please sign in to comment.