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

Proposed by nicopace
Status: Merged
Merged at revision: 19
Proposed branch: lp:~nicopace/charms/trusty/sugarcrm/all-tests
Merge into: lp:charms/trusty/sugarcrm
Diff against target: 124 lines (+101/-1)
4 files modified
tests/00-setup (+1/-1)
tests/11-simple-deploy.py (+29/-0)
tests/12-sample-data.py (+33/-0)
tests/13-memcached.py (+38/-0)
To merge this branch: bzr merge lp:~nicopace/charms/trusty/sugarcrm/all-tests
Reviewer Review Type Date Requested Status
Tim Van Steenburgh (community) Needs Fixing
Review via email: mp+251318@code.launchpad.net

Description of the change

Merge of all tests:
* simple deploy
* sample data
* memcached

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

Teste fail on AWS. In order for these tests to work on public clouds, you'll need to expose the sugarcrm service.

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

@tvansteenburgh I forgot that, i thought it wouldn't work locally thou...

Revision history for this message
Antonio Rosales (arosales) wrote :

@Nicopace,

Can you confirm you have updated the branch to expose sugarcrm?

-thanks,
Antonio

Revision history for this message
nicopace (nicopace) wrote :

Yes @a.rosales , it is currently exposed in all tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/00-setup'
2--- tests/00-setup 2014-10-31 05:21:29 +0000
3+++ tests/00-setup 2015-03-13 18:48:38 +0000
4@@ -2,4 +2,4 @@
5
6 sudo add-apt-repository ppa:juju/stable -y
7 sudo apt-get update
8-sudo apt-get install amulet -y
9+sudo apt-get install amulet python-requests python3-memcached -y
10
11=== added file 'tests/11-simple-deploy.py'
12--- tests/11-simple-deploy.py 1970-01-01 00:00:00 +0000
13+++ tests/11-simple-deploy.py 2015-03-13 18:48:38 +0000
14@@ -0,0 +1,29 @@
15+#!/usr/bin/python3
16+
17+import amulet
18+import requests
19+
20+seconds = 20000
21+
22+d = amulet.Deployment(series='trusty')
23+
24+d.add('sugarcrm')
25+d.add('mysql')
26+d.relate('sugarcrm:database', 'mysql:db')
27+d.expose('sugarcrm')
28+
29+try:
30+ d.setup(timeout=seconds)
31+except amulet.helpers.TimeoutError:
32+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
33+except:
34+ raise
35+
36+sugar_unit = d.sentry.unit['sugarcrm/0']
37+
38+result_sugar = requests.get(
39+ 'http://%s/sugarcrm' % sugar_unit.info['public-address'])
40+
41+if result_sugar.status_code != 200:
42+ amulet.raise_status(amulet.FAIL,
43+ 'sugar not correctly installed.')
44
45=== added file 'tests/12-sample-data.py'
46--- tests/12-sample-data.py 1970-01-01 00:00:00 +0000
47+++ tests/12-sample-data.py 2015-03-13 18:48:38 +0000
48@@ -0,0 +1,33 @@
49+#!/usr/bin/python3
50+
51+import amulet
52+import requests
53+
54+seconds = 20000
55+
56+d = amulet.Deployment(series='trusty')
57+
58+d.add('sugarcrm')
59+d.configure('sugarcrm', {
60+ 'sample-users': 100,
61+ 'sample-load': 100
62+})
63+d.add('mysql')
64+d.relate('sugarcrm:database', 'mysql:db')
65+d.expose('sugarcrm')
66+
67+try:
68+ d.setup(timeout=seconds)
69+except amulet.helpers.TimeoutError:
70+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
71+except:
72+ raise
73+
74+sugar_unit = d.sentry.unit['sugarcrm/0']
75+
76+result_sugar = requests.get(
77+ 'http://%s/sugarcrm' % sugar_unit.info['public-address'])
78+
79+if result_sugar.status_code != 200:
80+ amulet.raise_status(amulet.FAIL,
81+ 'sugar not correctly installed.')
82
83=== added file 'tests/13-memcached.py'
84--- tests/13-memcached.py 1970-01-01 00:00:00 +0000
85+++ tests/13-memcached.py 2015-03-13 18:48:38 +0000
86@@ -0,0 +1,38 @@
87+#!/usr/bin/python3
88+
89+import amulet
90+import requests
91+import memcache
92+
93+seconds = 20000
94+
95+d = amulet.Deployment(series='trusty')
96+
97+d.add('sugarcrm')
98+d.add('mysql')
99+d.add('memcached')
100+d.relate('sugarcrm:database', 'mysql:db')
101+d.relate('sugarcrm:cache', 'memcached:cache')
102+
103+d.expose('sugarcrm')
104+try:
105+ d.setup(timeout=seconds)
106+except amulet.helpers.TimeoutError:
107+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
108+except:
109+ raise
110+
111+sugar_unit = d.sentry.unit['sugarcrm/0']
112+memcache_unit = d.sentry.unit['memcached/0']
113+
114+MC = memcache.Client(['%s:11211' % memcache_unit.info['public-address']],
115+ debug=0)
116+
117+result_sugar = requests.get(
118+ 'http://%s/sugarcrm' % sugar_unit.info['public-address'])
119+
120+slabs = MC.get_slabs()
121+
122+if len(slabs) == 0:
123+ amulet.raise_status(amulet.FAIL,
124+ 'Sugar is not using memcached when it should.')

Subscribers

People subscribed via source and target branches

to all changes: