Add integration tests.
[osm/N2VC.git] / tests / integration / test_application.py
1 import pytest
2
3 from .. import base
4
5 MB = 1
6
7
8 @base.bootstrapped
9 @pytest.mark.asyncio
10 async def test_action(event_loop):
11 async with base.CleanModel() as model:
12 ubuntu_app = await model.deploy(
13 'mysql',
14 application_name='mysql',
15 series='trusty',
16 channel='stable',
17 config={
18 'tuning-level': 'safest',
19 },
20 constraints={
21 'mem': 256 * MB,
22 },
23 )
24
25 # update and check app config
26 await ubuntu_app.set_config({'tuning-level': 'fast'})
27 config = await ubuntu_app.get_config()
28 assert config['tuning-level']['value'] == 'fast'
29
30 # update and check app constraints
31 await ubuntu_app.set_constraints({'mem': 512 * MB})
32 constraints = await ubuntu_app.get_constraints()
33 assert constraints['mem'] == 512 * MB
34
35
36 @base.bootstrapped
37 @pytest.mark.asyncio
38 async def test_add_units(event_loop):
39 from juju.unit import Unit
40
41 async with base.CleanModel() as model:
42 app = await model.deploy(
43 'ubuntu-0',
44 application_name='ubuntu',
45 series='trusty',
46 channel='stable',
47 )
48 units = await app.add_units(count=2)
49
50 assert len(units) == 2
51 for unit in units:
52 assert isinstance(unit, Unit)