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

Proposed by Corey Bryant
Status: Merged
Merged at revision: 74
Proposed branch: lp:~corey.bryant/charms/trusty/glance/amulet-updates
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 170 lines (+51/-32)
4 files modified
Makefile (+2/-1)
tests/00-setup (+4/-4)
tests/README (+6/-0)
tests/basic_deployment.py (+39/-27)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/glance/amulet-updates
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+237770@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-07-25 09:37:25 +0000
3+++ Makefile 2014-10-09 12:21:58 +0000
4@@ -26,7 +26,8 @@
5 # /!\ 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 publish: lint unit_test
13 bzr push lp:charms/glance
14
15=== modified file 'tests/00-setup'
16--- tests/00-setup 2014-07-11 14:11:03 +0000
17+++ tests/00-setup 2014-10-09 12:21:58 +0000
18@@ -4,7 +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-glanceclient
25-
26+sudo apt-get install --yes python-amulet \
27+ python-keystoneclient \
28+ python-glanceclient \
29+ python-novaclient
30
31=== modified file 'tests/README'
32--- tests/README 2014-07-11 14:11:03 +0000
33+++ tests/README 2014-10-09 12:21:58 +0000
34@@ -1,6 +1,12 @@
35 This directory provides Amulet tests that focus on verification of Glance
36 deployments.
37
38+In order to run tests, you'll need charm-tools installed (in addition to
39+juju, of course):
40+ sudo add-apt-repository ppa:juju/stable
41+ sudo apt-get update
42+ sudo apt-get install charm-tools
43+
44 If you use a web proxy server to access the web, you'll need to set the
45 AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
46
47
48=== modified file 'tests/basic_deployment.py'
49--- tests/basic_deployment.py 2014-07-11 14:11:03 +0000
50+++ tests/basic_deployment.py 2014-10-09 12:21:58 +0000
51@@ -1,7 +1,6 @@
52 #!/usr/bin/python
53
54 import amulet
55-import time
56
57 from charmhelpers.contrib.openstack.amulet.deployment import (
58 OpenStackAmuletDeployment
59@@ -24,9 +23,9 @@
60 # * Add tests with different storage back ends
61 # * Resolve Essex->Havana juju set charm bug
62
63- def __init__(self, series=None, openstack=None, source=None):
64+ def __init__(self, series=None, openstack=None, source=None, stable=False):
65 '''Deploy the entire test environment.'''
66- super(GlanceBasicDeployment, self).__init__(series, openstack, source)
67+ super(GlanceBasicDeployment, self).__init__(series, openstack, source, stable)
68 self._add_services()
69 self._add_relations()
70 self._configure_services()
71@@ -34,11 +33,15 @@
72 self._initialize_tests()
73
74 def _add_services(self):
75- '''Add the service that we're testing, including the number of units,
76- where this charm is local, and the other charms are from
77- the charm store.'''
78- this_service = ('glance', 1)
79- other_services = [('mysql', 1), ('rabbitmq-server', 1), ('keystone', 1)]
80+ '''Add services
81+
82+ Add the services that we're testing, where glance is local,
83+ and the rest of the service are from lp branches that are
84+ compatible with the local charm (e.g. stable or next).
85+ '''
86+ this_service = {'name': 'glance'}
87+ other_services = [{'name': 'mysql'}, {'name': 'rabbitmq-server'},
88+ {'name': 'keystone'}]
89 super(GlanceBasicDeployment, self)._add_services(this_service,
90 other_services)
91
92@@ -377,7 +380,7 @@
93 # Section and directive for this config changed in icehouse
94 expected = {'sql_connection': db_uri, 'sql_idle_timeout': '3600'}
95 section = 'DEFAULT'
96-
97+
98 ret = u.validate_config_data(unit, conf, section, expected)
99 if ret:
100 message = "glance db config error: {}".format(ret)
101@@ -438,42 +441,51 @@
102 amulet.raise_status(amulet.FAIL,
103 msg='keystone endpoint: {}'.format(ret))
104
105- def test_glance_restart_on_config_change(self):
106- '''Verify that glance is restarted when the config is changed.'''
107-
108- # Make config change to trigger a service restart
109- if self._get_openstack_release() > self.precise_havana:
110- self.d.configure('glance', {'verbose': 'True'})
111- self.d.configure('glance', {'debug': 'True'})
112- elif self._get_openstack_release() <= self.precise_havana:
113+ def _change_config(self):
114+ if self._get_openstack_release() > self.precise_havana:
115+ self.d.configure('glance', {'debug': 'True'})
116+ else:
117+ self.d.configure('glance', {'debug': 'False'})
118+
119+ def _restore_config(self):
120+ if self._get_openstack_release() > self.precise_havana:
121+ self.d.configure('glance', {'debug': 'False'})
122+ else:
123+ self.d.configure('glance', {'debug': 'True'})
124+
125+ def test_z_glance_restart_on_config_change(self):
126+ '''Verify that glance is restarted when the config is changed.
127+
128+ Note(coreycb): The method name with the _z_ is a little odd
129+ but it forces the test to run last. It just makes things
130+ easier because restarting services requires re-authorization.
131+ '''
132+ if self._get_openstack_release() <= self.precise_havana:
133 # /!\ NOTE(beisner): Glance charm before Icehouse doesn't respond
134 # to attempted config changes via juju / juju set.
135 # https://bugs.launchpad.net/charms/+source/glance/+bug/1340307
136-
137 u.log.error('NOTE(beisner): skipping glance restart on config ' +
138 'change check due to bug 1340307.')
139 return
140- self.d.configure('glance', {'verbose': 'False'})
141- self.d.configure('glance', {'debug': 'False'})
142+
143+ # Make config change to trigger a service restart
144+ self._change_config()
145
146 if not u.service_restarted(self.glance_sentry, 'glance-api',
147 '/etc/glance/glance-api.conf'):
148+ self._restore_config()
149 message = "glance service didn't restart after config change"
150 amulet.raise_status(amulet.FAIL, msg=message)
151
152 if not u.service_restarted(self.glance_sentry, 'glance-registry',
153 '/etc/glance/glance-registry.conf',
154 sleep_time=0):
155+ self._restore_config()
156 message = "glance service didn't restart after config change"
157 amulet.raise_status(amulet.FAIL, msg=message)
158-
159+
160 # Return to original config
161- if self._get_openstack_release() > self.precise_havana:
162- self.d.configure('glance', {'verbose': 'False'})
163- self.d.configure('glance', {'debug': 'False'})
164- else:
165- self.d.configure('glance', {'verbose': 'True'})
166- self.d.configure('glance', {'debug': 'True'})
167+ self._restore_config()
168
169 def test_users(self):
170 '''Verify expected users.'''

Subscribers

People subscribed via source and target branches