Skip to content

Commit

Permalink
Use simpler charms in tests
Browse files Browse the repository at this point in the history
to avoid timeout errors simply because it takes longer with complex
charms
  • Loading branch information
cderici committed Sep 19, 2023
1 parent 4b09a65 commit f5bd29f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
13 changes: 5 additions & 8 deletions tests/bundle/bundle.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
series: jammy
applications:
grafana:
charm: "grafana"
channel: stable
num_units: 1
prometheus:
charm: "prometheus2"
channel: stable
juju-qa-test:
charm: "juju-qa-test"
num_units: 1
nrpe:
charm: "nrpe"
relations:
- ["prometheus:grafana-source", "grafana:grafana-source"]
- ["nrpe:general-info", "juju-qa-test:juju-info"]
12 changes: 5 additions & 7 deletions tests/bundle/mini-bundle.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
series: jammy
applications:
grafana:
charm: "grafana"
channel: stable
juju-qa-test:
charm: "juju-qa-test"
num_units: 1
prometheus:
charm: "prometheus2"
channel: stable
nrpe:
charm: "nrpe"
num_units: 1
relations:
- ["prometheus:grafana-source", "grafana:grafana-source"]
- ["nrpe:general-info", "juju-qa-test:juju-info"]
17 changes: 7 additions & 10 deletions tests/integration/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ async def test_deploy_local_bundle_dir(event_loop):
async with base.CleanModel() as model:
await model.deploy(str(bundle_path))

app1 = model.applications.get('grafana')
app2 = model.applications.get('prometheus')
app1 = model.applications.get('juju-qa-test')
app2 = model.applications.get('nrpe')
with open("/tmp/output", "w") as writer:
writer.write(str(bundle_path) + "\n")
for (k, v) in model.applications.items():
writer.write(k)
assert app1 and app2
await model.block_until(lambda: (len(app1.units) == 1 and
len(app2.units) == 1),
timeout=60 * 4)
# import pdb;pdb.set_trace()
await model.wait_for_idle(['juju-qa-test', 'nrpe'], wait_for_at_least_units=1)


@base.bootstrapped
Expand All @@ -64,12 +63,10 @@ async def test_deploy_local_bundle_file(event_loop):
async with base.CleanModel() as model:
await model.deploy(str(mini_bundle_file_path))

app1 = model.applications.get('grafana')
app2 = model.applications.get('prometheus')
app1 = model.applications.get('juju-qa-test')
app2 = model.applications.get('nrpe')
assert app1 and app2
await model.block_until(lambda: (len(app1.units) == 1 and
len(app2.units) == 1),
timeout=60 * 4)
await model.wait_for_idle(['juju-qa-test', 'nrpe'], wait_for_at_least_units=1)


@base.bootstrapped
Expand Down

0 comments on commit f5bd29f

Please sign in to comment.