Skip to content

Commit b450bc6

Browse files
committed
sort import and add integration test
1 parent 46c58b0 commit b450bc6

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

tests/integration/test_model.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010

1111
import mock
1212
import paramiko
13-
1413
import pylxd
1514
import pytest
15+
1616
from juju import jasyncio, tag, url
17+
from juju.application import Application
1718
from juju.client import client
18-
from juju.errors import JujuError, JujuModelError, JujuUnitError, JujuConnectionError
19+
from juju.client._definitions import FullStatus
20+
from juju.errors import (JujuConnectionError, JujuError, JujuModelError,
21+
JujuUnitError)
1922
from juju.model import Model, ModelObserver
20-
from juju.utils import block_until, run_with_interrupt, wait_for_bundle, base_channel_to_series
23+
from juju.utils import (base_channel_to_series, block_until,
24+
run_with_interrupt, wait_for_bundle)
2125

2226
from .. import base
23-
from ..utils import MB, GB, TESTS_DIR, OVERLAYS_DIR, SSH_KEY, INTEGRATION_TEST_DIR
27+
from ..utils import (GB, INTEGRATION_TEST_DIR, MB, OVERLAYS_DIR, SSH_KEY,
28+
TESTS_DIR)
2429

2530

2631
@base.bootstrapped
@@ -181,6 +186,25 @@ async def test_deploy_bundle_local_charm_series_manifest():
181186
assert model.units['test1/0'].workload_status == 'active'
182187

183188

189+
@base.bootstrapped
190+
@pytest.mark.bundle
191+
async def test_deploy_bundle_with_pinned_charm_revision():
192+
bundle_dir = INTEGRATION_TEST_DIR / 'bundle-with-charm-revision.yaml'
193+
bundle_yaml_path = bundle_dir / 'bundle-include-file.yaml'
194+
# Revision of the hello-juju charm defined in the bundle yaml
195+
# We can also read the yaml to get the revision but wr're hard-coding it for now for simplicity
196+
pinned_revision = 8
197+
198+
async with base.CleanModel() as model:
199+
await model.deploy(str(bundle_yaml_path))
200+
201+
application: Application = model.applications.get('hello-juju', None)
202+
status: FullStatus = await model.get_status([application.name])
203+
# the 'charm' field of application status should be of this format:
204+
# ch:amd64/{series}/{name}-{revision}
205+
assert f"{application.name}-{pinned_revision}" in status.applications[application.name]["charm"]
206+
207+
184208
@base.bootstrapped
185209
@pytest.mark.bundle
186210
async def test_deploy_invalid_bundle():

0 commit comments

Comments
 (0)