Skip to content

Commit 5a713d6

Browse files
committed
Fix deploy bundle tests
It turns out a number of our test bundles were invalid, something only caught out by stricter param validating by juju controllers in 2.9.47 Fix these bundles + overlays to be valid
1 parent 0d1d0a8 commit 5a713d6

6 files changed

Lines changed: 37 additions & 53 deletions

File tree

tests/bundle/bundle.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
series: jammy
22
applications:
3-
grafana:
4-
charm: "grafana"
5-
channel: stable
6-
num_units: 1
7-
prometheus:
8-
charm: "prometheus"
9-
channel: stable
3+
juju-qa-test:
4+
charm: "juju-qa-test"
105
num_units: 1
6+
nrpe:
7+
charm: "nrpe"
118
relations:
12-
- ["prometheus:grafana-source", "grafana:grafana-source"]
9+
- ["nrpe:general-info", "juju-qa-test:juju-info"]

tests/bundle/mini-bundle.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
series: jammy
22
applications:
3-
grafana:
4-
charm: "grafana"
5-
channel: stable
6-
num_units: 1
7-
prometheus:
8-
charm: "prometheus"
9-
channel: stable
3+
juju-qa-test:
4+
charm: "juju-qa-test"
105
num_units: 1
6+
nrpe:
7+
charm: "nrpe"
118
relations:
12-
- ["prometheus:grafana-source", "grafana:grafana-source"]
9+
- ["nrpe:general-info", "juju-qa-test:juju-info"]
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
series: jammy
22
applications:
3-
grafana:
4-
charm: "grafana"
5-
channel: stable
6-
num_units: 1
7-
prometheus:
8-
charm: "prometheus"
9-
channel: stable
3+
juju-qa-test:
4+
charm: "juju-qa-test"
105
num_units: 1
6+
nrpe:
7+
charm: "nrpe"
118
test:
129
charm: "./tests/integration/charm"
1310
relations:
14-
- ["prometheus:grafana-source", "grafana:grafana-source"]
11+
- ["nrpe:general-info", "juju-qa-test:juju-info"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description: An overlay for test multi-overlay
22
applications:
3-
ntp:
3+
nrpe:
44
memcached:
55
charm: "memcached"
66
channel: stable
@@ -10,6 +10,6 @@ description: Another overlay for test multi-overlay
1010
applications:
1111
memcached:
1212
mysql:
13-
charm: "prometheus"
14-
channel: stable
15-
num_units: 1
13+
charm: "mysql"
14+
channel: candidate
15+
num_units: 1
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
description: An overlay for tests
22
applications:
3-
ntp:
4-
ghost:
5-
charm: "prometheus"
6-
channel: stable
7-
num_units: 1
3+
nrpe:
84
mysql:
9-
charm: "prometheus"
10-
channel: stable
11-
num_units: 1
5+
charm: "mysql"
6+
channel: candidate
7+
num_units: 1

tests/integration/test_model.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ async def test_deploy_local_bundle_dir():
4545
async with base.CleanModel() as model:
4646
await model.deploy(str(bundle_path))
4747

48-
app1 = model.applications.get('grafana')
49-
app2 = model.applications.get('prometheus')
48+
app1 = model.applications.get('juju-qa-test')
49+
app2 = model.applications.get('nrpe')
5050
with open("/tmp/output", "w") as writer:
5151
writer.write(str(bundle_path) + "\n")
5252
for (k, v) in model.applications.items():
@@ -66,8 +66,8 @@ async def test_deploy_local_bundle_file():
6666
async with base.CleanModel() as model:
6767
await model.deploy(str(mini_bundle_file_path))
6868

69-
app1 = model.applications.get('grafana')
70-
app2 = model.applications.get('prometheus')
69+
app1 = model.applications.get('juju-qa-test')
70+
app2 = model.applications.get('nrpe')
7171
assert app1 and app2
7272
await model.block_until(lambda: (len(app1.units) == 1 and
7373
len(app2.units) == 1),
@@ -272,27 +272,21 @@ async def test_deploy_local_bundle_with_overlay_multi():
272272
# this bundle deploys mysql and ghost apps and relates them,
273273
# but the overlay attached removes ghost, so
274274
assert 'mysql' in model.applications
275-
assert 'ghost' not in model.applications
276275

277276

278277
@base.bootstrapped
279278
@pytest.mark.asyncio
280279
async def test_deploy_bundle_with_overlay_as_argument():
281280
async with base.CleanModel() as model:
282281
overlay_path = OVERLAYS_DIR / 'test-overlay.yaml'
282+
bundle_path = TESTS_DIR / "bundle" / "bundle.yaml"
283283

284-
await model.deploy('juju-qa-bundle-test', overlays=[overlay_path])
285-
# juju-qa-bundle-test installs the applications
286-
# - juju-qa-test
287-
# - juju-qa-test-focal
288-
# - ntp
289-
# - ntp-focal
284+
await model.deploy(bundle_path, overlays=[overlay_path])
290285

291-
# our overlay requests to remove ntp and add ghost and mysql
286+
# our overlay requests to remove ntp and add mysql
292287
# and relate them, so
293288
assert 'juju-qa-test' in model.applications
294-
assert 'ntp' not in model.applications
295-
assert 'ghost' in model.applications
289+
assert 'nrpe' not in model.applications
296290
assert 'mysql' in model.applications
297291

298292

@@ -301,9 +295,12 @@ async def test_deploy_bundle_with_overlay_as_argument():
301295
async def test_deploy_bundle_with_multi_overlay_as_argument():
302296
async with base.CleanModel() as model:
303297
overlay_path = OVERLAYS_DIR / 'test-multi-overlay.yaml'
298+
bundle_path = TESTS_DIR / "bundle" / "bundle.yaml"
299+
300+
await model.deploy(bundle_path, overlays=[overlay_path])
304301

305-
await model.deploy('juju-qa-bundle-test', overlays=[overlay_path])
306-
assert 'ntp' not in model.applications
302+
assert 'juju-qa-test' in model.applications
303+
assert 'nrpe' not in model.applications
307304
assert 'memcached' not in model.applications
308305
assert 'mysql' in model.applications
309306

@@ -321,7 +318,7 @@ async def test_deploy_bundle_with_multiple_overlays_with_include_files():
321318
assert 'influxdb' not in model.applications
322319
assert 'test' not in model.applications
323320
assert 'memcached' not in model.applications
324-
assert 'grafana' in model.applications
321+
assert 'juju-qa-test' in model.applications
325322

326323

327324
@base.bootstrapped

0 commit comments

Comments
 (0)