Merge lp:~mbruzek/charms/precise/apache2/add-tests into lp:charms/apache2

Proposed by Matt Bruzek on 2014-11-06
Status: Merged
Merged at revision: 61
Proposed branch: lp:~mbruzek/charms/precise/apache2/add-tests
Merge into: lp:charms/apache2
Diff against target: 71 lines (+56/-0)
3 files modified
tests/00-setup (+13/-0)
tests/10-bundles-test.py (+33/-0)
tests/bundles.yaml (+10/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/apache2/add-tests
Reviewer Review Type Date Requested Status
José Antonio Rey (community) Approve on 2015-01-08
Review Queue (community) automated testing Needs Fixing on 2014-12-09
David Britton (community) 2014-11-06 Approve on 2014-11-08
Review via email: mp+240866@code.launchpad.net

Description of the change

[mbruzek] Adding tests to the precise charm.

To post a comment you must log in.
61. By Matt Bruzek on 2014-11-06

Changing bundle to use to precise series.

David Britton (davidpbritton) wrote :

Looks great, tested successfully on openstack, seemed smooth.

Thanks! +1

review: Approve
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10634-results

review: Needs Fixing (automated testing)
José Antonio Rey (jose) wrote :

+1 LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'tests'
2=== added file 'tests/00-setup'
3--- tests/00-setup 1970-01-01 00:00:00 +0000
4+++ tests/00-setup 2014-11-06 15:56:53 +0000
5@@ -0,0 +1,13 @@
6+#!/bin/bash
7+
8+set -x
9+
10+# Check if amulet is installed before adding repository and updating apt-get.
11+dpkg -s amulet
12+if [ $? -ne 0 ]; then
13+ sudo add-apt-repository -y ppa:juju/stable
14+ sudo apt-get update
15+ sudo apt-get install -y amulet
16+fi
17+
18+# Install any additional python packages or software here.
19
20=== added file 'tests/10-bundles-test.py'
21--- tests/10-bundles-test.py 1970-01-01 00:00:00 +0000
22+++ tests/10-bundles-test.py 2014-11-06 15:56:53 +0000
23@@ -0,0 +1,33 @@
24+#!/usr/bin/env python3
25+
26+# This amulet test deploys the bundles.yaml file in this directory.
27+
28+import os
29+import unittest
30+import yaml
31+import amulet
32+
33+seconds_to_wait = 900
34+
35+
36+class BundleTest(unittest.TestCase):
37+ """ Create a class for testing the charm in the unit test framework. """
38+ @classmethod
39+ def setUpClass(cls):
40+ """ Set up an amulet deployment using the bundle. """
41+ d = amulet.Deployment()
42+ bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml')
43+ with open(bundle_path, 'r') as bundle_file:
44+ contents = yaml.safe_load(bundle_file)
45+ d.load(contents)
46+ d.setup(seconds_to_wait)
47+ d.sentry.wait(seconds_to_wait)
48+ cls.d = d
49+
50+ def test_deployed(self):
51+ """ Test to see if the bundle deployed successfully. """
52+ self.assertTrue(self.d.deployed)
53+
54+
55+if __name__ == '__main__':
56+ unittest.main()
57
58=== added file 'tests/bundles.yaml'
59--- tests/bundles.yaml 1970-01-01 00:00:00 +0000
60+++ tests/bundles.yaml 2014-11-06 15:56:53 +0000
61@@ -0,0 +1,10 @@
62+apache2-bundle:
63+ services:
64+ apache2:
65+ charm: apache2
66+ num_units: 1
67+ annotations:
68+ "gui-x": "300"
69+ "gui-y": "300"
70+ relations: []
71+ series: precise

Subscribers

People subscribed via source and target branches

to all changes: