Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MISC] Switch to Saas landscape #204

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
fail-fast: false
matrix:
juju:
- agent: 2.9.47 # 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 @@ -75,4 +75,6 @@ jobs:
integration-test: |
{
"UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}",
"LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}",
"LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}",
}
49 changes: 15 additions & 34 deletions tests/integration/test_subordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
# 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
Expand All @@ -15,12 +13,11 @@
from .helpers.helpers import (
CLIENT_APP_NAME,
FIRST_DATABASE_RELATION_NAME,
PG,
PGB,
scale_application,
)
from .helpers.postgresql_helpers import get_unit_address

PG = "pg"
LS_CLIENT = "landscape-client"
UBUNTU_PRO_APP_NAME = "ubuntu-advantage"

Expand All @@ -30,64 +27,48 @@
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_deploy(ops_test: OpsTest, pgb_charm_jammy, github_secrets):
landscape_config = {
"admin_email": "[email protected]",
"admin_name": "Admin",
"admin_password": "qweqwepoipoi",
}
await gather(
ops_test.model.deploy(
pgb_charm_jammy,
application_name=PGB,
num_units=None,
),
ops_test.model.deploy(
"postgresql",
application_name=PG,
PG,
num_units=3,
channel="14/edge",
config={"profile": "testing"},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching to prod profile

),
ops_test.model.deploy(
CLIENT_APP_NAME,
num_units=3,
channel="latest/edge",
),
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",
marceloneppel marked this conversation as resolved.
Show resolved Hide resolved
},
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.add_relation(f"{PGB}:{BACKEND_RELATION_NAME}", f"{PG}:database")
await ops_test.model.add_relation(f"{CLIENT_APP_NAME}:{FIRST_DATABASE_RELATION_NAME}", PGB)

await ops_test.model.wait_for_idle(
apps=["landscape-server", "haproxy", CLIENT_APP_NAME, PG, PGB],
apps=[CLIENT_APP_NAME, PG, PGB],
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.relate(f"{CLIENT_APP_NAME}:juju-info", f"{LS_CLIENT}:container")
await ops_test.model.relate(f"{CLIENT_APP_NAME}:juju-info", f"{UBUNTU_PRO_APP_NAME}:juju-info")
await ops_test.model.relate(f"{PG}:juju-info", f"{LS_CLIENT}:container")
Expand Down
Loading