Skip to content

Commit 871de22

Browse files
committed
Add integration test for resources argument in app refresh
1 parent 0860682 commit 871de22

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/integration/test_application.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,39 @@ async def test_upgrade_local_charm_resource(event_loop):
209209

210210

211211
@base.bootstrapped
212+
@pytest.mark.asyncio
213+
async def test_upgrade_charm_resource(event_loop):
214+
async with base.CleanModel() as model:
215+
app = await model.deploy('cs:~juju-qa/bionic/upgrade-charm-resource-test-0')
216+
217+
await model.wait_for_idle(wait_for_units=1)
218+
unit = app.units[0]
219+
expected_message = 'I have no resource.'
220+
assert unit.workload_status_message == expected_message
221+
222+
await app.upgrade_charm(revision=1)
223+
await model.block_until(
224+
lambda: unit.workload_status_message != 'I have no resource.',
225+
timeout=60,
226+
)
227+
expected_message = 'My resource: I am the resource.'
228+
assert app.units[0].workload_status_message == expected_message
229+
230+
231+
@base.bootstrapped
232+
@pytest.mark.asyncio
233+
async def test_refresh_with_resource_argument(event_loop):
234+
async with base.CleanModel() as model:
235+
app = await model.deploy('juju-qa-test', resources={'foo-file': 2})
236+
res2 = await app.get_resources()
237+
assert res2['foo-file'].revision == 2
238+
await app.refresh(resources={'foo-file': 4})
239+
res4 = await app.get_resources()
240+
assert res4['foo-file'].revision == 4
241+
242+
243+
@base.bootstrapped
244+
@pytest.mark.asyncio
212245
async def test_upgrade_charm_resource_same_rev_no_update(event_loop):
213246
async with base.CleanModel() as model:
214247
app = await model.deploy('keystone', channel='victoria/stable')

0 commit comments

Comments
 (0)