|
3 | 3 | # See LICENSE file for licensing details.
|
4 | 4 |
|
5 | 5 | import logging
|
6 |
| -import subprocess |
7 | 6 | from asyncio import gather
|
8 |
| -from base64 import b64encode |
9 | 7 |
|
10 | 8 | import pytest
|
11 | 9 | from pytest_operator.plugin import OpsTest
|
12 | 10 |
|
13 | 11 | from .helpers import (
|
14 | 12 | CHARM_SERIES,
|
15 |
| - get_unit_address, |
16 | 13 | scale_application,
|
17 | 14 | )
|
18 | 15 |
|
|
26 | 23 | @pytest.mark.group(1)
|
27 | 24 | @pytest.mark.abort_on_fail
|
28 | 25 | 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 |
| - } |
34 | 26 | await gather(
|
35 | 27 | ops_test.model.deploy(
|
36 | 28 | charm,
|
37 | 29 | application_name=DATABASE_APP_NAME,
|
38 | 30 | num_units=3,
|
39 | 31 | series=CHARM_SERIES,
|
40 |
| - config={"profile": "testing"}, |
41 | 32 | ),
|
42 |
| - ops_test.model.deploy("landscape-scalable"), |
43 | 33 | ops_test.model.deploy(
|
44 | 34 | UBUNTU_PRO_APP_NAME,
|
45 | 35 | 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", |
46 | 47 | num_units=0,
|
47 | 48 | ),
|
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 |
54 | 49 | )
|
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()}" |
66 | 50 |
|
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) |
73 | 52 | await ops_test.model.relate(f"{DATABASE_APP_NAME}:juju-info", f"{LS_CLIENT}:container")
|
74 | 53 | await ops_test.model.relate(
|
75 | 54 | f"{DATABASE_APP_NAME}:juju-info", f"{UBUNTU_PRO_APP_NAME}:juju-info"
|
|
0 commit comments