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
=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py'
--- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-09-21 22:51:02 +0000
+++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-19 14:53:22 +0000
@@ -14,6 +14,7 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
1616
17import re
17import six18import six
18from collections import OrderedDict19from collections import OrderedDict
19from charmhelpers.contrib.amulet.deployment import (20from charmhelpers.contrib.amulet.deployment import (
@@ -114,6 +115,45 @@
114 for service, config in six.iteritems(configs):115 for service, config in six.iteritems(configs):
115 self.d.configure(service, config)116 self.d.configure(service, config)
116117
118 def _auto_wait_for_status(self, message=None, exclude_services=None,
119 timeout=1800):
120 """Wait for all units to have a specific extended status, except
121 for any defined as excluded. Unless specified via message, any
122 status containing any case of 'ready' will be considered a match.
123
124 Examples of message usage:
125
126 Wait for all unit status to CONTAIN any case of 'ready' or 'ok':
127 message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE)
128
129 Wait for all units to reach this status (exact match):
130 message = 'Unit is ready'
131
132 Wait for all units to reach any one of these (exact match):
133 message = re.compile('Unit is ready|OK|Ready')
134
135 Wait for at least one unit to reach this status (exact match):
136 message = {'ready'}
137
138 See Amulet's sentry.wait_for_messages() for message usage detail.
139 https://github.com/juju/amulet/blob/master/amulet/sentry.py
140
141 :param message: Expected status match
142 :param exclude_services: List of juju service names to ignore
143 :param timeout: Maximum time in seconds to wait for status match
144 :returns: None. Raises if timeout is hit.
145 """
146
147 if not message:
148 message = re.compile('.*ready.*', re.IGNORECASE)
149
150 if not exclude_services:
151 exclude_services = []
152
153 services = list(set(self.d.services.keys()) - set(exclude_services))
154 service_messages = {service: message for service in services}
155 self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
156
117 def _get_openstack_release(self):157 def _get_openstack_release(self):
118 """Get openstack release.158 """Get openstack release.
119159
120160
=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/utils.py'
--- hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-09-21 22:51:02 +0000
+++ hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-19 14:53:22 +0000
@@ -752,7 +752,7 @@
752 self.log.debug('SSL is enabled @{}:{} '752 self.log.debug('SSL is enabled @{}:{} '
753 '({})'.format(host, port, unit_name))753 '({})'.format(host, port, unit_name))
754 return True754 return True
755 elif not port and not conf_ssl:755 elif not conf_ssl:
756 self.log.debug('SSL not enabled @{}:{} '756 self.log.debug('SSL not enabled @{}:{} '
757 '({})'.format(host, port, unit_name))757 '({})'.format(host, port, unit_name))
758 return False758 return False
759759
=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
--- hooks/charmhelpers/contrib/openstack/context.py 2015-09-29 20:59:50 +0000
+++ hooks/charmhelpers/contrib/openstack/context.py 2015-10-19 14:53:22 +0000
@@ -952,6 +952,19 @@
952 'config': config}952 'config': config}
953 return ovs_ctxt953 return ovs_ctxt
954954
955 def midonet_ctxt(self):
956 driver = neutron_plugin_attribute(self.plugin, 'driver',
957 self.network_manager)
958 midonet_config = neutron_plugin_attribute(self.plugin, 'config',
959 self.network_manager)
960 mido_ctxt = {'core_plugin': driver,
961 'neutron_plugin': 'midonet',
962 'neutron_security_groups': self.neutron_security_groups,
963 'local_ip': unit_private_ip(),
964 'config': midonet_config}
965
966 return mido_ctxt
967
955 def __call__(self):968 def __call__(self):
956 if self.network_manager not in ['quantum', 'neutron']:969 if self.network_manager not in ['quantum', 'neutron']:
957 return {}970 return {}
@@ -973,6 +986,8 @@
973 ctxt.update(self.nuage_ctxt())986 ctxt.update(self.nuage_ctxt())
974 elif self.plugin == 'plumgrid':987 elif self.plugin == 'plumgrid':
975 ctxt.update(self.pg_ctxt())988 ctxt.update(self.pg_ctxt())
989 elif self.plugin == 'midonet':
990 ctxt.update(self.midonet_ctxt())
976991
977 alchemy_flags = config('neutron-alchemy-flags')992 alchemy_flags = config('neutron-alchemy-flags')
978 if alchemy_flags:993 if alchemy_flags:
@@ -1105,7 +1120,7 @@
11051120
1106 ctxt = {1121 ctxt = {
1107 ... other context ...1122 ... other context ...
1108 'subordinate_config': {1123 'subordinate_configuration': {
1109 'DEFAULT': {1124 'DEFAULT': {
1110 'key1': 'value1',1125 'key1': 'value1',
1111 },1126 },
@@ -1146,22 +1161,23 @@
1146 try:1161 try:
1147 sub_config = json.loads(sub_config)1162 sub_config = json.loads(sub_config)
1148 except:1163 except:
1149 log('Could not parse JSON from subordinate_config '1164 log('Could not parse JSON from '
1150 'setting from %s' % rid, level=ERROR)1165 'subordinate_configuration setting from %s'
1166 % rid, level=ERROR)
1151 continue1167 continue
11521168
1153 for service in self.services:1169 for service in self.services:
1154 if service not in sub_config:1170 if service not in sub_config:
1155 log('Found subordinate_config on %s but it contained'1171 log('Found subordinate_configuration on %s but it '
1156 'nothing for %s service' % (rid, service),1172 'contained nothing for %s service'
1157 level=INFO)1173 % (rid, service), level=INFO)
1158 continue1174 continue
11591175
1160 sub_config = sub_config[service]1176 sub_config = sub_config[service]
1161 if self.config_file not in sub_config:1177 if self.config_file not in sub_config:
1162 log('Found subordinate_config on %s but it contained'1178 log('Found subordinate_configuration on %s but it '
1163 'nothing for %s' % (rid, self.config_file),1179 'contained nothing for %s'
1164 level=INFO)1180 % (rid, self.config_file), level=INFO)
1165 continue1181 continue
11661182
1167 sub_config = sub_config[self.config_file]1183 sub_config = sub_config[self.config_file]
11681184
=== modified file 'hooks/charmhelpers/contrib/openstack/neutron.py'
--- hooks/charmhelpers/contrib/openstack/neutron.py 2015-09-28 11:18:48 +0000
+++ hooks/charmhelpers/contrib/openstack/neutron.py 2015-10-19 14:53:22 +0000
@@ -209,6 +209,20 @@
209 'server_packages': ['neutron-server',209 'server_packages': ['neutron-server',
210 'neutron-plugin-plumgrid'],210 'neutron-plugin-plumgrid'],
211 'server_services': ['neutron-server']211 'server_services': ['neutron-server']
212 },
213 'midonet': {
214 'config': '/etc/neutron/plugins/midonet/midonet.ini',
215 'driver': 'midonet.neutron.plugin.MidonetPluginV2',
216 'contexts': [
217 context.SharedDBContext(user=config('neutron-database-user'),
218 database=config('neutron-database'),
219 relation_prefix='neutron',
220 ssl_dir=NEUTRON_CONF_DIR)],
221 'services': [],
222 'packages': [[headers_package()] + determine_dkms_package()],
223 'server_packages': ['neutron-server',
224 'python-neutron-plugin-midonet'],
225 'server_services': ['neutron-server']
212 }226 }
213 }227 }
214 if release >= 'icehouse':228 if release >= 'icehouse':
215229
=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
--- hooks/charmhelpers/contrib/openstack/utils.py 2015-09-28 09:44:36 +0000
+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-10-19 14:53:22 +0000
@@ -121,6 +121,7 @@
121 ('2.2.2', 'kilo'),121 ('2.2.2', 'kilo'),
122 ('2.3.0', 'liberty'),122 ('2.3.0', 'liberty'),
123 ('2.4.0', 'liberty'),123 ('2.4.0', 'liberty'),
124 ('2.5.0', 'liberty'),
124])125])
125126
126# >= Liberty version->codename mapping127# >= Liberty version->codename mapping
127128
=== modified file 'hooks/charmhelpers/core/host.py'
--- hooks/charmhelpers/core/host.py 2015-09-21 22:51:02 +0000
+++ hooks/charmhelpers/core/host.py 2015-10-19 14:53:22 +0000
@@ -566,7 +566,14 @@
566 os.chdir(cur)566 os.chdir(cur)
567567
568568
569def chownr(path, owner, group, follow_links=True):569def chownr(path, owner, group, follow_links=True, chowntopdir=False):
570 """
571 Recursively change user and group ownership of files and directories
572 in given path. Doesn't chown path itself by default, only its children.
573
574 :param bool follow_links: Also Chown links if True
575 :param bool chowntopdir: Also chown path itself if True
576 """
570 uid = pwd.getpwnam(owner).pw_uid577 uid = pwd.getpwnam(owner).pw_uid
571 gid = grp.getgrnam(group).gr_gid578 gid = grp.getgrnam(group).gr_gid
572 if follow_links:579 if follow_links:
@@ -574,6 +581,10 @@
574 else:581 else:
575 chown = os.lchown582 chown = os.lchown
576583
584 if chowntopdir:
585 broken_symlink = os.path.lexists(path) and not os.path.exists(path)
586 if not broken_symlink:
587 chown(path, uid, gid)
577 for root, dirs, files in os.walk(path):588 for root, dirs, files in os.walk(path):
578 for name in dirs + files:589 for name in dirs + files:
579 full = os.path.join(root, name)590 full = os.path.join(root, name)
580591
=== modified file 'tests/021-basic-wily-liberty' (properties changed: -x to +x)
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2015-10-19 09:32:10 +0000
+++ tests/basic_deployment.py 2015-10-19 14:53:22 +0000
@@ -1,5 +1,3 @@
1#!/usr/bin/python
2
3import amulet1import amulet
4import os2import os
5import time3import time
@@ -47,7 +45,9 @@
47 other_services = [{'name': 'mysql'},45 other_services = [{'name': 'mysql'},
48 {'name': 'rabbitmq-server'},46 {'name': 'rabbitmq-server'},
49 {'name': 'keystone'},47 {'name': 'keystone'},
48 {'name': 'glance'}, # satisfy workload status
50 {'name': 'nova-cloud-controller'},49 {'name': 'nova-cloud-controller'},
50 {'name': 'nova-compute'}, # satisfy workload stat
51 {'name': 'neutron-api'}]51 {'name': 'neutron-api'}]
5252
53 super(NeutronGatewayBasicDeployment, self)._add_services(53 super(NeutronGatewayBasicDeployment, self)._add_services(
@@ -68,7 +68,15 @@
68 'neutron-api:shared-db': 'mysql:shared-db',68 'neutron-api:shared-db': 'mysql:shared-db',
69 'neutron-api:amqp': 'rabbitmq-server:amqp',69 'neutron-api:amqp': 'rabbitmq-server:amqp',
70 'neutron-api:neutron-api': 'nova-cloud-controller:neutron-api',70 'neutron-api:neutron-api': 'nova-cloud-controller:neutron-api',
71 'neutron-api:identity-service': 'keystone:identity-service'71 'neutron-api:identity-service': 'keystone:identity-service',
72 'glance:identity-service': 'keystone:identity-service',
73 'glance:shared-db': 'mysql:shared-db',
74 'glance:amqp': 'rabbitmq-server:amqp',
75 'nova-cloud-controller:cloud-compute': 'nova-compute:'
76 'cloud-compute',
77 'nova-compute:amqp': 'rabbitmq-server:amqp',
78 'nova-compute:image-service': 'glance:image-service',
79 'nova-cloud-controller:image-service': 'glance:image-service',
72 }80 }
73 super(NeutronGatewayBasicDeployment, self)._add_relations(relations)81 super(NeutronGatewayBasicDeployment, self)._add_relations(relations)
7482
@@ -947,6 +955,7 @@
947 self.neutron.create_network({'network': network})955 self.neutron.create_network({'network': network})
948956
949 networks = self.neutron.list_networks(name=net_name)957 networks = self.neutron.list_networks(name=net_name)
958 u.log.debug('Networks: {}'.format(networks))
950 net_len = len(networks['networks'])959 net_len = len(networks['networks'])
951 if net_len != 1:960 if net_len != 1:
952 msg = "Expected 1 network, found {}".format(net_len)961 msg = "Expected 1 network, found {}".format(net_len)
953962
=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-09-28 10:06:18 +0000
+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-19 14:53:22 +0000
@@ -14,6 +14,7 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
1616
17import re
17import six18import six
18from collections import OrderedDict19from collections import OrderedDict
19from charmhelpers.contrib.amulet.deployment import (20from charmhelpers.contrib.amulet.deployment import (
@@ -114,6 +115,45 @@
114 for service, config in six.iteritems(configs):115 for service, config in six.iteritems(configs):
115 self.d.configure(service, config)116 self.d.configure(service, config)
116117
118 def _auto_wait_for_status(self, message=None, exclude_services=None,
119 timeout=1800):
120 """Wait for all units to have a specific extended status, except
121 for any defined as excluded. Unless specified via message, any
122 status containing any case of 'ready' will be considered a match.
123
124 Examples of message usage:
125
126 Wait for all unit status to CONTAIN any case of 'ready' or 'ok':
127 message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE)
128
129 Wait for all units to reach this status (exact match):
130 message = 'Unit is ready'
131
132 Wait for all units to reach any one of these (exact match):
133 message = re.compile('Unit is ready|OK|Ready')
134
135 Wait for at least one unit to reach this status (exact match):
136 message = {'ready'}
137
138 See Amulet's sentry.wait_for_messages() for message usage detail.
139 https://github.com/juju/amulet/blob/master/amulet/sentry.py
140
141 :param message: Expected status match
142 :param exclude_services: List of juju service names to ignore
143 :param timeout: Maximum time in seconds to wait for status match
144 :returns: None. Raises if timeout is hit.
145 """
146
147 if not message:
148 message = re.compile('.*ready.*', re.IGNORECASE)
149
150 if not exclude_services:
151 exclude_services = []
152
153 services = list(set(self.d.services.keys()) - set(exclude_services))
154 service_messages = {service: message for service in services}
155 self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
156
117 def _get_openstack_release(self):157 def _get_openstack_release(self):
118 """Get openstack release.158 """Get openstack release.
119159

Subscribers

People subscribed via source and target branches