Merge lp:~1chb1n/charms/trusty/neutron-gateway/next-amulet-15.10 into lp:~openstack-charmers-archive/charms/trusty/neutron-gateway/next

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 153
Proposed branch: lp:~1chb1n/charms/trusty/neutron-gateway/next-amulet-15.10
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-gateway/next
Diff against target: 315 lines (+145/-14)
8 files modified
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+40/-0)
hooks/charmhelpers/contrib/openstack/amulet/utils.py (+1/-1)
hooks/charmhelpers/contrib/openstack/context.py (+25/-9)
hooks/charmhelpers/contrib/openstack/neutron.py (+14/-0)
hooks/charmhelpers/contrib/openstack/utils.py (+1/-0)
hooks/charmhelpers/core/host.py (+12/-1)
tests/basic_deployment.py (+12/-3)
tests/charmhelpers/contrib/openstack/amulet/deployment.py (+40/-0)
To merge this branch: bzr merge lp:~1chb1n/charms/trusty/neutron-gateway/next-amulet-15.10
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+274722@code.launchpad.net

Description of the change

Update amulet tests for Trusty-Liberty, Wily-Liberty.

Sync charmhelpers.

Add service and relations to satisfy workload status ready state.

Add new logic to wait for extended status message to confirm deploy is ready, before testing.

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #12026 neutron-gateway-next for 1chb1n mp274722
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12026/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #11176 neutron-gateway-next for 1chb1n mp274722
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11176/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #7387 neutron-gateway-next for 1chb1n mp274722
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12800187/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7387/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

^ bootstrap fail

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #7388 neutron-gateway-next for 1chb1n mp274722
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12800424/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7388/

154. By Ryan Beisner

fix relation check, remove varying unit data check

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #12031 neutron-gateway-next for 1chb1n mp274722
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12031/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #11178 neutron-gateway-next for 1chb1n mp274722
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11178/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #7392 neutron-gateway-next for 1chb1n mp274722
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12803083/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7392/

155. By Ryan Beisner

enable wily test; add debug output

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #12162 neutron-gateway-next for 1chb1n mp274722
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12162/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #11293 neutron-gateway-next for 1chb1n mp274722
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11293/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #7432 neutron-gateway-next for 1chb1n mp274722
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7432/

Revision history for this message
Liam Young (gnuoy) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py'
2--- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-09-21 22:51:02 +0000
3+++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-19 14:53:22 +0000
4@@ -14,6 +14,7 @@
5 # You should have received a copy of the GNU Lesser General Public License
6 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
7
8+import re
9 import six
10 from collections import OrderedDict
11 from charmhelpers.contrib.amulet.deployment import (
12@@ -114,6 +115,45 @@
13 for service, config in six.iteritems(configs):
14 self.d.configure(service, config)
15
16+ def _auto_wait_for_status(self, message=None, exclude_services=None,
17+ timeout=1800):
18+ """Wait for all units to have a specific extended status, except
19+ for any defined as excluded. Unless specified via message, any
20+ status containing any case of 'ready' will be considered a match.
21+
22+ Examples of message usage:
23+
24+ Wait for all unit status to CONTAIN any case of 'ready' or 'ok':
25+ message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE)
26+
27+ Wait for all units to reach this status (exact match):
28+ message = 'Unit is ready'
29+
30+ Wait for all units to reach any one of these (exact match):
31+ message = re.compile('Unit is ready|OK|Ready')
32+
33+ Wait for at least one unit to reach this status (exact match):
34+ message = {'ready'}
35+
36+ See Amulet's sentry.wait_for_messages() for message usage detail.
37+ https://github.com/juju/amulet/blob/master/amulet/sentry.py
38+
39+ :param message: Expected status match
40+ :param exclude_services: List of juju service names to ignore
41+ :param timeout: Maximum time in seconds to wait for status match
42+ :returns: None. Raises if timeout is hit.
43+ """
44+
45+ if not message:
46+ message = re.compile('.*ready.*', re.IGNORECASE)
47+
48+ if not exclude_services:
49+ exclude_services = []
50+
51+ services = list(set(self.d.services.keys()) - set(exclude_services))
52+ service_messages = {service: message for service in services}
53+ self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
54+
55 def _get_openstack_release(self):
56 """Get openstack release.
57
58
59=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/utils.py'
60--- hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-09-21 22:51:02 +0000
61+++ hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-19 14:53:22 +0000
62@@ -752,7 +752,7 @@
63 self.log.debug('SSL is enabled @{}:{} '
64 '({})'.format(host, port, unit_name))
65 return True
66- elif not port and not conf_ssl:
67+ elif not conf_ssl:
68 self.log.debug('SSL not enabled @{}:{} '
69 '({})'.format(host, port, unit_name))
70 return False
71
72=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
73--- hooks/charmhelpers/contrib/openstack/context.py 2015-09-29 20:59:50 +0000
74+++ hooks/charmhelpers/contrib/openstack/context.py 2015-10-19 14:53:22 +0000
75@@ -952,6 +952,19 @@
76 'config': config}
77 return ovs_ctxt
78
79+ def midonet_ctxt(self):
80+ driver = neutron_plugin_attribute(self.plugin, 'driver',
81+ self.network_manager)
82+ midonet_config = neutron_plugin_attribute(self.plugin, 'config',
83+ self.network_manager)
84+ mido_ctxt = {'core_plugin': driver,
85+ 'neutron_plugin': 'midonet',
86+ 'neutron_security_groups': self.neutron_security_groups,
87+ 'local_ip': unit_private_ip(),
88+ 'config': midonet_config}
89+
90+ return mido_ctxt
91+
92 def __call__(self):
93 if self.network_manager not in ['quantum', 'neutron']:
94 return {}
95@@ -973,6 +986,8 @@
96 ctxt.update(self.nuage_ctxt())
97 elif self.plugin == 'plumgrid':
98 ctxt.update(self.pg_ctxt())
99+ elif self.plugin == 'midonet':
100+ ctxt.update(self.midonet_ctxt())
101
102 alchemy_flags = config('neutron-alchemy-flags')
103 if alchemy_flags:
104@@ -1105,7 +1120,7 @@
105
106 ctxt = {
107 ... other context ...
108- 'subordinate_config': {
109+ 'subordinate_configuration': {
110 'DEFAULT': {
111 'key1': 'value1',
112 },
113@@ -1146,22 +1161,23 @@
114 try:
115 sub_config = json.loads(sub_config)
116 except:
117- log('Could not parse JSON from subordinate_config '
118- 'setting from %s' % rid, level=ERROR)
119+ log('Could not parse JSON from '
120+ 'subordinate_configuration setting from %s'
121+ % rid, level=ERROR)
122 continue
123
124 for service in self.services:
125 if service not in sub_config:
126- log('Found subordinate_config on %s but it contained'
127- 'nothing for %s service' % (rid, service),
128- level=INFO)
129+ log('Found subordinate_configuration on %s but it '
130+ 'contained nothing for %s service'
131+ % (rid, service), level=INFO)
132 continue
133
134 sub_config = sub_config[service]
135 if self.config_file not in sub_config:
136- log('Found subordinate_config on %s but it contained'
137- 'nothing for %s' % (rid, self.config_file),
138- level=INFO)
139+ log('Found subordinate_configuration on %s but it '
140+ 'contained nothing for %s'
141+ % (rid, self.config_file), level=INFO)
142 continue
143
144 sub_config = sub_config[self.config_file]
145
146=== modified file 'hooks/charmhelpers/contrib/openstack/neutron.py'
147--- hooks/charmhelpers/contrib/openstack/neutron.py 2015-09-28 11:18:48 +0000
148+++ hooks/charmhelpers/contrib/openstack/neutron.py 2015-10-19 14:53:22 +0000
149@@ -209,6 +209,20 @@
150 'server_packages': ['neutron-server',
151 'neutron-plugin-plumgrid'],
152 'server_services': ['neutron-server']
153+ },
154+ 'midonet': {
155+ 'config': '/etc/neutron/plugins/midonet/midonet.ini',
156+ 'driver': 'midonet.neutron.plugin.MidonetPluginV2',
157+ 'contexts': [
158+ context.SharedDBContext(user=config('neutron-database-user'),
159+ database=config('neutron-database'),
160+ relation_prefix='neutron',
161+ ssl_dir=NEUTRON_CONF_DIR)],
162+ 'services': [],
163+ 'packages': [[headers_package()] + determine_dkms_package()],
164+ 'server_packages': ['neutron-server',
165+ 'python-neutron-plugin-midonet'],
166+ 'server_services': ['neutron-server']
167 }
168 }
169 if release >= 'icehouse':
170
171=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
172--- hooks/charmhelpers/contrib/openstack/utils.py 2015-09-28 09:44:36 +0000
173+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-10-19 14:53:22 +0000
174@@ -121,6 +121,7 @@
175 ('2.2.2', 'kilo'),
176 ('2.3.0', 'liberty'),
177 ('2.4.0', 'liberty'),
178+ ('2.5.0', 'liberty'),
179 ])
180
181 # >= Liberty version->codename mapping
182
183=== modified file 'hooks/charmhelpers/core/host.py'
184--- hooks/charmhelpers/core/host.py 2015-09-21 22:51:02 +0000
185+++ hooks/charmhelpers/core/host.py 2015-10-19 14:53:22 +0000
186@@ -566,7 +566,14 @@
187 os.chdir(cur)
188
189
190-def chownr(path, owner, group, follow_links=True):
191+def chownr(path, owner, group, follow_links=True, chowntopdir=False):
192+ """
193+ Recursively change user and group ownership of files and directories
194+ in given path. Doesn't chown path itself by default, only its children.
195+
196+ :param bool follow_links: Also Chown links if True
197+ :param bool chowntopdir: Also chown path itself if True
198+ """
199 uid = pwd.getpwnam(owner).pw_uid
200 gid = grp.getgrnam(group).gr_gid
201 if follow_links:
202@@ -574,6 +581,10 @@
203 else:
204 chown = os.lchown
205
206+ if chowntopdir:
207+ broken_symlink = os.path.lexists(path) and not os.path.exists(path)
208+ if not broken_symlink:
209+ chown(path, uid, gid)
210 for root, dirs, files in os.walk(path):
211 for name in dirs + files:
212 full = os.path.join(root, name)
213
214=== modified file 'tests/021-basic-wily-liberty' (properties changed: -x to +x)
215=== modified file 'tests/basic_deployment.py'
216--- tests/basic_deployment.py 2015-10-19 09:32:10 +0000
217+++ tests/basic_deployment.py 2015-10-19 14:53:22 +0000
218@@ -1,5 +1,3 @@
219-#!/usr/bin/python
220-
221 import amulet
222 import os
223 import time
224@@ -47,7 +45,9 @@
225 other_services = [{'name': 'mysql'},
226 {'name': 'rabbitmq-server'},
227 {'name': 'keystone'},
228+ {'name': 'glance'}, # satisfy workload status
229 {'name': 'nova-cloud-controller'},
230+ {'name': 'nova-compute'}, # satisfy workload stat
231 {'name': 'neutron-api'}]
232
233 super(NeutronGatewayBasicDeployment, self)._add_services(
234@@ -68,7 +68,15 @@
235 'neutron-api:shared-db': 'mysql:shared-db',
236 'neutron-api:amqp': 'rabbitmq-server:amqp',
237 'neutron-api:neutron-api': 'nova-cloud-controller:neutron-api',
238- 'neutron-api:identity-service': 'keystone:identity-service'
239+ 'neutron-api:identity-service': 'keystone:identity-service',
240+ 'glance:identity-service': 'keystone:identity-service',
241+ 'glance:shared-db': 'mysql:shared-db',
242+ 'glance:amqp': 'rabbitmq-server:amqp',
243+ 'nova-cloud-controller:cloud-compute': 'nova-compute:'
244+ 'cloud-compute',
245+ 'nova-compute:amqp': 'rabbitmq-server:amqp',
246+ 'nova-compute:image-service': 'glance:image-service',
247+ 'nova-cloud-controller:image-service': 'glance:image-service',
248 }
249 super(NeutronGatewayBasicDeployment, self)._add_relations(relations)
250
251@@ -947,6 +955,7 @@
252 self.neutron.create_network({'network': network})
253
254 networks = self.neutron.list_networks(name=net_name)
255+ u.log.debug('Networks: {}'.format(networks))
256 net_len = len(networks['networks'])
257 if net_len != 1:
258 msg = "Expected 1 network, found {}".format(net_len)
259
260=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
261--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-09-28 10:06:18 +0000
262+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-19 14:53:22 +0000
263@@ -14,6 +14,7 @@
264 # You should have received a copy of the GNU Lesser General Public License
265 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
266
267+import re
268 import six
269 from collections import OrderedDict
270 from charmhelpers.contrib.amulet.deployment import (
271@@ -114,6 +115,45 @@
272 for service, config in six.iteritems(configs):
273 self.d.configure(service, config)
274
275+ def _auto_wait_for_status(self, message=None, exclude_services=None,
276+ timeout=1800):
277+ """Wait for all units to have a specific extended status, except
278+ for any defined as excluded. Unless specified via message, any
279+ status containing any case of 'ready' will be considered a match.
280+
281+ Examples of message usage:
282+
283+ Wait for all unit status to CONTAIN any case of 'ready' or 'ok':
284+ message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE)
285+
286+ Wait for all units to reach this status (exact match):
287+ message = 'Unit is ready'
288+
289+ Wait for all units to reach any one of these (exact match):
290+ message = re.compile('Unit is ready|OK|Ready')
291+
292+ Wait for at least one unit to reach this status (exact match):
293+ message = {'ready'}
294+
295+ See Amulet's sentry.wait_for_messages() for message usage detail.
296+ https://github.com/juju/amulet/blob/master/amulet/sentry.py
297+
298+ :param message: Expected status match
299+ :param exclude_services: List of juju service names to ignore
300+ :param timeout: Maximum time in seconds to wait for status match
301+ :returns: None. Raises if timeout is hit.
302+ """
303+
304+ if not message:
305+ message = re.compile('.*ready.*', re.IGNORECASE)
306+
307+ if not exclude_services:
308+ exclude_services = []
309+
310+ services = list(set(self.d.services.keys()) - set(exclude_services))
311+ service_messages = {service: message for service in services}
312+ self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
313+
314 def _get_openstack_release(self):
315 """Get openstack release.
316

Subscribers

People subscribed via source and target branches