Merge lp:~nicopace/charms/trusty/varnish/all-tests into lp:charms/trusty/varnish

Proposed by nicopace
Status: Merged
Merged at revision: 15
Proposed branch: lp:~nicopace/charms/trusty/varnish/all-tests
Merge into: lp:charms/trusty/varnish
Diff against target: 120 lines (+99/-1)
3 files modified
tests/10-deploy (+1/-1)
tests/11-varnish-wordpress (+55/-0)
tests/12-change-port (+43/-0)
To merge this branch: bzr merge lp:~nicopace/charms/trusty/varnish/all-tests
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing
charmers Pending
Review via email: mp+251312@code.launchpad.net

Description of the change

Merge all varnish tests into one:
* Varnish wordpress test
* change port test

To post a comment you must log in.
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-11071-results

review: Needs Fixing (automated testing)
Revision history for this message
nicopace (nicopace) wrote :

Wordpress test corrected, and deployment tests extended so it works on slower platforms.

19. By nicopace

Corrects time in tests, and decode on string.

Revision history for this message
nicopace (nicopace) wrote :

The failing test is due to a charm error.

Revision history for this message
nicopace (nicopace) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/10-deploy'
--- tests/10-deploy 2014-10-28 20:52:26 +0000
+++ tests/10-deploy 2015-03-12 17:10:52 +0000
@@ -17,7 +17,7 @@
17 cls.deployment.expose('varnish')17 cls.deployment.expose('varnish')
1818
19 try:19 try:
20 cls.deployment.setup(timeout=900)20 cls.deployment.setup(timeout=5000)
21 cls.deployment.sentry.wait()21 cls.deployment.sentry.wait()
22 except amulet.helpers.TimeoutError:22 except amulet.helpers.TimeoutError:
23 amulet.raise_status(23 amulet.raise_status(
2424
=== added file 'tests/11-varnish-wordpress'
--- tests/11-varnish-wordpress 1970-01-01 00:00:00 +0000
+++ tests/11-varnish-wordpress 2015-03-12 17:10:52 +0000
@@ -0,0 +1,55 @@
1#!/usr/bin/env python3
2import subprocess
3
4import requests
5import amulet
6import unittest
7
8
9class TestDeployment(unittest.TestCase):
10 @classmethod
11 def setUpClass(cls):
12 cls.deployment = amulet.Deployment(series='trusty')
13
14 cls.deployment.add('varnish')
15 cls.deployment.add('wordpress')
16 cls.deployment.relate('varnish:reverseproxy', 'wordpress:website')
17
18 cls.deployment.expose('varnish')
19 cls.deployment.expose('wordpress')
20
21 try:
22 cls.deployment.setup(timeout=5000)
23 cls.deployment.sentry.wait()
24 except amulet.helpers.TimeoutError:
25 amulet.raise_status(
26 amulet.SKIP, msg="Environment wasn't stood up in time")
27 except:
28 raise
29
30 cls.varnish = cls.deployment.sentry['varnish/0']
31 cls.wordpress = cls.deployment.sentry['wordpress/0']
32
33 def test_deployed(self):
34 result_header_varnish = subprocess.check_output([
35 'curl', '-o -', '-I',
36 ' H "Host: %s"' % self.wordpress.info['public-address'],
37 'http://%s/' % self.varnish.info['public-address']])
38
39 if 'varnish' not in result_header_varnish.decode('utf-8'):
40 amulet.raise_status(
41 amulet.FAIL, msg="Varnish is not in the middle.")
42
43 result_varnish = requests.get(
44 'http://%s/' % self.varnish.info['public-address'])
45 result_wordpress = requests.get(
46 'http://%s/' % self.wordpress.info['public-address'])
47
48 if result_varnish.content != result_wordpress.content:
49 amulet.raise_status(
50 amulet.FAIL,
51 msg="Varnish is returning differnt content than wordpress.")
52
53
54if __name__ == '__main__':
55 unittest.main()
056
=== added file 'tests/12-change-port'
--- tests/12-change-port 1970-01-01 00:00:00 +0000
+++ tests/12-change-port 2015-03-12 17:10:52 +0000
@@ -0,0 +1,43 @@
1#!/usr/bin/env python3
2
3import amulet
4import unittest
5
6
7class TestDeployment(unittest.TestCase):
8 @classmethod
9 def setUpClass(cls):
10 cls.deployment = amulet.Deployment(series='trusty')
11
12 cls.deployment.add('varnish')
13 cls.deployment.add('wordpress')
14 cls.deployment.relate('varnish:reverseproxy', 'wordpress:website')
15
16 cls.deployment.configure('varnish', {
17 'port': 8080
18 })
19
20 cls.deployment.expose('varnish')
21 cls.deployment.expose('wordpress')
22
23 try:
24 cls.deployment.setup(timeout=5000)
25 cls.deployment.sentry.wait()
26 except amulet.helpers.TimeoutError:
27 amulet.raise_status(
28 amulet.SKIP, msg="Environment wasn't stood up in time")
29 except:
30 raise
31
32 cls.varnish = cls.deployment.sentry['varnish/0']
33 cls.wordpress = cls.deployment.sentry['wordpress/0']
34
35 def test_deployed(self):
36 result, code = self.varnish.run('sudo netstat -plnt | grep 8080')
37 if result == '':
38 amulet.raise_status(amulet.FAIL,
39 msg='change port failed.')
40
41
42if __name__ == '__main__':
43 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: