diff options
author | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
---|---|---|
committer | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
commit | 4faa7f927149a5c4ef7a03523f7bc14523cb9baa (patch) | |
tree | 0be55aa0809cc395e45baeae63db660b4e72fe83 /charms/trusty/keepalived/tests | |
parent | 82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (diff) |
Charms for Contrail 3.1 with Mitaka
Change-Id: Id37f3b9743d1974e31fcd7cd9c54be41bb0c47fb
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'charms/trusty/keepalived/tests')
-rwxr-xr-x | charms/trusty/keepalived/tests/00-setup | 5 | ||||
-rwxr-xr-x | charms/trusty/keepalived/tests/10-deploy | 51 |
2 files changed, 56 insertions, 0 deletions
diff --git a/charms/trusty/keepalived/tests/00-setup b/charms/trusty/keepalived/tests/00-setup new file mode 100755 index 0000000..f0616a5 --- /dev/null +++ b/charms/trusty/keepalived/tests/00-setup @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo add-apt-repository ppa:juju/stable -y +sudo apt-get update +sudo apt-get install amulet python-requests -y diff --git a/charms/trusty/keepalived/tests/10-deploy b/charms/trusty/keepalived/tests/10-deploy new file mode 100755 index 0000000..1dfaa80 --- /dev/null +++ b/charms/trusty/keepalived/tests/10-deploy @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +import amulet +import requests +import unittest + + +class TestDeployment(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.deployment = amulet.Deployment() + + cls.deployment.add('keepalived') + cls.deployment.expose('keepalived') + + try: + cls.deployment.setup(timeout=900) + cls.deployment.sentry.wait() + except amulet.helpers.TimeoutError: + amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time") + except: + raise + cls.unit = cls.deployment.sentry.unit['keepalived/0'] + + def test_case(self): + # Now you can use self.deployment.sentry.unit[UNIT] to address each of + # the units and perform more in-depth steps. You can also reference + # the first unit as self.unit. + # There are three test statuses that can be triggered with + # amulet.raise_status(): + # - amulet.PASS + # - amulet.FAIL + # - amulet.SKIP + # Each unit has the following methods: + # - .info - An array of the information of that unit from Juju + # - .file(PATH) - Get the details of a file on that unit + # - .file_contents(PATH) - Get plain text output of PATH file from that unit + # - .directory(PATH) - Get details of directory + # - .directory_contents(PATH) - List files and folders in PATH on that unit + # - .relation(relation, service:rel) - Get relation data from return service + # add tests here to confirm service is up and working properly + # For example, to confirm that it has a functioning HTTP server: + # page = requests.get('http://{}'.format(self.unit.info['public-address'])) + # page.raise_for_status() + # More information on writing Amulet tests can be found at: + # https://juju.ubuntu.com/docs/tools-amulet.html + pass + + +if __name__ == '__main__': + unittest.main() |