Merge lp:~mbruzek/charms/precise/openerp-web/tests into lp:charms/openerp-web

Proposed by Matt Bruzek on 2014-11-06
Status: Merged
Merged at revision: 27
Proposed branch: lp:~mbruzek/charms/precise/openerp-web/tests
Merge into: lp:charms/openerp-web
Diff against target: 71 lines (+61/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+56/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/openerp-web/tests
Reviewer Review Type Date Requested Status
charmers 2014-11-06 Pending
Review via email: mp+241011@code.launchpad.net

Commit message

Adding tests for this charm

To post a comment you must log in.

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 22:38:24 +0000
5@@ -0,0 +1,5 @@
6+#!/bin/bash
7+
8+sudo add-apt-repository ppa:juju/stable -y
9+sudo apt-get update
10+sudo apt-get install amulet python3-requests -y
11
12=== added file 'tests/99-autogen'
13--- tests/99-autogen 1970-01-01 00:00:00 +0000
14+++ tests/99-autogen 2014-11-06 22:38:24 +0000
15@@ -0,0 +1,56 @@
16+#!/usr/bin/env python3
17+
18+import amulet
19+import requests
20+import unittest
21+
22+
23+class TestDeployment(unittest.TestCase):
24+ @classmethod
25+ def setUpClass(cls):
26+ cls.deployment = amulet.Deployment(series='precise')
27+
28+ cls.deployment.add('openerp-web')
29+ cls.deployment.add('postgresql')
30+ cls.deployment.add('openerp-server')
31+ cls.deployment.configure('openerp-server', {'admin_passwd': 'passw0rd'})
32+ cls.deployment.relate('openerp-web:website', 'apache2')
33+ cls.deployment.relate('openerp-server:db', 'postgresql:db-admin')
34+ cls.deployment.relate('openerp-web:openerp', 'openerp-server:openerp')
35+ cls.deployment.expose('openerp-server')
36+
37+ try:
38+ cls.deployment.setup(timeout=900)
39+ cls.deployment.sentry.wait()
40+ except amulet.helpers.TimeoutError:
41+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
42+ except:
43+ raise
44+
45+ def test_case(self):
46+ # Now you can use self.deployment.sentry.unit[UNIT] to address each of
47+ # the units and perform more in-depth steps. You can also reference
48+ # the first unit as self.unit.
49+ # There are three test statuses that can be triggered with
50+ # amulet.raise_status():
51+ # - amulet.PASS
52+ # - amulet.FAIL
53+ # - amulet.SKIP
54+ # Each unit has the following methods:
55+ # - .info - An array of the information of that unit from Juju
56+ # - .file(PATH) - Get the details of a file on that unit
57+ # - .file_contents(PATH) - Get plain text output of PATH file from that unit
58+ # - .directory(PATH) - Get details of directory
59+ # - .directory_contents(PATH) - List files and folders in PATH on that unit
60+ # - .relation(relation, service:rel) - Get relation data from return service
61+ # add tests here to confirm service is up and working properly
62+ # For example, to confirm that it has a functioning HTTP server:
63+ # page = requests.get('http://{}'.format(self.unit.info['public-address']))
64+ # page.raise_for_status()
65+ # More information on writing Amulet tests can be found at:
66+ # https://juju.ubuntu.com/docs/tools-amulet.html
67+ pass
68+
69+
70+if __name__ == '__main__':
71+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: