Skip to content

Commit 2a97c0e

Browse files
committed
Add app.refresh test switch from CS to CH
1 parent 0a04f84 commit 2a97c0e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/integration/test_application.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ async def test_upgrade_charm_switch(event_loop):
235235
await model.block_until(lambda: (len(app.units) > 0 and
236236
app.units[0].machine))
237237
assert app.data['charm-url'] == 'cs:ubuntu-0'
238-
await app.upgrade_charm(switch='ubuntu-8')
238+
with pytest.raises(errors.JujuError):
239+
await app.upgrade_charm(switch='ubuntu-8')
240+
await app.upgrade_charm(switch='cs:ubuntu-8')
239241
assert app.data['charm-url'] == 'cs:ubuntu-8'
240242

241243

@@ -253,6 +255,18 @@ async def test_upgrade_local_charm(event_loop):
253255
assert app.data['charm-url'] == 'local:focal/ubuntu-0'
254256

255257

258+
@base.bootstrapped
259+
@pytest.mark.asyncio
260+
async def test_upgrade_switch_charmstore_to_charmhub(event_loop):
261+
async with base.CleanModel() as model:
262+
app = await model.deploy('cs:ubuntu', series='focal')
263+
await model.wait_for_idle(status="active")
264+
assert app.data['charm-url'].startswith('cs:ubuntu')
265+
await app.upgrade_charm(channel='latest/stable', switch='ch:ubuntu-8')
266+
await model.wait_for_idle(status="active")
267+
assert app.data['charm-url'].startswith('ch:')
268+
269+
256270
@base.bootstrapped
257271
@pytest.mark.asyncio
258272
async def test_upgrade_charm_resource(event_loop):

0 commit comments

Comments
 (0)