diff options
author | 2016-10-07 12:24:58 -0700 | |
---|---|---|
committer | 2016-10-07 12:24:58 -0700 | |
commit | 4faa7f927149a5c4ef7a03523f7bc14523cb9baa (patch) | |
tree | 0be55aa0809cc395e45baeae63db660b4e72fe83 /charms/trusty/zookeeper/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/zookeeper/tests')
-rw-r--r-- | charms/trusty/zookeeper/tests/00-setup | 16 | ||||
-rw-r--r-- | charms/trusty/zookeeper/tests/10-bundles-test.py | 33 | ||||
-rw-r--r-- | charms/trusty/zookeeper/tests/bundles.yaml | 7 |
3 files changed, 56 insertions, 0 deletions
diff --git a/charms/trusty/zookeeper/tests/00-setup b/charms/trusty/zookeeper/tests/00-setup new file mode 100644 index 0000000..48cd230 --- /dev/null +++ b/charms/trusty/zookeeper/tests/00-setup @@ -0,0 +1,16 @@ +#!/bin/bash + +# This script sets up the requirements for amulet tests. + +set -x + +# Check if amulet is installed before adding the stable repository and updating apt-get. +dpkg -s amulet +if [ $? -ne 0 ]; then + sudo add-apt-repository -y ppa:juju/stable + sudo apt-get update -qq + sudo apt-get install -y amulet +fi + +# Install any additional python packages or other required software. +sudo apt-get install -y python3-requests
\ No newline at end of file diff --git a/charms/trusty/zookeeper/tests/10-bundles-test.py b/charms/trusty/zookeeper/tests/10-bundles-test.py new file mode 100644 index 0000000..67710c7 --- /dev/null +++ b/charms/trusty/zookeeper/tests/10-bundles-test.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +# This amulet test deploys the bundles.yaml file in this directory. + +import os +import unittest +import yaml +import amulet + +seconds_to_wait = 720 + + +class BundleTest(unittest.TestCase): + """ Create a class for testing the charm in the unit test framework. """ + @classmethod + def setUpClass(cls): + """ Set up an amulet deployment using the bundle. """ + d = amulet.Deployment() + bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml') + with open(bundle_path, 'r') as bundle_file: + contents = yaml.safe_load(bundle_file) + d.load(contents) + d.setup(seconds_to_wait) + d.sentry.wait(seconds_to_wait) + cls.d = d + + def test_deployed(self): + """ Test to see if the bundle deployed successfully. """ + self.assertTrue(self.d.deployed) + + +if __name__ == '__main__': + unittest.main()
\ No newline at end of file diff --git a/charms/trusty/zookeeper/tests/bundles.yaml b/charms/trusty/zookeeper/tests/bundles.yaml new file mode 100644 index 0000000..0b7699c --- /dev/null +++ b/charms/trusty/zookeeper/tests/bundles.yaml @@ -0,0 +1,7 @@ +zookeeper-automated-bundle: + relations: [] + series: trusty + services: + zookeeper: + charm: zookeeper + num_units: 1 |