Merge lp:~marcoceppi/charms/precise/transcode/tests into lp:charms/transcode

Proposed by Marco Ceppi on 2014-11-06
Status: Merged
Merged at revision: 32
Proposed branch: lp:~marcoceppi/charms/precise/transcode/tests
Merge into: lp:charms/transcode
Diff against target: 68 lines (+58/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+53/-0)
To merge this branch: bzr merge lp:~marcoceppi/charms/precise/transcode/tests
Reviewer Review Type Date Requested Status
charmers 2014-11-06 Pending
Review via email: mp+240890@code.launchpad.net

Commit message

Tests for charm

To post a comment you must log in.
Matt Bruzek (mbruzek) wrote :

Marco,

Thanks for taking the time to add tests to this charm. The tests failed our automated bundletester tool because of the transcode-cluster.yaml bundle in the charm directory. I moved the bundle to a bundles directory and the tests now pass!

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

Subscribers

People subscribed via source and target branches

to all changes: