Skip to content

Commit 4b7c8d0

Browse files
committed
Add integration test for making sure the --required and --channel
flags are validated before deploying charms or bundles
1 parent 0deb618 commit 4b7c8d0

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/integration/test_model.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,26 @@ async def test_deploy_by_revision(event_loop):
104104
assert url.URL.parse(app.charm_url).revision == 22
105105

106106

107+
@base.bootstrapped
108+
@pytest.mark.asyncio
109+
async def test_deploy_by_revision_validate_flags(event_loop):
110+
# Make sure we fail gracefully when invalid --revision/--channel
111+
# flags are used
112+
113+
async with base.CleanModel() as model:
114+
# For charms --revision requires --channel
115+
with pytest.raises(JujuError):
116+
await model.deploy('juju-qa-test',
117+
# channel='2.0/stable',
118+
revision=22)
119+
120+
# For bundles, --revision and --channel are mutually exclusive
121+
with pytest.raises(JujuError):
122+
await model.deploy('ch:canonical-livepatch-onprem',
123+
channel='latest/stable',
124+
revision=4)
125+
126+
107127
@base.bootstrapped
108128
@pytest.mark.asyncio
109129
async def test_deploy_local_bundle_include_file(event_loop):

0 commit comments

Comments
 (0)