Skip to content

Commit

Permalink
Add integration test for making sure the --required and --channel
Browse files Browse the repository at this point in the history
flags are validated before deploying charms or bundles
  • Loading branch information
cderici committed Oct 5, 2023
1 parent c8f9273 commit 27dee9f
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion tests/integration/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pylxd
import pytest
from juju import jasyncio
from juju import jasyncio, url
from juju.client.client import ApplicationFacade, ConfigValue
from juju.errors import JujuError, JujuUnitError, JujuConnectionError
from juju.model import Model, ModelObserver
Expand Down Expand Up @@ -88,6 +88,38 @@ async def test_deploy_bundle_local_resource_relative_path(event_loop):
timeout=60 * 4)


@base.bootstrapped
@pytest.mark.asyncio
async def test_deploy_by_revision(event_loop):
async with base.CleanModel() as model:
app = await model.deploy('juju-qa-test',
application_name='test',
channel='2.0/stable',
revision=22,)

assert url.URL.parse(app.charm_url).revision == 22


@base.bootstrapped
@pytest.mark.asyncio
async def test_deploy_by_revision_validate_flags(event_loop):
# Make sure we fail gracefully when invalid --revision/--channel
# flags are used

async with base.CleanModel() as model:
# For charms --revision requires --channel
with pytest.raises(JujuError):
await model.deploy('juju-qa-test',
# channel='2.0/stable',
revision=22)

# For bundles, --revision and --channel are mutually exclusive
with pytest.raises(JujuError):
await model.deploy('ch:canonical-livepatch-onprem',
channel='latest/stable',
revision=4)


@base.bootstrapped
@pytest.mark.asyncio
async def test_deploy_local_bundle_include_file(event_loop):
Expand Down

0 comments on commit 27dee9f

Please sign in to comment.