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
=== modified file 'Makefile'
--- Makefile 2014-07-25 09:37:25 +0000
+++ Makefile 2014-10-09 12:21:58 +0000
@@ -26,7 +26,8 @@
26 # /!\ Note: The -v should only be temporary until Amulet sends26 # /!\ Note: The -v should only be temporary until Amulet sends
27 # raise_status() messages to stderr:27 # raise_status() messages to stderr:
28 # https://bugs.launchpad.net/amulet/+bug/132035728 # https://bugs.launchpad.net/amulet/+bug/1320357
29 @juju test -v -p AMULET_HTTP_PROXY29 @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
30 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
3031
31publish: lint unit_test32publish: lint unit_test
32 bzr push lp:charms/glance33 bzr push lp:charms/glance
3334
=== modified file 'tests/00-setup'
--- tests/00-setup 2014-07-11 14:11:03 +0000
+++ tests/00-setup 2014-10-09 12:21:58 +0000
@@ -4,7 +4,7 @@
44
5sudo add-apt-repository --yes ppa:juju/stable5sudo add-apt-repository --yes ppa:juju/stable
6sudo apt-get update --yes6sudo apt-get update --yes
7sudo apt-get install --yes python-amulet7sudo apt-get install --yes python-amulet \
8sudo apt-get install --yes python-keystoneclient8 python-keystoneclient \
9sudo apt-get install --yes python-glanceclient9 python-glanceclient \
1010 python-novaclient
1111
=== modified file 'tests/README'
--- tests/README 2014-07-11 14:11:03 +0000
+++ tests/README 2014-10-09 12:21:58 +0000
@@ -1,6 +1,12 @@
1This directory provides Amulet tests that focus on verification of Glance1This directory provides Amulet tests that focus on verification of Glance
2deployments.2deployments.
33
4In order to run tests, you'll need charm-tools installed (in addition to
5juju, of course):
6 sudo add-apt-repository ppa:juju/stable
7 sudo apt-get update
8 sudo apt-get install charm-tools
9
4If you use a web proxy server to access the web, you'll need to set the10If you use a web proxy server to access the web, you'll need to set the
5AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.11AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
612
713
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2014-07-11 14:11:03 +0000
+++ tests/basic_deployment.py 2014-10-09 12:21:58 +0000
@@ -1,7 +1,6 @@
1#!/usr/bin/python1#!/usr/bin/python
22
3import amulet3import amulet
4import time
54
6from charmhelpers.contrib.openstack.amulet.deployment import (5from charmhelpers.contrib.openstack.amulet.deployment import (
7 OpenStackAmuletDeployment6 OpenStackAmuletDeployment
@@ -24,9 +23,9 @@
24# * Add tests with different storage back ends23# * Add tests with different storage back ends
25# * Resolve Essex->Havana juju set charm bug24# * Resolve Essex->Havana juju set charm bug
2625
27 def __init__(self, series=None, openstack=None, source=None):26 def __init__(self, series=None, openstack=None, source=None, stable=False):
28 '''Deploy the entire test environment.'''27 '''Deploy the entire test environment.'''
29 super(GlanceBasicDeployment, self).__init__(series, openstack, source)28 super(GlanceBasicDeployment, self).__init__(series, openstack, source, stable)
30 self._add_services()29 self._add_services()
31 self._add_relations()30 self._add_relations()
32 self._configure_services()31 self._configure_services()
@@ -34,11 +33,15 @@
34 self._initialize_tests()33 self._initialize_tests()
3534
36 def _add_services(self):35 def _add_services(self):
37 '''Add the service that we're testing, including the number of units,36 '''Add services
38 where this charm is local, and the other charms are from37
39 the charm store.'''38 Add the services that we're testing, where glance is local,
40 this_service = ('glance', 1)39 and the rest of the service are from lp branches that are
41 other_services = [('mysql', 1), ('rabbitmq-server', 1), ('keystone', 1)]40 compatible with the local charm (e.g. stable or next).
41 '''
42 this_service = {'name': 'glance'}
43 other_services = [{'name': 'mysql'}, {'name': 'rabbitmq-server'},
44 {'name': 'keystone'}]
42 super(GlanceBasicDeployment, self)._add_services(this_service,45 super(GlanceBasicDeployment, self)._add_services(this_service,
43 other_services)46 other_services)
4447
@@ -377,7 +380,7 @@
377 # Section and directive for this config changed in icehouse380 # Section and directive for this config changed in icehouse
378 expected = {'sql_connection': db_uri, 'sql_idle_timeout': '3600'}381 expected = {'sql_connection': db_uri, 'sql_idle_timeout': '3600'}
379 section = 'DEFAULT'382 section = 'DEFAULT'
380 383
381 ret = u.validate_config_data(unit, conf, section, expected) 384 ret = u.validate_config_data(unit, conf, section, expected)
382 if ret:385 if ret:
383 message = "glance db config error: {}".format(ret)386 message = "glance db config error: {}".format(ret)
@@ -438,42 +441,51 @@
438 amulet.raise_status(amulet.FAIL,441 amulet.raise_status(amulet.FAIL,
439 msg='keystone endpoint: {}'.format(ret))442 msg='keystone endpoint: {}'.format(ret))
440443
441 def test_glance_restart_on_config_change(self):444 def _change_config(self):
442 '''Verify that glance is restarted when the config is changed.'''445 if self._get_openstack_release() > self.precise_havana:
443446 self.d.configure('glance', {'debug': 'True'})
444 # Make config change to trigger a service restart447 else:
445 if self._get_openstack_release() > self.precise_havana:448 self.d.configure('glance', {'debug': 'False'})
446 self.d.configure('glance', {'verbose': 'True'})449
447 self.d.configure('glance', {'debug': 'True'})450 def _restore_config(self):
448 elif self._get_openstack_release() <= self.precise_havana:451 if self._get_openstack_release() > self.precise_havana:
452 self.d.configure('glance', {'debug': 'False'})
453 else:
454 self.d.configure('glance', {'debug': 'True'})
455
456 def test_z_glance_restart_on_config_change(self):
457 '''Verify that glance is restarted when the config is changed.
458
459 Note(coreycb): The method name with the _z_ is a little odd
460 but it forces the test to run last. It just makes things
461 easier because restarting services requires re-authorization.
462 '''
463 if self._get_openstack_release() <= self.precise_havana:
449 # /!\ NOTE(beisner): Glance charm before Icehouse doesn't respond464 # /!\ NOTE(beisner): Glance charm before Icehouse doesn't respond
450 # to attempted config changes via juju / juju set.465 # to attempted config changes via juju / juju set.
451 # https://bugs.launchpad.net/charms/+source/glance/+bug/1340307466 # https://bugs.launchpad.net/charms/+source/glance/+bug/1340307
452
453 u.log.error('NOTE(beisner): skipping glance restart on config ' +467 u.log.error('NOTE(beisner): skipping glance restart on config ' +
454 'change check due to bug 1340307.')468 'change check due to bug 1340307.')
455 return469 return
456 self.d.configure('glance', {'verbose': 'False'})470
457 self.d.configure('glance', {'debug': 'False'})471 # Make config change to trigger a service restart
472 self._change_config()
458473
459 if not u.service_restarted(self.glance_sentry, 'glance-api',474 if not u.service_restarted(self.glance_sentry, 'glance-api',
460 '/etc/glance/glance-api.conf'):475 '/etc/glance/glance-api.conf'):
476 self._restore_config()
461 message = "glance service didn't restart after config change"477 message = "glance service didn't restart after config change"
462 amulet.raise_status(amulet.FAIL, msg=message)478 amulet.raise_status(amulet.FAIL, msg=message)
463479
464 if not u.service_restarted(self.glance_sentry, 'glance-registry',480 if not u.service_restarted(self.glance_sentry, 'glance-registry',
465 '/etc/glance/glance-registry.conf',481 '/etc/glance/glance-registry.conf',
466 sleep_time=0):482 sleep_time=0):
483 self._restore_config()
467 message = "glance service didn't restart after config change"484 message = "glance service didn't restart after config change"
468 amulet.raise_status(amulet.FAIL, msg=message)485 amulet.raise_status(amulet.FAIL, msg=message)
469 486
470 # Return to original config487 # Return to original config
471 if self._get_openstack_release() > self.precise_havana:488 self._restore_config()
472 self.d.configure('glance', {'verbose': 'False'})
473 self.d.configure('glance', {'debug': 'False'})
474 else:
475 self.d.configure('glance', {'verbose': 'True'})
476 self.d.configure('glance', {'debug': 'True'})
477489
478 def test_users(self):490 def test_users(self):
479 '''Verify expected users.'''491 '''Verify expected users.'''

Subscribers

People subscribed via source and target branches