~bbaqar/charms/trusty/plumgrid-gateway/ext-interface-static

« back to all changes in this revision

Viewing changes to tests/14-juno

  • Committer: bbaqar at plumgrid
  • Date: 2015-08-24 16:24:20 UTC
  • Revision ID: bbaqar@plumgrid.com-20150824162420-s8rwxkv7lwj5m287
Improvments in Makefile and Amulets

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python3
2
 
 
3
 
import amulet
4
 
import unittest
5
 
 
6
 
 
7
 
class TestDeployment(unittest.TestCase):
8
 
    @classmethod
9
 
    def setUpClass(cls):
10
 
        cls.deployment = amulet.Deployment(series='trusty')
11
 
        cls.deployment.load_bundle_file(
12
 
            bundle_file='files/plumgrid-gateway.yaml',
13
 
            deployment_name='test')
14
 
        try:
15
 
            cls.deployment.setup(timeout=2000)
16
 
            cls.deployment.sentry.wait()
17
 
        except amulet.helpers.TimeoutError:
18
 
            amulet.raise_status(
19
 
                amulet.SKIP,
20
 
                msg="Environment wasn't stood up in time")
21
 
        except:
22
 
            raise
23
 
 
24
 
    def test_plumgrid_gateway_external_interface(self):
25
 
        pg_sentry = self.deployment.sentry['plumgrid-gateway/0']
26
 
        pg_options = self.deployment.services['plumgrid-gateway']['options']
27
 
        external_interface = pg_options['external-interface']
28
 
        if not external_interface:
29
 
            amulet.raise_status(
30
 
                amulet.FAIL,
31
 
                msg='plumgrid external-interface parameter was not found.')
32
 
        output, code = pg_sentry.run("ethtool {}".format(external_interface))
33
 
        if code != 0:
34
 
            amulet.raise_status(
35
 
                amulet.FAIL,
36
 
                msg='external interface not found on the host')
37
 
 
38
 
    def test_plumgrid_gateway_started(self):
39
 
        pg_sentry = self.deployment.sentry['plumgrid-gateway/0']
40
 
        agent_state = pg_sentry.info['agent-state']
41
 
        if agent_state != 'started':
42
 
            amulet.raise_status(
43
 
                amulet.FAIL,
44
 
                msg='plumgrid gateway is not in a started state')
45
 
 
46
 
    def test_plumgrid_gateway_relation(self):
47
 
        pg_sentry = self.deployment.sentry['plumgrid-gateway/0']
48
 
        relation = pg_sentry.relation(
49
 
            'plumgrid', 'plumgrid-director:plumgrid')
50
 
        if not relation['private-address']:
51
 
            amulet.raise_status(
52
 
                amulet.FAIL, msg='Relation not found.')
53
 
 
54
 
if __name__ == '__main__':
55
 
    unittest.main()