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

Proposed by Matt Bruzek on 2014-11-06
Status: Merged
Merged at revision: 3
Proposed branch: lp:~mbruzek/charms/precise/opendj/tests
Merge into: lp:charms/opendj
Diff against target: 76 lines (+66/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+61/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/opendj/tests
Reviewer Review Type Date Requested Status
José Antonio Rey (community) 2014-11-06 Approve on 2015-01-08
Review Queue (community) automated testing Needs Fixing on 2015-01-05
Review via email: mp+241005@code.launchpad.net

Commit message

Adding tests for this charm

To post a comment you must log in.
Review Queue (review-queue) wrote :

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

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

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

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

In this particular case the opendj test passes for opendj itself but fails because of an error with a dependency charm - openam. Another bug has been filed for openam, but these tests are good.

+1

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 22:03:03 +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:03:03 +0000
15@@ -0,0 +1,61 @@
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+ opendj_configuration = {
27+ 'opendj accept_license': 'true',
28+ 'manager_password': 'secret'
29+ }
30+ openam_configuration = {
31+ 'Accept_license': True,
32+ 'Amadmin_password': 'cangetin'
33+ }
34+ cls.deployment = amulet.Deployment(series='precise')
35+
36+ cls.deployment.add('opendj')
37+ cls.deployment.configure('opendj', opendj_configuration)
38+ cls.deployment.add('openam', constraints={'mem': '4G'})
39+ cls.deployment.configure('openam', openam_configuration)
40+ cls.deployment.relate('openam:datastore-dj', 'opendj:datastore-dj')
41+
42+ try:
43+ cls.deployment.setup(timeout=900)
44+ cls.deployment.sentry.wait()
45+ except amulet.helpers.TimeoutError:
46+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
47+ except:
48+ raise
49+
50+ def test_case(self):
51+ # Now you can use self.deployment.sentry.unit[UNIT] to address each of
52+ # the units and perform more in-depth steps. You can also reference
53+ # the first unit as self.unit.
54+ # There are three test statuses that can be triggered with
55+ # amulet.raise_status():
56+ # - amulet.PASS
57+ # - amulet.FAIL
58+ # - amulet.SKIP
59+ # Each unit has the following methods:
60+ # - .info - An array of the information of that unit from Juju
61+ # - .file(PATH) - Get the details of a file on that unit
62+ # - .file_contents(PATH) - Get plain text output of PATH file from that unit
63+ # - .directory(PATH) - Get details of directory
64+ # - .directory_contents(PATH) - List files and folders in PATH on that unit
65+ # - .relation(relation, service:rel) - Get relation data from return service
66+ # add tests here to confirm service is up and working properly
67+ # For example, to confirm that it has a functioning HTTP server:
68+ # page = requests.get('http://{}'.format(self.unit.info['public-address']))
69+ # page.raise_for_status()
70+ # More information on writing Amulet tests can be found at:
71+ # https://juju.ubuntu.com/docs/tools-amulet.html
72+ pass
73+
74+
75+if __name__ == '__main__':
76+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: