Skip to content

Commit ffbe070

Browse files
committed
ci: conditionally skip tests that require newer Juju
1 parent 0529411 commit ffbe070

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

tests/integration/test_crossmodel.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ async def test_remove_saas():
9898
async def test_relate_with_offer():
9999
# pytest.skip('Revise: intermittent problem with the remove_saas call')
100100
async with base.CleanModel() as model_1:
101+
assert model_1._info
102+
if str(model_1._info.agent_version) < "3.4.3":
103+
pytest.skip("postgresql charm requires Juju 3.4.3 or later")
104+
101105
application = await model_1.deploy(
102106
'postgresql',
103107
application_name='postgresql',

tests/integration/test_model.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ async def test_deploy_bundle_with_storage_constraint():
217217
bundle_path = INTEGRATION_TEST_DIR / 'bundle' / 'bundle-with-storage-constraint.yaml'
218218

219219
async with base.CleanModel() as model:
220+
assert model._info
221+
if str(model._info.agent_version) < "3.4.3":
222+
pytest.skip("bundle/postgresql charm requires Juju 3.4.3 or later")
223+
220224
await model.deploy(bundle_path)
221225
await wait_for_bundle(model, bundle_path)
222226
storage = await model.list_storage()
@@ -237,6 +241,10 @@ async def test_deploy_local_charm():
237241
@base.bootstrapped
238242
async def test_deploy_charm_assumes():
239243
async with base.CleanModel() as model:
244+
assert model._info
245+
if str(model._info.agent_version) < "3.4.3":
246+
pytest.skip("postgresql charm requires Juju 3.4.3 or later")
247+
240248
await model.deploy('postgresql', channel='14/edge')
241249

242250

@@ -298,6 +306,10 @@ async def test_deploy_bundle():
298306
@pytest.mark.bundle
299307
async def test_deploy_local_bundle_with_overlay_multi():
300308
async with base.CleanModel() as model:
309+
assert model._info
310+
if str(model._info.agent_version) < "3.4.3":
311+
pytest.skip("bundle/postgresql charm requires Juju 3.4.3 or later")
312+
301313
bundle_with_overlay_path = OVERLAYS_DIR / 'bundle-with-overlay-multi.yaml'
302314
await model.deploy(bundle_with_overlay_path)
303315

@@ -312,6 +324,10 @@ async def test_deploy_local_bundle_with_overlay_multi():
312324
@pytest.mark.skip("Always fails -- investigate bundle charms")
313325
async def test_deploy_bundle_with_overlay_as_argument():
314326
async with base.CleanModel() as model:
327+
assert model._info
328+
if str(model._info.agent_version) < "3.4.3":
329+
pytest.skip("bundle/postgresql charm requires Juju 3.4.3 or later")
330+
315331
overlay_path = OVERLAYS_DIR / 'test-overlay.yaml'
316332

317333
await model.deploy('juju-qa-bundle-test', overlays=[overlay_path])
@@ -381,6 +397,10 @@ async def test_deploy_local_charm_folder_symlink():
381397
@base.bootstrapped
382398
async def test_deploy_from_ch_channel_revision_success():
383399
async with base.CleanModel() as model:
400+
assert model._info
401+
if str(model._info.agent_version) < "3.4.3":
402+
pytest.skip("postgresql charm requires Juju 3.4.3 or later")
403+
384404
# Ensure we're able to resolve charm these with channel and revision,
385405
# or channel without revision (note that revision requires channel,
386406
# but not vice versa)

tests/integration/test_secrets.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
@pytest.mark.bundle
1111
async def test_add_secret():
1212
async with base.CleanModel() as model:
13+
assert model._info
14+
if str(model._info.agent_version) < "3.3.0":
15+
pytest.skip("Juju too old, need Secrets API v2")
16+
1317
secret = await model.add_secret(name='my-apitoken', data_args=['token=34ae35facd4'])
1418
assert secret.startswith('secret:')
1519

@@ -28,6 +32,10 @@ async def test_list_secrets():
2832
charm_path = TESTS_DIR / 'charm-secret/charm-secret_ubuntu-22.04-amd64.charm'
2933

3034
async with base.CleanModel() as model:
35+
assert model._info
36+
if str(model._info.agent_version) < "3.3.0":
37+
pytest.skip("Juju too old, need Secrets API v2")
38+
3139
await model.deploy(str(charm_path))
3240
assert 'charm-secret' in model.applications
3341
await model.wait_for_idle(status="active")
@@ -42,6 +50,10 @@ async def test_list_secrets():
4250
@pytest.mark.bundle
4351
async def test_update_secret():
4452
async with base.CleanModel() as model:
53+
assert model._info
54+
if str(model._info.agent_version) < "3.3.0":
55+
pytest.skip("Juju too old, need Secrets API v2")
56+
4557
secret = await model.add_secret(name='my-apitoken', data_args=['token=34ae35facd4'])
4658
assert secret.startswith('secret:')
4759

@@ -56,6 +68,10 @@ async def test_update_secret():
5668
@pytest.mark.bundle
5769
async def test_remove_secret():
5870
async with base.CleanModel() as model:
71+
assert model._info
72+
if str(model._info.agent_version) < "3.3.0":
73+
pytest.skip("Juju too old, need Secrets API v2")
74+
5975
secret = await model.add_secret(name='my-apitoken', data_args=['token=34ae35facd4'])
6076
assert secret.startswith('secret:')
6177

@@ -69,6 +85,10 @@ async def test_remove_secret():
6985
@pytest.mark.bundle
7086
async def test_grant_secret():
7187
async with base.CleanModel() as model:
88+
assert model._info
89+
if str(model._info.agent_version) < "3.3.0":
90+
pytest.skip("Juju too old, need Secrets API v2")
91+
7292
secret = await model.add_secret(name='my-apitoken', data_args=['token=34ae35facd4'])
7393
assert secret.startswith('secret:')
7494

@@ -81,6 +101,10 @@ async def test_grant_secret():
81101
@pytest.mark.bundle
82102
async def test_revoke_secret():
83103
async with base.CleanModel() as model:
104+
assert model._info
105+
if str(model._info.agent_version) < "3.3.0":
106+
pytest.skip("Juju too old, need Secrets API v2")
107+
84108
secret = await model.add_secret(name='my-apitoken', data_args=['token=34ae35facd4'])
85109
assert secret.startswith('secret:')
86110
await model.revoke_secret('my-apitoken', 'ubuntu')

0 commit comments

Comments
 (0)