Merge lp:~corey.bryant/charms/trusty/ceph/amulet-updates into lp:~openstack-charmers-archive/charms/trusty/ceph/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 84
Proposed branch: lp:~corey.bryant/charms/trusty/ceph/amulet-updates
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceph/next
Diff against target: 233 lines (+68/-55)
6 files modified
Makefile (+2/-1)
tests/00-setup (+4/-2)
tests/README (+6/-0)
tests/basic_deployment.py (+11/-9)
tests/charmhelpers/contrib/amulet/deployment.py (+15/-10)
tests/charmhelpers/contrib/openstack/amulet/deployment.py (+30/-33)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/ceph/amulet-updates
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+236272@code.launchpad.net
To post a comment you must log in.
85. By Corey Bryant

Sync charm-helpers and fix lint errors.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-08-26 02:06:25 +0000
3+++ Makefile 2014-09-29 20:50:28 +0000
4@@ -10,7 +10,8 @@
5 # coreycb note: The -v should only be temporary until Amulet sends
6 # raise_status() messages to stderr:
7 # https://bugs.launchpad.net/amulet/+bug/1320357
8- @juju test -v -p AMULET_HTTP_PROXY
9+ @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
10+ 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
11
12 bin/charm_helpers_sync.py:
13 @mkdir -p bin
14
15=== modified file 'tests/00-setup'
16--- tests/00-setup 2014-08-26 02:06:25 +0000
17+++ tests/00-setup 2014-09-29 20:50:28 +0000
18@@ -4,5 +4,7 @@
19
20 sudo add-apt-repository --yes ppa:juju/stable
21 sudo apt-get update --yes
22-sudo apt-get install --yes python-amulet
23-sudo apt-get install --yes python-keystoneclient
24+sudo apt-get install --yes python-amulet \
25+ python-keystoneclient \
26+ python-glanceclient \
27+ python-novaclient
28
29=== modified file 'tests/README'
30--- tests/README 2014-08-26 02:06:25 +0000
31+++ tests/README 2014-09-29 20:50:28 +0000
32@@ -1,6 +1,12 @@
33 This directory provides Amulet tests that focus on verification of ceph
34 deployments.
35
36+In order to run tests, you'll need charm-tools installed (in addition to
37+juju, of course):
38+ sudo add-apt-repository ppa:juju/stable
39+ sudo apt-get update
40+ sudo apt-get install charm-tools
41+
42 If you use a web proxy server to access the web, you'll need to set the
43 AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
44
45
46=== modified file 'tests/basic_deployment.py'
47--- tests/basic_deployment.py 2014-08-26 02:06:25 +0000
48+++ tests/basic_deployment.py 2014-09-29 20:50:28 +0000
49@@ -17,9 +17,10 @@
50 class CephBasicDeployment(OpenStackAmuletDeployment):
51 """Amulet tests on a basic ceph deployment."""
52
53- def __init__(self, series=None, openstack=None, source=None):
54+ def __init__(self, series=None, openstack=None, source=None, stable=False):
55 """Deploy the entire test environment."""
56- super(CephBasicDeployment, self).__init__(series, openstack, source)
57+ super(CephBasicDeployment, self).__init__(series, openstack, source,
58+ stable)
59 self._add_services()
60 self._add_relations()
61 self._configure_services()
62@@ -29,14 +30,15 @@
63 def _add_services(self):
64 """Add services
65
66- Add the services that we're testing, including the number of units,
67- where ceph is local, and mysql and cinder are from the charm
68- store.
69+ Add the services that we're testing, where ceph is local,
70+ and the rest of the service are from lp branches that are
71+ compatible with the local charm (e.g. stable or next).
72 """
73- this_service = ('ceph', 3)
74- other_services = [('mysql', 1), ('keystone', 1),
75- ('rabbitmq-server', 1), ('nova-compute', 1),
76- ('glance', 1), ('cinder', 1)]
77+ this_service = {'name': 'ceph', 'units': 3}
78+ other_services = [{'name': 'mysql'}, {'name': 'keystone'},
79+ {'name': 'rabbitmq-server'},
80+ {'name': 'nova-compute'},
81+ {'name': 'glance'}, {'name': 'cinder'}]
82 super(CephBasicDeployment, self)._add_services(this_service,
83 other_services)
84
85
86=== modified file 'tests/charmhelpers/contrib/amulet/deployment.py'
87--- tests/charmhelpers/contrib/amulet/deployment.py 2014-09-26 08:19:54 +0000
88+++ tests/charmhelpers/contrib/amulet/deployment.py 2014-09-29 20:50:28 +0000
89@@ -25,25 +25,30 @@
90
91 Add services to the deployment where this_service is the local charm
92 that we're testing and other_services are the other services that
93- are being used in the amulet tests.
94+ are being used in the local amulet tests.
95 """
96- name, units, location = range(3)
97-
98- if this_service[name] != os.path.basename(os.getcwd()):
99- s = this_service[name]
100+ if this_service['name'] != os.path.basename(os.getcwd()):
101+ s = this_service['name']
102 msg = "The charm's root directory name needs to be {}".format(s)
103 amulet.raise_status(amulet.FAIL, msg=msg)
104
105- self.d.add(this_service[name], units=this_service[units])
106+ if 'units' not in this_service:
107+ this_service['units'] = 1
108+
109+ self.d.add(this_service['name'], units=this_service['units'])
110
111 for svc in other_services:
112- if len(svc) > 2:
113- branch_location = svc[location]
114+ if 'location' in svc:
115+ branch_location = svc['location']
116 elif self.series:
117- branch_location = 'cs:{}/{}'.format(self.series, svc[name]),
118+ branch_location = 'cs:{}/{}'.format(self.series, svc['name']),
119 else:
120 branch_location = None
121- self.d.add(svc[name], charm=branch_location, units=svc[units])
122+
123+ if 'units' not in svc:
124+ svc['units'] = 1
125+
126+ self.d.add(svc['name'], charm=branch_location, units=svc['units'])
127
128 def _add_relations(self, relations):
129 """Add all of the relations for the services."""
130
131=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
132--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2014-09-26 08:19:54 +0000
133+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2014-09-29 20:50:28 +0000
134@@ -1,6 +1,3 @@
135-from bzrlib.branch import Branch
136-import os
137-import re
138 from charmhelpers.contrib.amulet.deployment import (
139 AmuletDeployment
140 )
141@@ -13,62 +10,62 @@
142 that is specifically for use by OpenStack charms.
143 """
144
145- def __init__(self, series=None, openstack=None, source=None):
146+ def __init__(self, series=None, openstack=None, source=None, stable=True):
147 """Initialize the deployment environment."""
148 super(OpenStackAmuletDeployment, self).__init__(series)
149 self.openstack = openstack
150 self.source = source
151-
152- def _is_dev_branch(self):
153- """Determine if branch being tested is a dev (i.e. next) branch."""
154- branch = Branch.open(os.getcwd())
155- parent = branch.get_parent()
156- pattern = re.compile("^.*/next/$")
157- if (pattern.match(parent)):
158- return True
159- else:
160- return False
161+ self.stable = stable
162+ # Note(coreycb): this needs to be changed when new next branches come
163+ # out.
164+ self.current_next = "trusty"
165
166 def _determine_branch_locations(self, other_services):
167 """Determine the branch locations for the other services.
168
169- If the branch being tested is a dev branch, then determine the
170- development branch locations for the other services. Otherwise,
171- the default charm store branches will be used."""
172- name = 0
173- if self._is_dev_branch():
174- updated_services = []
175- for svc in other_services:
176- if svc[name] in ['mysql', 'mongodb', 'rabbitmq-server']:
177- location = 'lp:charms/{}'.format(svc[name])
178+ Determine if the local branch being tested is derived from its
179+ stable or next (dev) branch, and based on this, use the corresonding
180+ stable or next branches for the other_services."""
181+ base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
182+
183+ if self.stable:
184+ for svc in other_services:
185+ temp = 'lp:charms/{}'
186+ svc['location'] = temp.format(svc['name'])
187+ else:
188+ for svc in other_services:
189+ if svc['name'] in base_charms:
190+ temp = 'lp:charms/{}'
191+ svc['location'] = temp.format(svc['name'])
192 else:
193- temp = 'lp:~openstack-charmers/charms/trusty/{}/next'
194- location = temp.format(svc[name])
195- updated_services.append(svc + (location,))
196- other_services = updated_services
197+ temp = 'lp:~openstack-charmers/charms/{}/{}/next'
198+ svc['location'] = temp.format(self.current_next,
199+ svc['name'])
200 return other_services
201
202 def _add_services(self, this_service, other_services):
203 """Add services to the deployment and set openstack-origin/source."""
204- name = 0
205 other_services = self._determine_branch_locations(other_services)
206+
207 super(OpenStackAmuletDeployment, self)._add_services(this_service,
208 other_services)
209+
210 services = other_services
211 services.append(this_service)
212- use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']
213+ use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
214+ 'ceph-osd', 'ceph-radosgw']
215
216 if self.openstack:
217 for svc in services:
218- if svc[name] not in use_source:
219+ if svc['name'] not in use_source:
220 config = {'openstack-origin': self.openstack}
221- self.d.configure(svc[name], config)
222+ self.d.configure(svc['name'], config)
223
224 if self.source:
225 for svc in services:
226- if svc[name] in use_source:
227+ if svc['name'] in use_source:
228 config = {'source': self.source}
229- self.d.configure(svc[name], config)
230+ self.d.configure(svc['name'], config)
231
232 def _configure_services(self, configs):
233 """Configure all of the services."""

Subscribers

People subscribed via source and target branches