~bbaqar/charms/trusty/neutron-api-plumgrid/liberty

« back to all changes in this revision

Viewing changes to tests/14-kilo

  • Committer: bbaqar at plumgrid
  • Date: 2015-08-24 16:27:30 UTC
  • Revision ID: bbaqar@plumgrid.com-20150824162730-u6un50kv3qlpn9h3
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='tests/files/neutron-api-plumgrid.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, msg="Environment wasn't stood up in time")
 
20
        except:
 
21
            raise
 
22
 
 
23
    def test_packages_installed(self):
 
24
        pg_sentry = self.deployment.sentry['neutron-api/0']
 
25
        for package in {'plumgrid-pythonlib'}:
 
26
            output, code = pg_sentry.run("dpkg -l {}".format(package))
 
27
            if code != 0:
 
28
                message = "{} package not found.".format(package)
 
29
                amulet.raise_status(amulet.FAIL, msg=message)
 
30
 
 
31
    def test_config_file_present(self):
 
32
        try:
 
33
            config_file = self.deployment.sentry['neutron-api/0'].file(
 
34
                '/etc/neutron/plugins/plumgrid/plumlib.ini')
 
35
            if not config_file:
 
36
                amulet.raise_status(
 
37
                    amulet.FAIL, msg='plumlib.ini not found.')
 
38
        except IOError:
 
39
            amulet.raise_status(
 
40
                amulet.FAIL, msg='plumlib.ini inaccessible.')
 
41
 
 
42
if __name__ == '__main__':
 
43
    unittest.main()