11 async def test_deploy_local_bundle(event_loop
):
12 from pathlib
import Path
13 tests_dir
= Path(__file__
).absolute().parent
.parent
14 bundle_path
= tests_dir
/ 'bundle'
16 async with base
.CleanModel() as model
:
17 await model
.deploy(str(bundle_path
))
19 for app
in ('wordpress', 'mysql'):
20 assert app
in model
.applications
25 async def test_deploy_bundle(event_loop
):
26 async with base
.CleanModel() as model
:
27 await model
.deploy('bundle/wiki-simple')
29 for app
in ('wiki', 'mysql'):
30 assert app
in model
.applications
35 async def test_add_machine(event_loop
):
36 from juju
.machine
import Machine
38 async with base
.CleanModel() as model
:
39 # add a new default machine
40 machine1
= await model
.add_machine()
42 # add a machine with constraints, disks, and series
43 machine2
= await model
.add_machine(
55 # add a lxd container to machine2
56 machine3
= await model
.add_machine(
57 'lxd:{}'.format(machine2
.id))
59 for m
in (machine1
, machine2
, machine3
):
60 assert isinstance(m
, Machine
)
62 assert len(model
.machines
) == 3
64 await machine3
.destroy(force
=True)
65 await machine2
.destroy(force
=True)
66 res
= await machine1
.destroy(force
=True)
69 assert len(model
.machines
) == 0
74 async def test_relate(event_loop
):
75 from juju
.relation
import Relation
77 async with base
.CleanModel() as model
:
80 application_name
='ubuntu',
86 application_name
='nrpe',
89 # subordinates must be deployed without units
92 my_relation
= await model
.add_relation(
97 assert isinstance(my_relation
, Relation
)