499a7d3d8309325e18f5ab105585b369dc57ad94
[osm/N2VC.git] / tests / integration / test_machine.py
1 import asyncio
2
3 import pytest
4
5 from .. import base
6
7
8 @base.bootstrapped
9 @pytest.mark.asyncio
10 async def test_status(event_loop):
11 async with base.CleanModel() as model:
12 await model.deploy(
13 'ubuntu-0',
14 application_name='ubuntu',
15 series='trusty',
16 channel='stable',
17 )
18
19 await asyncio.wait_for(
20 model.block_until(lambda: len(model.machines)),
21 timeout=240)
22 machine = model.machines['0']
23
24 assert machine.status in ('allocating', 'pending')
25 assert machine.agent_status == 'pending'
26 assert not machine.agent_version
27
28 await asyncio.wait_for(
29 model.block_until(lambda: (machine.status == 'running' and
30 machine.agent_status == 'started')),
31 timeout=480)
32
33 assert machine.status == 'running'
34 # there is some inconsistency in the message case between providers
35 assert machine.status_message.lower() == 'running'
36 assert machine.agent_status == 'started'
37 assert machine.agent_version.major >= 2