~hopem/charms/trusty/hacluster/dont-allow-pacemaker-upgrade

« back to all changes in this revision

Viewing changes to tests/10-bundles-test.py

  • Committer: james.page at ubuntu
  • Date: 2014-12-15 08:59:40 UTC
  • mfrom: (35.3.2 hacluster)
  • Revision ID: james.page@ubuntu.com-20141215085940-ss80p240s7ux4wzi
Merge in bundle tests from master charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
 
 
3
# This amulet test deploys the bundles.yaml file in this directory.
 
4
 
 
5
import os
 
6
import unittest
 
7
import yaml
 
8
import amulet
 
9
 
 
10
seconds_to_wait = 600
 
11
 
 
12
 
 
13
class BundleTest(unittest.TestCase):
 
14
    """ Create a class for testing the charm in the unit test framework. """
 
15
    @classmethod
 
16
    def setUpClass(cls):
 
17
        """ Set up an amulet deployment using the bundle. """
 
18
        d = amulet.Deployment()
 
19
        bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml')
 
20
        with open(bundle_path, 'r') as bundle_file:
 
21
            contents = yaml.safe_load(bundle_file)
 
22
            d.load(contents)
 
23
        d.setup(seconds_to_wait)
 
24
        d.sentry.wait(seconds_to_wait)
 
25
        cls.d = d
 
26
 
 
27
    def test_deployed(self):
 
28
        """ Test to see if the bundle deployed successfully. """
 
29
        self.assertTrue(self.d.deployed)
 
30
 
 
31
 
 
32
if __name__ == '__main__':
 
33
    unittest.main()
 
 
b'\\ No newline at end of file'