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

Proposed by nicopace
Status: Needs review
Proposed branch: lp:~nicopace/charms/trusty/gunicorn/all-tests
Merge into: lp:charms/trusty/gunicorn
Diff against target: 51 lines (+47/-0)
1 file modified
tests/10-wsgi-worker-class (+47/-0)
To merge this branch: bzr merge lp:~nicopace/charms/trusty/gunicorn/all-tests
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+251307@code.launchpad.net

Description of the change

Integration of tests:
* wsgi worker class
* simple deploy

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

This tests won't pass, as they reflect a bug in the documentation: https://bugs.launchpad.net/charms/+source/gunicorn/+bug/1419033

Unmerged revisions

36. By Nicolas Pace <email address hidden>

wsgi worker class test.

35. By Nicolas Pace <email address hidden>

Adds test beginning.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/10-wsgi-worker-class'
2--- tests/10-wsgi-worker-class 1970-01-01 00:00:00 +0000
3+++ tests/10-wsgi-worker-class 2015-02-27 18:35:02 +0000
4@@ -0,0 +1,47 @@
5+#!/usr/bin/python3
6+
7+import amulet
8+
9+seconds = 20000
10+
11+d = amulet.Deployment(series='trusty')
12+
13+d.add('python-django')
14+d.add('postgresql')
15+d.add('gunicorn')
16+
17+d.relate('python-django:pgsql', 'posgtresql:db')
18+d.relate('gunicorn:wsgi-file', 'python-django:wsgi')
19+
20+d.expose('python-django')
21+
22+try:
23+ d.setup(timeout=seconds)
24+except amulet.helpers.TimeoutError:
25+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
26+except:
27+ raise
28+
29+wsgi_worker_values = ['eventlet', 'gevent', 'tornado', 'sync']
30+for wsgi_worker_value in wsgi_worker_values:
31+ d.configure('gunicorn', {
32+ 'wsgi_worker_class': wsgi_worker_value
33+ })
34+
35+ d.sentry.wait()
36+
37+ django_unit = d.sentry.unit['python-django/0']
38+
39+ if wsgi_worker_value != 'sync':
40+ result, code = django_unit.run('dpkg -s python-%s' % wsgi_worker_value)
41+
42+ if code != 0:
43+ amulet.raise_status(
44+ amulet.FAIL,
45+ message='python-%s not installed' % wsgi_worker_value)
46+
47+ gunicorn_conf = django_unit.file_contents('/etc/init/gunicorn.conf')
48+ if wsgi_worker_value not in gunicorn_conf:
49+ amulet.raise_status(
50+ amulet.FAIL,
51+ message='%s not in gunicorn.conf' % wsgi_worker_value)

Subscribers

People subscribed via source and target branches