Merge lp:~marcoceppi/charms/precise/zookeeper/trunk into lp:charms/zookeeper

Proposed by Marco Ceppi
Status: Merged
Merged at revision: 12
Proposed branch: lp:~marcoceppi/charms/precise/zookeeper/trunk
Merge into: lp:charms/zookeeper
Diff against target: 73 lines (+56/-0)
3 files modified
tests/00-setup (+16/-0)
tests/10-bundles-test.py (+33/-0)
tests/bundles.yaml (+7/-0)
To merge this branch: bzr merge lp:~marcoceppi/charms/precise/zookeeper/trunk
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+240876@code.launchpad.net

Commit message

Tests for charm

To post a comment you must log in.
Revision history for this message
Matt Bruzek (mbruzek) wrote :

+1 LGTM tests pass when I ran them.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'tests'
=== added file 'tests/00-setup'
--- tests/00-setup 1970-01-01 00:00:00 +0000
+++ tests/00-setup 2014-11-06 15:59:10 +0000
@@ -0,0 +1,16 @@
1#!/bin/bash
2
3# This script sets up the requirements for amulet tests.
4
5set -x
6
7# Check if amulet is installed before adding the stable repository and updating apt-get.
8dpkg -s amulet
9if [ $? -ne 0 ]; then
10 sudo add-apt-repository -y ppa:juju/stable
11 sudo apt-get update -qq
12 sudo apt-get install -y amulet
13fi
14
15# Install any additional python packages or other required software.
16sudo apt-get install -y python3-requests
0\ No newline at end of file17\ No newline at end of file
118
=== added file 'tests/10-bundles-test.py'
--- tests/10-bundles-test.py 1970-01-01 00:00:00 +0000
+++ tests/10-bundles-test.py 2014-11-06 15:59:10 +0000
@@ -0,0 +1,33 @@
1#!/usr/bin/env python3
2
3# This amulet test deploys the bundles.yaml file in this directory.
4
5import os
6import unittest
7import yaml
8import amulet
9
10seconds_to_wait = 720
11
12
13class 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
32if __name__ == '__main__':
33 unittest.main()
0\ No newline at end of file34\ No newline at end of file
135
=== added file 'tests/bundles.yaml'
--- tests/bundles.yaml 1970-01-01 00:00:00 +0000
+++ tests/bundles.yaml 2014-11-06 15:59:10 +0000
@@ -0,0 +1,7 @@
1zookeeper-automated-bundle:
2 relations: []
3 series: precise
4 services:
5 zookeeper:
6 charm: zookeeper
7 num_units: 1

Subscribers

People subscribed via source and target branches

to all changes: