Merge lp:~mbruzek/charms/precise/couchdb/tests into lp:charms/couchdb

Proposed by Matt Bruzek
Status: Merged
Merged at revision: 13
Proposed branch: lp:~mbruzek/charms/precise/couchdb/tests
Merge into: lp:charms/couchdb
Diff against target: 83 lines (+56/-2)
3 files modified
hooks/install (+2/-2)
tests/00-setup (+5/-0)
tests/99-autogen (+49/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/couchdb/tests
Reviewer Review Type Date Requested Status
José Antonio Rey (community) Approve
Review Queue (community) automated testing Needs Fixing
Review via email: mp+240905@code.launchpad.net

Commit message

Adding tests for this charm

To post a comment you must log in.
Revision history for this message
Cory Johns (johnsca) wrote :

The tests fail for me due to the install hook failing because the path for the open-ports command is wrong.

I submitted a MP against this branch that fixes it and with that change, the tests pass for me: https://code.launchpad.net/~johnsca/charms/precise/couchdb/fix-install/+merge/243549

Revision history for this message
Review Queue (review-queue) wrote :

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

review: Needs Fixing (automated testing)
14. By Matt Bruzek

Removing old path to open-port

Revision history for this message
José Antonio Rey (jose) wrote :

Even though the open-port error is removed, there is another error for which a bug will be filed. The tests are good, +1.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2012-02-09 22:51:46 +0000
3+++ hooks/install 2014-12-12 16:45:24 +0000
4@@ -4,7 +4,7 @@
5
6
7 apt-get -y install python-software-properties debconf debconf-utils
8-apt-add-repository ppa:facter-plugins/ppa
9+apt-add-repository -y ppa:facter-plugins/ppa
10 apt-get -y update
11 apt-get install -y couchdb facter facter-customfacts-plugin uuid python-couchdb pwgen
12
13@@ -28,4 +28,4 @@
14
15 service couchdb status && service couchdb restart || service couchdb start
16
17-[ -x /usr/bin/open-port ] && open-port `facter couchdb_port`/TCP
18+open-port `facter couchdb_port`/TCP
19
20=== added directory 'tests'
21=== added file 'tests/00-setup'
22--- tests/00-setup 1970-01-01 00:00:00 +0000
23+++ tests/00-setup 2014-12-12 16:45:24 +0000
24@@ -0,0 +1,5 @@
25+#!/bin/bash
26+
27+sudo add-apt-repository ppa:juju/stable -y
28+sudo apt-get update
29+sudo apt-get install amulet python3-requests -y
30
31=== added file 'tests/99-autogen'
32--- tests/99-autogen 1970-01-01 00:00:00 +0000
33+++ tests/99-autogen 2014-12-12 16:45:24 +0000
34@@ -0,0 +1,49 @@
35+#!/usr/bin/env python3
36+
37+import amulet
38+import requests
39+import unittest
40+
41+
42+class TestDeployment(unittest.TestCase):
43+ @classmethod
44+ def setUpClass(cls):
45+ cls.deployment = amulet.Deployment(series='precise')
46+
47+ cls.deployment.add('couchdb')
48+
49+ try:
50+ cls.deployment.setup(timeout=900)
51+ cls.deployment.sentry.wait()
52+ except amulet.helpers.TimeoutError:
53+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
54+ except:
55+ raise
56+
57+ def test_case(self):
58+ # Now you can use self.deployment.sentry.unit[UNIT] to address each of
59+ # the units and perform more in-depth steps. You can also reference
60+ # the first unit as self.unit.
61+ # There are three test statuses that can be triggered with
62+ # amulet.raise_status():
63+ # - amulet.PASS
64+ # - amulet.FAIL
65+ # - amulet.SKIP
66+ # Each unit has the following methods:
67+ # - .info - An array of the information of that unit from Juju
68+ # - .file(PATH) - Get the details of a file on that unit
69+ # - .file_contents(PATH) - Get plain text output of PATH file from that unit
70+ # - .directory(PATH) - Get details of directory
71+ # - .directory_contents(PATH) - List files and folders in PATH on that unit
72+ # - .relation(relation, service:rel) - Get relation data from return service
73+ # add tests here to confirm service is up and working properly
74+ # For example, to confirm that it has a functioning HTTP server:
75+ # page = requests.get('http://{}'.format(self.unit.info['public-address']))
76+ # page.raise_for_status()
77+ # More information on writing Amulet tests can be found at:
78+ # https://juju.ubuntu.com/docs/tools-amulet.html
79+ pass
80+
81+
82+if __name__ == '__main__':
83+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: