Merge lp:~1chb1n/charms/trusty/swift-proxy/amulet-update-1508 into lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next

Proposed by Ryan Beisner on 2015-10-05
Status: Merged
Merged at revision: 116
Proposed branch: lp:~1chb1n/charms/trusty/swift-proxy/amulet-update-1508
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next
Diff against target: 1193 lines (+382/-601)
7 files modified
Makefile (+7/-8)
tests/00-setup (+9/-3)
tests/020-basic-trusty-liberty (+11/-0)
tests/021-basic-wily-liberty (+9/-0)
tests/README (+10/-0)
tests/basic_deployment.py (+316/-590)
tests/tests.yaml (+20/-0)
To merge this branch: bzr merge lp:~1chb1n/charms/trusty/swift-proxy/amulet-update-1508
Reviewer Review Type Date Requested Status
Liam Young 2015-10-05 Pending
Billy Olsen 2015-10-05 Pending
Review via email: mp+273445@code.launchpad.net

This proposal supersedes a proposal from 2015-08-21.

Description of the Change

Update amulet tests, enable T-K, V-K, prep for T-L and W-L. Clean up old lint, remove tests for deprecated releases.

To post a comment you must log in.
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #8488 swift-proxy-next for 1chb1n mp268790
    LINT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7879 swift-proxy-next for 1chb1n mp268790
    UNIT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5948 swift-proxy-next for 1chb1n mp268790
    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/12143916/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5948/

Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal

FYI, infrastructure issue on amulet test 5948, re-kicking.

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5950 swift-proxy-next for 1chb1n mp268790
    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/12145611/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5950/

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #8540 swift-proxy-next for 1chb1n mp268790
    LINT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7928 swift-proxy-next for 1chb1n mp268790
    UNIT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7929 swift-proxy-next for 1chb1n mp268790
    UNIT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #8543 swift-proxy-next for 1chb1n mp268790
    LINT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5955 swift-proxy-next for 1chb1n mp268790
    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/12148617/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5955/

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5957 swift-proxy-next for 1chb1n mp268790
    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/12148730/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5957/

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #8546 swift-proxy-next for 1chb1n mp268790
    LINT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7934 swift-proxy-next for 1chb1n mp268790
    UNIT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5961 swift-proxy-next for 1chb1n mp268790
    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/12149151/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5961/

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7987 swift-proxy-next for 1chb1n mp268790
    UNIT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #8650 swift-proxy-next for 1chb1n mp268790
    LINT OK: passed

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

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #6015 swift-proxy-next for 1chb1n mp268790
    AMULET OK: passed

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

Liam Young (gnuoy) wrote : Posted in a previous version of this proposal

This lgtm but there are text conflicts:

conflicts:
  Text conflict in Makefile
  Text conflict in tests/basic_deployment.py

Happy to merge once these are resolved

review: Needs Fixing

charm_lint_check #11328 swift-proxy-next for 1chb1n mp273445
    LINT OK: passed

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

charm_unit_test #10522 swift-proxy-next for 1chb1n mp273445
    UNIT OK: passed

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

charm_amulet_test #7113 swift-proxy-next for 1chb1n mp273445
    AMULET OK: passed

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

Corey Bryant (corey.bryant) wrote :

There are no more merge conflicts so I've taken gnuoy's lgtm as a +1 and merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-09-07 13:44:04 +0000
3+++ Makefile 2015-10-05 16:57:32 +0000
4@@ -1,18 +1,17 @@
5 PYTHON := /usr/bin/env python
6
7 lint:
8- @flake8 --exclude hooks unit_tests tests lib
9+ @flake8 --exclude hooks/charmhelpers,tests/charmhelpers \
10+ hooks unit_tests tests lib
11 @charm proof
12
13-unit_test:
14+test:
15+ @# Bundletester expects unit tests here.
16 @echo Starting unit tests...
17- @$(PYTHON) /usr/bin/nosetests --nologcapture --with-coverage unit_tests
18+ @$(PYTHON) /usr/bin/nosetests -v --nologcapture --with-coverage unit_tests
19
20-test:
21+functional_test:
22 @echo Starting Amulet tests...
23- # coreycb note: The -v should only be temporary until Amulet sends
24- # raise_status() messages to stderr:
25- # https://bugs.launchpad.net/amulet/+bug/1320357
26 @juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700
27
28 bin/charm_helpers_sync.py:
29@@ -24,7 +23,7 @@
30 @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml
31 @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-tests.yaml
32
33-publish: lint unit_test
34+publish: lint test
35 bzr push lp:charms/swift-proxy
36 bzr push lp:charms/trusty/swift-proxy
37
38
39=== modified file 'tests/00-setup'
40--- tests/00-setup 2014-09-29 21:11:28 +0000
41+++ tests/00-setup 2015-10-05 16:57:32 +0000
42@@ -4,8 +4,14 @@
43
44 sudo add-apt-repository --yes ppa:juju/stable
45 sudo apt-get update --yes
46-sudo apt-get install --yes python-amulet \
47- python-swiftclient \
48+sudo apt-get install --yes amulet \
49+ distro-info-data \
50+ python-cinderclient \
51+ python-distro-info \
52 python-glanceclient \
53+ python-heatclient \
54 python-keystoneclient \
55- python-novaclient
56+ python-neutronclient \
57+ python-novaclient \
58+ python-pika \
59+ python-swiftclient
60
61=== modified file 'tests/010-basic-precise-essex' (properties changed: +x to -x)
62=== modified file 'tests/017-basic-trusty-kilo' (properties changed: -x to +x)
63=== modified file 'tests/019-basic-vivid-kilo' (properties changed: -x to +x)
64=== added file 'tests/020-basic-trusty-liberty'
65--- tests/020-basic-trusty-liberty 1970-01-01 00:00:00 +0000
66+++ tests/020-basic-trusty-liberty 2015-10-05 16:57:32 +0000
67@@ -0,0 +1,11 @@
68+#!/usr/bin/python
69+
70+"""Amulet tests on a basic swift-proxy deployment on trusty-liberty."""
71+
72+from basic_deployment import SwiftProxyBasicDeployment
73+
74+if __name__ == '__main__':
75+ deployment = SwiftProxyBasicDeployment(series='trusty',
76+ openstack='cloud:trusty-liberty',
77+ source='cloud:trusty-updates/liberty')
78+ deployment.run_tests()
79
80=== added file 'tests/021-basic-wily-liberty'
81--- tests/021-basic-wily-liberty 1970-01-01 00:00:00 +0000
82+++ tests/021-basic-wily-liberty 2015-10-05 16:57:32 +0000
83@@ -0,0 +1,9 @@
84+#!/usr/bin/python
85+
86+"""Amulet tests on a basic swift-proxy deployment on wily-liberty."""
87+
88+from basic_deployment import SwiftProxyBasicDeployment
89+
90+if __name__ == '__main__':
91+ deployment = SwiftProxyBasicDeployment(series='wily')
92+ deployment.run_tests()
93
94=== modified file 'tests/README'
95--- tests/README 2014-09-29 21:11:28 +0000
96+++ tests/README 2015-10-05 16:57:32 +0000
97@@ -1,6 +1,16 @@
98 This directory provides Amulet tests that focus on verification of swift-proxy
99 deployments.
100
101+test_* methods are called in lexical sort order, although each individual test
102+should be idempotent, and expected to pass regardless of run order.
103+
104+Test name convention to ensure desired test order:
105+ 1xx service and endpoint checks
106+ 2xx relation checks
107+ 3xx config checks
108+ 4xx functional checks
109+ 9xx restarts and other final checks
110+
111 In order to run tests, you'll need charm-tools installed (in addition to
112 juju, of course):
113 sudo add-apt-repository ppa:juju/stable
114
115=== modified file 'tests/basic_deployment.py'
116--- tests/basic_deployment.py 2015-09-09 16:49:17 +0000
117+++ tests/basic_deployment.py 2015-10-05 16:57:32 +0000
118@@ -1,3 +1,4 @@
119+import time
120 import amulet
121 import swiftclient
122
123@@ -7,8 +8,7 @@
124
125 from charmhelpers.contrib.openstack.amulet.utils import (
126 OpenStackAmuletUtils,
127- DEBUG, # flake8: noqa
128- ERROR
129+ DEBUG
130 )
131
132 # Use DEBUG to turn on debug logging
133@@ -36,36 +36,46 @@
134 compatible with the local charm (e.g. stable or next).
135 """
136 this_service = {'name': 'swift-proxy'}
137- other_services = [{'name': 'mysql'}, {'name': 'keystone'},
138- {'name': 'glance'}, {'name': 'swift-storage'}]
139+ other_services = [{'name': 'mysql'},
140+ {'name': 'keystone'},
141+ {'name': 'glance'},
142+ {'name': 'swift-storage'}]
143 super(SwiftProxyBasicDeployment, self)._add_services(this_service,
144 other_services)
145
146 def _add_relations(self):
147 """Add all of the relations for the services."""
148 relations = {
149- 'keystone:shared-db': 'mysql:shared-db',
150- 'swift-proxy:identity-service': 'keystone:identity-service',
151- 'swift-storage:swift-storage': 'swift-proxy:swift-storage',
152- 'glance:identity-service': 'keystone:identity-service',
153- 'glance:shared-db': 'mysql:shared-db',
154- 'glance:object-store': 'swift-proxy:object-store'
155+ 'keystone:shared-db': 'mysql:shared-db',
156+ 'swift-proxy:identity-service': 'keystone:identity-service',
157+ 'swift-storage:swift-storage': 'swift-proxy:swift-storage',
158+ 'glance:identity-service': 'keystone:identity-service',
159+ 'glance:shared-db': 'mysql:shared-db',
160+ 'glance:object-store': 'swift-proxy:object-store'
161 }
162 super(SwiftProxyBasicDeployment, self)._add_relations(relations)
163
164 def _configure_services(self):
165 """Configure all of the services."""
166- keystone_config = {'admin-password': 'openstack',
167- 'admin-token': 'ubuntutesting'}
168- swift_proxy_config = {'zone-assignment': 'manual',
169- 'replicas': '1',
170- 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'}
171- swift_storage_config = {'zone': '1',
172- 'block-device': 'vdb',
173- 'overwrite': 'true'}
174- configs = {'keystone': keystone_config,
175- 'swift-proxy': swift_proxy_config,
176- 'swift-storage': swift_storage_config}
177+ keystone_config = {
178+ 'admin-password': 'openstack',
179+ 'admin-token': 'ubuntutesting'
180+ }
181+ swift_proxy_config = {
182+ 'zone-assignment': 'manual',
183+ 'replicas': '1',
184+ 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'
185+ }
186+ swift_storage_config = {
187+ 'zone': '1',
188+ 'block-device': 'vdb',
189+ 'overwrite': 'true'
190+ }
191+ configs = {
192+ 'keystone': keystone_config,
193+ 'swift-proxy': swift_proxy_config,
194+ 'swift-storage': swift_storage_config
195+ }
196 super(SwiftProxyBasicDeployment, self)._configure_services(configs)
197
198 def _initialize_tests(self):
199@@ -77,6 +87,14 @@
200 self.swift_proxy_sentry = self.d.sentry.unit['swift-proxy/0']
201 self.swift_storage_sentry = self.d.sentry.unit['swift-storage/0']
202
203+ u.log.debug('openstack release val: {}'.format(
204+ self._get_openstack_release()))
205+ u.log.debug('openstack release str: {}'.format(
206+ self._get_openstack_release_string()))
207+
208+ # Let things settle a bit before moving forward
209+ time.sleep(30)
210+
211 # Authenticate admin with keystone
212 self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
213 user='admin',
214@@ -87,15 +105,16 @@
215 self.glance = u.authenticate_glance_admin(self.keystone)
216
217 # Authenticate swift user
218- keystone_relation = self.keystone_sentry.relation('identity-service',
219- 'swift-proxy:identity-service')
220+ keystone_relation = self.keystone_sentry.relation(
221+ 'identity-service', 'swift-proxy:identity-service')
222 ep = self.keystone.service_catalog.url_for(service_type='identity',
223 endpoint_type='publicURL')
224- self.swift = swiftclient.Connection(authurl=ep,
225- user=keystone_relation['service_username'],
226- key=keystone_relation['service_password'],
227- tenant_name=keystone_relation['service_tenant'],
228- auth_version='2.0')
229+ self.swift = swiftclient.Connection(
230+ authurl=ep,
231+ user=keystone_relation['service_username'],
232+ key=keystone_relation['service_password'],
233+ tenant_name=keystone_relation['service_tenant'],
234+ auth_version='2.0')
235
236 # Create a demo tenant/role/user
237 self.demo_tenant = 'demoTenant'
238@@ -117,38 +136,39 @@
239 password='password',
240 tenant=self.demo_tenant)
241
242- def test_services(self):
243+ def test_100_services(self):
244 """Verify the expected services are running on the corresponding
245 service units."""
246- swift_storage_services = ['status swift-account',
247- 'status swift-account-auditor',
248- 'status swift-account-reaper',
249- 'status swift-account-replicator',
250- 'status swift-container',
251- 'status swift-container-auditor',
252- 'status swift-container-replicator',
253- 'status swift-container-updater',
254- 'status swift-object',
255- 'status swift-object-auditor',
256- 'status swift-object-replicator',
257- 'status swift-object-updater']
258- if self._get_openstack_release() >= self.precise_icehouse:
259- swift_storage_services.append('status swift-container-sync')
260-
261- commands = {
262- self.mysql_sentry: ['status mysql'],
263- self.keystone_sentry: ['status keystone'],
264- self.glance_sentry: ['status glance-registry', 'status glance-api'],
265- self.swift_proxy_sentry: ['status swift-proxy'],
266+ u.log.debug('Checking system services...')
267+ swift_storage_services = ['swift-account',
268+ 'swift-account-auditor',
269+ 'swift-account-reaper',
270+ 'swift-account-replicator',
271+ 'swift-container',
272+ 'swift-container-auditor',
273+ 'swift-container-replicator',
274+ 'swift-container-updater',
275+ 'swift-object',
276+ 'swift-object-auditor',
277+ 'swift-object-replicator',
278+ 'swift-object-updater',
279+ 'swift-container-sync']
280+ service_names = {
281+ self.mysql_sentry: ['mysql'],
282+ self.keystone_sentry: ['keystone'],
283+ self.glance_sentry: ['glance-registry',
284+ 'glance-api'],
285+ self.swift_proxy_sentry: ['swift-proxy'],
286 self.swift_storage_sentry: swift_storage_services
287 }
288
289- ret = u.validate_services(commands)
290+ ret = u.validate_services_by_name(service_names)
291 if ret:
292 amulet.raise_status(amulet.FAIL, msg=ret)
293
294- def test_users(self):
295+ def test_102_users(self):
296 """Verify all existing roles."""
297+ u.log.debug('Checking keystone users...')
298 user1 = {'name': 'demoUser',
299 'enabled': True,
300 'tenantId': u.not_null,
301@@ -176,19 +196,15 @@
302 if ret:
303 amulet.raise_status(amulet.FAIL, msg=ret)
304
305- def test_service_catalog(self):
306+ def test_104_keystone_service_catalog(self):
307 """Verify that the service catalog endpoint data is valid."""
308- endpoint_vol = {'adminURL': u.valid_url,
309- 'region': 'RegionOne',
310- 'publicURL': u.valid_url,
311- 'internalURL': u.valid_url}
312+ u.log.debug('Checking keystone service catalog...')
313 endpoint_id = {'adminURL': u.valid_url,
314 'region': 'RegionOne',
315 'publicURL': u.valid_url,
316- 'internalURL': u.valid_url}
317- if self._get_openstack_release() >= self.precise_folsom:
318- endpoint_vol['id'] = u.not_null
319- endpoint_id['id'] = u.not_null
320+ 'internalURL': u.valid_url,
321+ 'id': u.not_null}
322+
323 expected = {'image': [endpoint_id], 'object-store': [endpoint_id],
324 'identity': [endpoint_id]}
325 actual = self.keystone_demo.service_catalog.get_endpoints()
326@@ -197,8 +213,9 @@
327 if ret:
328 amulet.raise_status(amulet.FAIL, msg=ret)
329
330- def test_openstack_object_store_endpoint(self):
331+ def test_106_swift_object_store_endpoint(self):
332 """Verify the swift object-store endpoint data."""
333+ u.log.debug('Checking keystone endpoint for swift object store...')
334 endpoints = self.keystone.endpoints.list()
335 admin_port = internal_port = public_port = '8080'
336 expected = {'id': u.not_null,
337@@ -214,8 +231,9 @@
338 message = 'object-store endpoint: {}'.format(ret)
339 amulet.raise_status(amulet.FAIL, msg=message)
340
341- def test_swift_proxy_identity_service_relation(self):
342- """Verify the swift-proxy to keystone identity-service relation data."""
343+ def test_200_swift_proxy_identity_service_relation(self):
344+ """Verify the swift-proxy to keystone identity relation data."""
345+ u.log.debug('Checking swift-proxy:keystone identity relation...')
346 unit = self.swift_proxy_sentry
347 relation = ['identity-service', 'keystone:identity-service']
348 expected = {
349@@ -233,8 +251,9 @@
350 message = u.relation_error('swift-proxy identity-service', ret)
351 amulet.raise_status(amulet.FAIL, msg=message)
352
353- def test_keystone_identity_service_relation(self):
354- """Verify the keystone to swift-proxy identity-service relation data."""
355+ def test_202_keystone_identity_service_relation(self):
356+ """Verify the keystone to swift-proxy identity relation data."""
357+ u.log.debug('Checking keystone:swift-proxy identity relation...')
358 unit = self.keystone_sentry
359 relation = ['identity-service', 'swift-proxy:identity-service']
360 expected = {
361@@ -257,9 +276,10 @@
362 message = u.relation_error('keystone identity-service', ret)
363 amulet.raise_status(amulet.FAIL, msg=message)
364
365- def test_swift_storage_swift_storage_relation(self):
366+ def test_204_swift_storage_swift_storage_relation(self):
367 """Verify the swift-storage to swift-proxy swift-storage relation
368 data."""
369+ u.log.debug('Checking swift:swift-proxy swift-storage relation...')
370 unit = self.swift_storage_sentry
371 relation = ['swift-storage', 'swift-proxy:swift-storage']
372 expected = {
373@@ -276,9 +296,10 @@
374 message = u.relation_error('swift-storage swift-storage', ret)
375 amulet.raise_status(amulet.FAIL, msg=message)
376
377- def test_swift_proxy_swift_storage_relation(self):
378+ def test_206_swift_proxy_swift_storage_relation(self):
379 """Verify the swift-proxy to swift-storage swift-storage relation
380 data."""
381+ u.log.debug('Checking swift-proxy:swift swift-storage relation...')
382 unit = self.swift_proxy_sentry
383 relation = ['swift-storage', 'swift-storage:swift-storage']
384 expected = {
385@@ -293,19 +314,21 @@
386 message = u.relation_error('swift-proxy swift-storage', ret)
387 amulet.raise_status(amulet.FAIL, msg=message)
388
389- def test_glance_object_store_relation(self):
390+ def test_208_glance_object_store_relation(self):
391 """Verify the glance to swift-proxy object-store relation data."""
392+ u.log.debug('Checking glance:swift-proxy object-store relation...')
393 unit = self.glance_sentry
394 relation = ['object-store', 'swift-proxy:object-store']
395- expected = { 'private-address': u.valid_ip }
396+ expected = {'private-address': u.valid_ip}
397
398 ret = u.validate_relation_data(unit, relation, expected)
399 if ret:
400 message = u.relation_error('glance object-store', ret)
401 amulet.raise_status(amulet.FAIL, msg=message)
402
403- def test_swift_proxy_object_store_relation(self):
404+ def test_210_swift_proxy_object_store_relation(self):
405 """Verify the swift-proxy to glance object-store relation data."""
406+ u.log.debug('Checking swift-proxy:glance object-store relation...')
407 unit = self.swift_proxy_sentry
408 relation = ['object-store', 'glance:object-store']
409 expected = {'private-address': u.valid_ip}
410@@ -314,26 +337,229 @@
411 message = u.relation_error('swift-proxy object-store', ret)
412 amulet.raise_status(amulet.FAIL, msg=message)
413
414- def test_z_restart_on_config_change(self):
415+ def test_300_swift_config(self):
416+ """Verify the data in the swift-hash section of the swift config
417+ file."""
418+ u.log.debug('Checking swift config...')
419+ unit = self.swift_storage_sentry
420+ conf = '/etc/swift/swift.conf'
421+ swift_proxy_relation = self.swift_proxy_sentry.relation(
422+ 'swift-storage', 'swift-storage:swift-storage')
423+ expected = {
424+ 'swift_hash_path_suffix': swift_proxy_relation['swift_hash']
425+ }
426+
427+ ret = u.validate_config_data(unit, conf, 'swift-hash', expected)
428+ if ret:
429+ message = "swift config error: {}".format(ret)
430+ amulet.raise_status(amulet.FAIL, msg=message)
431+
432+ def test_302_proxy_server_config(self):
433+ """Verify the data in the proxy-server config file."""
434+ u.log.debug('Checking swift proxy-server config...')
435+ unit = self.swift_proxy_sentry
436+ conf = '/etc/swift/proxy-server.conf'
437+ keystone_relation = self.keystone_sentry.relation(
438+ 'identity-service', 'swift-proxy:identity-service')
439+ swift_proxy_relation = unit.relation(
440+ 'identity-service', 'keystone:identity-service')
441+ swift_proxy_ip = swift_proxy_relation['private-address']
442+ auth_host = keystone_relation['auth_host']
443+ auth_protocol = keystone_relation['auth_protocol']
444+
445+ expected = {
446+ 'DEFAULT': {
447+ 'bind_port': '8070',
448+ 'user': 'swift',
449+ 'log_name': 'swift',
450+ 'log_facility': 'LOG_LOCAL0',
451+ 'log_level': 'INFO',
452+ 'log_headers': 'False',
453+ 'log_address': '/dev/log'
454+ },
455+ 'pipeline:main': {
456+ 'pipeline': 'gatekeeper healthcheck proxy-logging cache '
457+ 'swift3 s3token container_sync bulk tempurl '
458+ 'slo dlo formpost authtoken keystoneauth '
459+ 'staticweb container-quotas account-quotas '
460+ 'proxy-logging proxy-server'
461+ },
462+ 'app:proxy-server': {
463+ 'use': 'egg:swift#proxy',
464+ 'allow_account_management': 'true',
465+ 'account_autocreate': 'true',
466+ 'node_timeout': '60',
467+ 'recoverable_node_timeout': '30'
468+ },
469+ 'filter:tempauth': {
470+ 'use': 'egg:swift#tempauth',
471+ 'user_system_root': 'testpass .admin https://{}:8080/v1/'
472+ 'AUTH_system'.format(swift_proxy_ip)
473+ },
474+ 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
475+ 'filter:cache': {
476+ 'use': 'egg:swift#memcache',
477+ 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
478+ },
479+ 'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
480+ 'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
481+ 'filter:proxy-logging': {'use': 'egg:swift#proxy_logging'},
482+ 'filter:staticweb': {'use': 'egg:swift#staticweb'},
483+ 'filter:bulk': {'use': 'egg:swift#bulk'},
484+ 'filter:slo': {'use': 'egg:swift#slo'},
485+ 'filter:dlo': {'use': 'egg:swift#dlo'},
486+ 'filter:formpost': {'use': 'egg:swift#formpost'},
487+ 'filter:tempurl': {'use': 'egg:swift#tempurl'},
488+ 'filter:container_sync': {'use': 'egg:swift#container_sync'},
489+ 'filter:gatekeeper': {'use': 'egg:swift#gatekeeper'},
490+ 'filter:keystoneauth': {
491+ 'use': 'egg:swift#keystoneauth',
492+ 'operator_roles': 'Member,Admin'
493+ },
494+ 'filter:authtoken': {
495+ 'auth_uri': '{}://{}:{}'.format(
496+ auth_protocol,
497+ auth_host,
498+ keystone_relation['service_port']),
499+ 'admin_tenant_name': keystone_relation['service_tenant'],
500+ 'admin_user': keystone_relation['service_username'],
501+ 'admin_password': keystone_relation['service_password'],
502+ 'delay_auth_decision': 'true',
503+ 'signing_dir': '/var/cache/swift',
504+ 'cache': 'swift.cache'
505+ },
506+ 'filter:swift3': {'use': 'egg:swift3#swift3'}
507+ }
508+
509+ if self._get_openstack_release() >= self.trusty_kilo:
510+ # Kilo and later
511+ expected['filter:authtoken'].update({
512+ 'paste.filter_factory': 'keystonemiddleware.auth_token:'
513+ 'filter_factory',
514+ 'identity_uri': '{}://{}:{}'.format(
515+ auth_protocol,
516+ auth_host,
517+ keystone_relation['auth_port']),
518+ })
519+ expected['filter:s3token'] = {
520+ # No section commonality with J and earlier
521+ 'paste.filter_factory': 'keystonemiddleware.s3_token'
522+ ':filter_factory',
523+ 'auth_uri': '{}://{}:{}'.format(
524+ auth_protocol,
525+ auth_host,
526+ keystone_relation['service_port']),
527+ 'identity_uri': '{}://{}:{}'.format(
528+ auth_protocol,
529+ auth_host,
530+ keystone_relation['auth_port']),
531+ }
532+ else:
533+ # Juno and earlier
534+ expected['filter:authtoken'].update({
535+ 'paste.filter_factory': 'keystoneclient.middleware.'
536+ 'auth_token:filter_factory',
537+ 'auth_host': auth_host,
538+ 'auth_port': keystone_relation['auth_port'],
539+ 'auth_protocol': auth_protocol,
540+ })
541+ expected['filter:s3token'] = {
542+ # No section commonality with K and later
543+ 'paste.filter_factory': 'keystoneclient.middleware.'
544+ 's3_token:filter_factory',
545+ 'auth_port': keystone_relation['auth_port'],
546+ 'auth_host': keystone_relation['auth_host'],
547+ 'service_host': keystone_relation['service_host'],
548+ 'service_port': keystone_relation['service_port'],
549+ 'auth_protocol': keystone_relation['auth_protocol'],
550+ 'auth_token': keystone_relation['admin_token'],
551+ 'admin_token': keystone_relation['admin_token']
552+ }
553+
554+ for section, pairs in expected.iteritems():
555+ ret = u.validate_config_data(unit, conf, section, pairs)
556+ if ret:
557+ message = "proxy-server config error: {}".format(ret)
558+ amulet.raise_status(amulet.FAIL, msg=message)
559+
560+ def test_400_swift_backed_image_create(self):
561+ """Create an instance in glance, which is backed by swift, and validate
562+ that some of the metadata for the image match in glance and swift."""
563+ u.log.debug('Checking swift objects and containers with a '
564+ 'swift-backed glance image...')
565+
566+ # Create swift-backed glance image
567+ img_new = u.create_cirros_image(self.glance, "cirros-image-1")
568+ img_id = img_new.id
569+ img_md5 = img_new.checksum
570+ img_size = img_new.size
571+
572+ # Validate that swift object's checksum/size match that from glance
573+ headers, containers = self.swift.get_account()
574+ if len(containers) != 1:
575+ msg = "Expected 1 swift container, found {}".format(
576+ len(containers))
577+ amulet.raise_status(amulet.FAIL, msg=msg)
578+
579+ container_name = containers[0].get('name')
580+
581+ headers, objects = self.swift.get_container(container_name)
582+ if len(objects) != 1:
583+ msg = "Expected 1 swift object, found {}".format(len(objects))
584+ amulet.raise_status(amulet.FAIL, msg=msg)
585+
586+ swift_object_size = objects[0].get('bytes')
587+ swift_object_md5 = objects[0].get('hash')
588+
589+ if img_size != swift_object_size:
590+ msg = "Glance image size {} != swift object size {}".format(
591+ img_size, swift_object_size)
592+ amulet.raise_status(amulet.FAIL, msg=msg)
593+
594+ if img_md5 != swift_object_md5:
595+ msg = "Glance image hash {} != swift object hash {}".format(
596+ img_md5, swift_object_md5)
597+ amulet.raise_status(amulet.FAIL, msg=msg)
598+
599+ # Cleanup
600+ u.delete_resource(self.glance.images, img_id, msg="glance image")
601+ u.log.info('OK')
602+
603+ def test_900_restart_on_config_change(self):
604 """Verify that the specified services are restarted when the config
605- is changed.
606-
607- Note(coreycb): The method name with the _z_ is a little odd
608- but it forces the test to run last. It just makes things
609- easier because restarting services requires re-authorization.
610- """
611- svc = 'swift-proxy'
612- self.d.configure('swift-proxy', {'node-timeout': '90'})
613-
614- if not u.service_restarted(self.swift_proxy_sentry, svc,
615- '/etc/swift/proxy-server.conf'):
616- self.d.configure('swift-proxy', {'node-timeout': '60'})
617- msg = "service {} didn't restart after config change".format(svc)
618- amulet.raise_status(amulet.FAIL, msg=msg)
619-
620- self.d.configure('swift-proxy', {'node-timeout': '60'})
621-
622- def test_z_no_restart_on_config_change_when_paused(self):
623+ is changed."""
624+ u.log.info('Checking that conf files and system services respond '
625+ 'to a charm config change...')
626+
627+ sentry = self.swift_proxy_sentry
628+ juju_service = 'swift-proxy'
629+
630+ # Process names, corresponding conf files
631+ services = {'swift-proxy-server': '/etc/swift/proxy-server.conf'}
632+
633+ # Expected default and alternate values
634+ set_default = {'node-timeout': '60'}
635+ set_alternate = {'node-timeout': '90'}
636+
637+ # Make config change, check for service restarts
638+ u.log.debug('Making config change on {}...'.format(juju_service))
639+ mtime = u.get_sentry_time(sentry)
640+ self.d.configure(juju_service, set_alternate)
641+
642+ sleep_time = 40
643+ for s, conf_file in services.iteritems():
644+ u.log.debug("Checking that service restarted: {}".format(s))
645+ if not u.validate_service_config_changed(sentry, mtime, s,
646+ conf_file,
647+ sleep_time=sleep_time):
648+ self.d.configure(juju_service, set_default)
649+ msg = "service {} didn't restart after config change".format(s)
650+ amulet.raise_status(amulet.FAIL, msg=msg)
651+ sleep_time = 0
652+
653+ self.d.configure(juju_service, set_default)
654+
655+ def test_901_no_restart_on_config_change_when_paused(self):
656 """Verify that the specified services are not restarted when the config
657 is changed and the unit is paused."""
658 u.log.info('Checking that system services do not get restarted '
659@@ -414,508 +640,8 @@
660 " (got {} instead)".format(message))
661 amulet.raise_status(amulet.FAIL, msg=msg)
662
663- def test_z_pause_resume_actions(self):
664+ def test_902_pause_resume_actions(self):
665 """Pause and then resume swift-proxy."""
666 u.log.debug('Checking pause/resume actions...')
667 self._test_pause()
668 self._test_resume()
669-
670- def test_swift_config(self):
671- """Verify the data in the swift config file."""
672- unit = self.swift_proxy_sentry
673- conf = '/etc/swift/swift.conf'
674- swift_proxy_relation = unit.relation('swift-storage',
675- 'swift-storage:swift-storage')
676- expected = {
677- 'swift_hash_path_suffix': swift_proxy_relation['swift_hash']
678- }
679-
680- ret = u.validate_config_data(unit, conf, 'swift-hash', expected)
681- if ret:
682- message = "swift config error: {}".format(ret)
683- amulet.raise_status(amulet.FAIL, msg=message)
684-
685- def test_proxy_server_icehouse_config(self):
686- """Verify the data in the proxy-server config file."""
687- if self._get_openstack_release() < self.precise_icehouse:
688- return
689-
690- unit = self.swift_proxy_sentry
691- conf = '/etc/swift/proxy-server.conf'
692- keystone_relation = self.keystone_sentry.relation('identity-service',
693- 'swift-proxy:identity-service')
694- swift_proxy_relation = unit.relation('identity-service',
695- 'keystone:identity-service')
696- swift_proxy_ip = swift_proxy_relation['private-address']
697- auth_host = keystone_relation['auth_host']
698- auth_protocol = keystone_relation['auth_protocol']
699-
700- expected = {
701- 'DEFAULT': {
702- 'bind_port': '8070',
703- 'user': 'swift',
704- 'log_name': 'swift',
705- 'log_facility': 'LOG_LOCAL0',
706- 'log_level': 'INFO',
707- 'log_headers': 'False',
708- 'log_address': '/dev/log'
709- },
710- 'pipeline:main': {
711- 'pipeline': 'gatekeeper healthcheck proxy-logging cache swift3 '
712- 's3token container_sync bulk tempurl slo dlo '
713- 'formpost authtoken keystoneauth staticweb '
714- 'container-quotas account-quotas proxy-logging '
715- 'proxy-server'
716- },
717- 'app:proxy-server': {
718- 'use': 'egg:swift#proxy',
719- 'allow_account_management': 'true',
720- 'account_autocreate': 'true',
721- 'node_timeout': '60',
722- 'recoverable_node_timeout': '30'
723- },
724- 'filter:tempauth': {
725- 'use': 'egg:swift#tempauth',
726- 'user_system_root': 'testpass .admin https://{}:8080/v1/'
727- 'AUTH_system'.format(swift_proxy_ip)
728- },
729- 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
730- 'filter:cache': {
731- 'use': 'egg:swift#memcache',
732- 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
733- },
734- 'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
735- 'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
736- 'filter:proxy-logging': {'use': 'egg:swift#proxy_logging'},
737- 'filter:staticweb': {'use': 'egg:swift#staticweb'},
738- 'filter:bulk': {'use': 'egg:swift#bulk'},
739- 'filter:slo': {'use': 'egg:swift#slo'},
740- 'filter:dlo': {'use': 'egg:swift#dlo'},
741- 'filter:formpost': {'use': 'egg:swift#formpost'},
742- 'filter:tempurl': {'use': 'egg:swift#tempurl'},
743- 'filter:container_sync': {'use': 'egg:swift#container_sync'},
744- 'filter:gatekeeper': {'use': 'egg:swift#gatekeeper'},
745- 'filter:keystoneauth': {
746- 'use': 'egg:swift#keystoneauth',
747- 'operator_roles': 'Member,Admin'
748- },
749- 'filter:authtoken': {
750- 'paste.filter_factory': 'keystoneclient.middleware.'
751- 'auth_token:filter_factory',
752- 'auth_host': auth_host,
753- 'auth_port': keystone_relation['auth_port'],
754- 'auth_protocol': auth_protocol,
755- 'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
756- keystone_relation['service_port']),
757- 'admin_tenant_name': keystone_relation['service_tenant'],
758- 'admin_user': keystone_relation['service_username'],
759- 'admin_password': keystone_relation['service_password'],
760- 'delay_auth_decision': 'true',
761- 'signing_dir': '/var/cache/swift',
762- 'cache': 'swift.cache'
763- },
764- 'filter:s3token': {
765- 'paste.filter_factory': 'keystoneclient.middleware.'
766- 's3_token:filter_factory',
767- 'service_host': keystone_relation['service_host'],
768- 'service_port': keystone_relation['service_port'],
769- 'auth_port': keystone_relation['auth_port'],
770- 'auth_host': keystone_relation['auth_host'],
771- 'auth_protocol': keystone_relation['auth_protocol'],
772- 'auth_token': keystone_relation['admin_token'],
773- 'admin_token': keystone_relation['admin_token']
774- },
775- 'filter:swift3': {'use': 'egg:swift3#swift3'}
776- }
777-
778- for section, pairs in expected.iteritems():
779- ret = u.validate_config_data(unit, conf, section, pairs)
780- if ret:
781- message = "proxy-server config error: {}".format(ret)
782- amulet.raise_status(amulet.FAIL, msg=message)
783-
784- def test_proxy_server_havana_config(self):
785- """Verify the data in the proxy-server config file."""
786- if self._get_openstack_release() != self.precise_havana:
787- return
788-
789- unit = self.swift_proxy_sentry
790- conf = '/etc/swift/proxy-server.conf'
791- keystone_relation = self.keystone_sentry.relation('identity-service',
792- 'swift-proxy:identity-service')
793- swift_proxy_relation = unit.relation('identity-service',
794- 'keystone:identity-service')
795- swift_proxy_ip = swift_proxy_relation['private-address']
796- auth_host = keystone_relation['auth_host']
797- auth_protocol = keystone_relation['auth_protocol']
798-
799- expected = {
800- 'DEFAULT': {
801- 'bind_port': '8070',
802- 'user': 'swift'
803- },
804- 'pipeline:main': {
805- 'pipeline': 'healthcheck cache swift3 authtoken '
806- 'keystoneauth container-quotas account-quotas '
807- 'proxy-server'
808- },
809- 'app:proxy-server': {
810- 'use': 'egg:swift#proxy',
811- 'allow_account_management': 'true',
812- 'account_autocreate': 'true',
813- 'node_timeout': '60',
814- 'recoverable_node_timeout': '30'
815- },
816- 'filter:tempauth': {
817- 'use': 'egg:swift#tempauth',
818- 'user_system_root': 'testpass .admin https://{}:8080/v1/'
819- 'AUTH_system'.format(swift_proxy_ip)
820- },
821- 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
822- 'filter:cache': {
823- 'use': 'egg:swift#memcache',
824- 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
825- },
826- 'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
827- 'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
828- 'filter:keystoneauth': {
829- 'use': 'egg:swift#keystoneauth',
830- 'operator_roles': 'Member,Admin'
831- },
832- 'filter:authtoken': {
833- 'paste.filter_factory': 'keystoneclient.middleware.'
834- 'auth_token:filter_factory',
835- 'auth_host': auth_host,
836- 'auth_port': keystone_relation['auth_port'],
837- 'auth_protocol': auth_protocol,
838- 'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
839- keystone_relation['service_port']),
840- 'admin_tenant_name': keystone_relation['service_tenant'],
841- 'admin_user': keystone_relation['service_username'],
842- 'admin_password': keystone_relation['service_password'],
843- 'delay_auth_decision': 'true',
844- 'signing_dir': '/var/cache/swift',
845- 'cache': 'swift.cache'
846- },
847- 'filter:s3token': {
848- 'paste.filter_factory': 'keystone.middleware.s3_token:'
849- 'filter_factory',
850- 'service_host': keystone_relation['service_host'],
851- 'service_port': keystone_relation['service_port'],
852- 'auth_port': keystone_relation['auth_port'],
853- 'auth_host': keystone_relation['auth_host'],
854- 'auth_protocol': keystone_relation['auth_protocol'],
855- 'auth_token': keystone_relation['admin_token'],
856- 'admin_token': keystone_relation['admin_token'],
857- 'service_protocol': keystone_relation['service_protocol']
858- },
859- 'filter:swift3': {'use': 'egg:swift3#swift3'}
860- }
861-
862- for section, pairs in expected.iteritems():
863- ret = u.validate_config_data(unit, conf, section, pairs)
864- if ret:
865- message = "proxy-server config error: {}".format(ret)
866- amulet.raise_status(amulet.FAIL, msg=message)
867-
868- def test_proxy_server_grizzly_config(self):
869- """Verify the data in the proxy-server config file."""
870- if self._get_openstack_release() != self.precise_grizzly:
871- return
872-
873- unit = self.swift_proxy_sentry
874- conf = '/etc/swift/proxy-server.conf'
875- keystone_relation = self.keystone_sentry.relation('identity-service',
876- 'swift-proxy:identity-service')
877- swift_proxy_relation = unit.relation('identity-service',
878- 'keystone:identity-service')
879- swift_proxy_ip = swift_proxy_relation['private-address']
880- auth_host = keystone_relation['auth_host']
881- auth_protocol = keystone_relation['auth_protocol']
882-
883- expected = {
884- 'DEFAULT': {
885- 'bind_port': '8070',
886- 'user': 'swift'
887- },
888- 'pipeline:main': {
889- 'pipeline': 'healthcheck cache swift3 s3token authtoken '
890- 'keystone container-quotas account-quotas '
891- 'proxy-server'
892- },
893- 'app:proxy-server': {
894- 'use': 'egg:swift#proxy',
895- 'allow_account_management': 'true',
896- 'account_autocreate': 'true',
897- 'node_timeout': '60',
898- 'recoverable_node_timeout': '30'
899- },
900- 'filter:tempauth': {
901- 'use': 'egg:swift#tempauth',
902- 'user_system_root': 'testpass .admin https://{}:8080/v1/'
903- 'AUTH_system'.format(swift_proxy_ip)
904- },
905- 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
906- 'filter:cache': {
907- 'use': 'egg:swift#memcache',
908- 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
909- },
910- 'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
911- 'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
912- 'filter:keystone': {
913- 'paste.filter_factory': 'swift.common.middleware.'
914- 'keystoneauth:filter_factory',
915- 'operator_roles': 'Member,Admin'
916- },
917- 'filter:authtoken': {
918- 'paste.filter_factory': 'keystone.middleware.auth_token:'
919- 'filter_factory',
920- 'auth_host': auth_host,
921- 'auth_port': keystone_relation['auth_port'],
922- 'auth_protocol': auth_protocol,
923- 'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
924- keystone_relation['service_port']),
925- 'admin_tenant_name': keystone_relation['service_tenant'],
926- 'admin_user': keystone_relation['service_username'],
927- 'admin_password': keystone_relation['service_password'],
928- 'delay_auth_decision': 'true',
929- 'signing_dir': '/var/cache/swift'
930- },
931- 'filter:s3token': {
932- 'paste.filter_factory': 'keystone.middleware.s3_token:'
933- 'filter_factory',
934- 'service_host': keystone_relation['service_host'],
935- 'service_port': keystone_relation['service_port'],
936- 'auth_port': keystone_relation['auth_port'],
937- 'auth_host': keystone_relation['auth_host'],
938- 'auth_protocol': keystone_relation['auth_protocol'],
939- 'auth_token': keystone_relation['admin_token'],
940- 'admin_token': keystone_relation['admin_token'],
941- 'service_protocol': keystone_relation['service_protocol']
942- },
943- 'filter:swift3': {'use': 'egg:swift3#swift3'}
944- }
945-
946- for section, pairs in expected.iteritems():
947- ret = u.validate_config_data(unit, conf, section, pairs)
948- if ret:
949- message = "proxy-server config error: {}".format(ret)
950- amulet.raise_status(amulet.FAIL, msg=message)
951-
952- def test_proxy_server_folsom_config(self):
953- """Verify the data in the proxy-server config file."""
954- if self._get_openstack_release() != self.precise_folsom:
955- return
956-
957- unit = self.swift_proxy_sentry
958- conf = '/etc/swift/proxy-server.conf'
959- keystone_relation = self.keystone_sentry.relation('identity-service',
960- 'swift-proxy:identity-service')
961- swift_proxy_relation = unit.relation('identity-service',
962- 'keystone:identity-service')
963- swift_proxy_ip = swift_proxy_relation['private-address']
964- auth_host = keystone_relation['auth_host']
965- auth_protocol = keystone_relation['auth_protocol']
966-
967- expected = {
968- 'DEFAULT': {
969- 'bind_port': '8070',
970- 'user': 'swift'
971- },
972- 'pipeline:main': {
973- 'pipeline': 'healthcheck cache swift3 s3token authtoken '
974- 'keystone proxy-server'
975- },
976- 'app:proxy-server': {
977- 'use': 'egg:swift#proxy',
978- 'allow_account_management': 'true',
979- 'account_autocreate': 'true',
980- 'node_timeout': '60',
981- 'recoverable_node_timeout': '30'
982- },
983- 'filter:tempauth': {
984- 'use': 'egg:swift#tempauth',
985- 'user_system_root': 'testpass .admin https://{}:8080/v1/'
986- 'AUTH_system'.format(swift_proxy_ip)
987- },
988- 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
989- 'filter:cache': {
990- 'use': 'egg:swift#memcache',
991- 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
992- },
993- 'filter:keystone': {
994- 'paste.filter_factory': 'keystone.middleware.swift_auth:'
995- 'filter_factory',
996- 'operator_roles': 'Member,Admin'
997- },
998- 'filter:authtoken': {
999- 'paste.filter_factory': 'keystone.middleware.auth_token:'
1000- 'filter_factory',
1001- 'auth_host': auth_host,
1002- 'auth_port': keystone_relation['auth_port'],
1003- 'auth_protocol': auth_protocol,
1004- 'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
1005- keystone_relation['service_port']),
1006- 'admin_tenant_name': keystone_relation['service_tenant'],
1007- 'admin_user': keystone_relation['service_username'],
1008- 'admin_password': keystone_relation['service_password'],
1009- 'delay_auth_decision': '1'
1010- },
1011- 'filter:s3token': {
1012- 'paste.filter_factory': 'keystone.middleware.s3_token:'
1013- 'filter_factory',
1014- 'service_host': keystone_relation['service_host'],
1015- 'service_port': keystone_relation['service_port'],
1016- 'auth_port': keystone_relation['auth_port'],
1017- 'auth_host': keystone_relation['auth_host'],
1018- 'auth_protocol': keystone_relation['auth_protocol'],
1019- 'auth_token': keystone_relation['admin_token'],
1020- 'admin_token': keystone_relation['admin_token'],
1021- 'service_protocol': keystone_relation['service_protocol']
1022- },
1023- 'filter:swift3': {'use': 'egg:swift#swift3'}
1024- }
1025-
1026- for section, pairs in expected.iteritems():
1027- ret = u.validate_config_data(unit, conf, section, pairs)
1028- if ret:
1029- message = "proxy-server config error: {}".format(ret)
1030- amulet.raise_status(amulet.FAIL, msg=message)
1031-
1032- def test_proxy_server_essex_config(self):
1033- """Verify the data in the proxy-server config file."""
1034- if self._get_openstack_release() != self.precise_essex:
1035- return
1036-
1037- unit = self.swift_proxy_sentry
1038- conf = '/etc/swift/proxy-server.conf'
1039- keystone_relation = self.keystone_sentry.relation('identity-service',
1040- 'swift-proxy:identity-service')
1041- swift_proxy_relation = unit.relation('identity-service',
1042- 'keystone:identity-service')
1043- swift_proxy_ip = swift_proxy_relation['private-address']
1044- auth_host = keystone_relation['auth_host']
1045- auth_protocol = keystone_relation['auth_protocol']
1046-
1047- expected = {
1048- 'DEFAULT': {
1049- 'bind_port': '8070',
1050- 'user': 'swift'
1051- },
1052- 'pipeline:main': {
1053- 'pipeline': 'healthcheck cache swift3 s3token authtoken '
1054- 'keystone proxy-server'
1055- },
1056- 'app:proxy-server': {
1057- 'use': 'egg:swift#proxy',
1058- 'allow_account_management': 'true',
1059- 'account_autocreate': 'true',
1060- 'node_timeout': '60',
1061- 'recoverable_node_timeout': '30'
1062- },
1063- 'filter:tempauth': {
1064- 'use': 'egg:swift#tempauth',
1065- 'user_system_root': 'testpass .admin https://{}:8080/v1/'
1066- 'AUTH_system'.format(swift_proxy_ip)
1067- },
1068- 'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
1069- 'filter:cache': {
1070- 'use': 'egg:swift#memcache',
1071- 'memcache_servers': '{}:11211'.format(swift_proxy_ip)
1072- },
1073- 'filter:keystone': {
1074- 'paste.filter_factory': 'keystone.middleware.swift_auth:'
1075- 'filter_factory',
1076- 'operator_roles': 'Member,Admin'
1077- },
1078- 'filter:authtoken': {
1079- 'paste.filter_factory': 'keystone.middleware.auth_token:'
1080- 'filter_factory',
1081- 'auth_host': auth_host,
1082- 'auth_port': keystone_relation['auth_port'],
1083- 'auth_protocol': auth_protocol,
1084- 'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
1085- keystone_relation['service_port']),
1086- 'admin_tenant_name': keystone_relation['service_tenant'],
1087- 'admin_user': keystone_relation['service_username'],
1088- 'admin_password': keystone_relation['service_password'],
1089- 'delay_auth_decision': '1'
1090- },
1091- 'filter:s3token': {
1092- 'paste.filter_factory': 'keystone.middleware.s3_token:'
1093- 'filter_factory',
1094- 'service_host': keystone_relation['service_host'],
1095- 'service_port': keystone_relation['service_port'],
1096- 'auth_port': keystone_relation['auth_port'],
1097- 'auth_host': keystone_relation['auth_host'],
1098- 'auth_protocol': keystone_relation['auth_protocol'],
1099- 'auth_token': keystone_relation['admin_token'],
1100- 'admin_token': keystone_relation['admin_token'],
1101- 'service_protocol': keystone_relation['service_protocol']
1102- },
1103- 'filter:swift3': {'use': 'egg:swift#swift3'}
1104- }
1105-
1106- for section, pairs in expected.iteritems():
1107- ret = u.validate_config_data(unit, conf, section, pairs)
1108- if ret:
1109- message = "proxy-server config error: {}".format(ret)
1110- amulet.raise_status(amulet.FAIL, msg=message)
1111-
1112- def test_image_create(self):
1113- """Create an instance in glance, which is backed by swift, and validate
1114- that some of the metadata for the image match in glance and swift."""
1115- # NOTE(coreycb): Skipping failing test on folsom until resolved. On
1116- # folsom only, uploading an image to glance gets 400 Bad
1117- # Request - Error uploading image: (error): [Errno 111]
1118- # ECONNREFUSED (HTTP 400)
1119- if self._get_openstack_release() == self.precise_folsom:
1120- u.log.error("Skipping failing test until resolved")
1121- return
1122-
1123- # Create glance image
1124- image = u.create_cirros_image(self.glance, "cirros-image")
1125- if not image:
1126- amulet.raise_status(amulet.FAIL, msg="Image create failed")
1127-
1128- # Validate that cirros image exists in glance and get its checksum/size
1129- images = list(self.glance.images.list())
1130- if len(images) != 1:
1131- msg = "Expected 1 glance image, found {}".format(len(images))
1132- amulet.raise_status(amulet.FAIL, msg=msg)
1133-
1134- if images[0].name != 'cirros-image':
1135- message = "cirros image does not exist"
1136- amulet.raise_status(amulet.FAIL, msg=message)
1137-
1138- glance_image_md5 = image.checksum
1139- glance_image_size = image.size
1140-
1141- # Validate that swift object's checksum/size match that from glance
1142- headers, containers = self.swift.get_account()
1143- if len(containers) != 1:
1144- msg = "Expected 1 swift container, found {}".format(len(containers))
1145- amulet.raise_status(amulet.FAIL, msg=msg)
1146-
1147- container_name = containers[0].get('name')
1148-
1149- headers, objects = self.swift.get_container(container_name)
1150- if len(objects) != 1:
1151- msg = "Expected 1 swift object, found {}".format(len(objects))
1152- amulet.raise_status(amulet.FAIL, msg=msg)
1153-
1154- swift_object_size = objects[0].get('bytes')
1155- swift_object_md5 = objects[0].get('hash')
1156-
1157- if glance_image_size != swift_object_size:
1158- msg = "Glance image size {} != swift object size {}".format( \
1159- glance_image_size, swift_object_size)
1160- amulet.raise_status(amulet.FAIL, msg=msg)
1161-
1162- if glance_image_md5 != swift_object_md5:
1163- msg = "Glance image hash {} != swift object hash {}".format( \
1164- glance_image_md5, swift_object_md5)
1165- amulet.raise_status(amulet.FAIL, msg=msg)
1166-
1167- # Cleanup
1168- u.delete_image(self.glance, image)
1169
1170=== added file 'tests/tests.yaml'
1171--- tests/tests.yaml 1970-01-01 00:00:00 +0000
1172+++ tests/tests.yaml 2015-10-05 16:57:32 +0000
1173@@ -0,0 +1,20 @@
1174+bootstrap: true
1175+reset: true
1176+virtualenv: true
1177+makefile:
1178+ - lint
1179+ - test
1180+sources:
1181+ - ppa:juju/stable
1182+packages:
1183+ - amulet
1184+ - distro-info-data
1185+ - python-cinderclient
1186+ - python-distro-info
1187+ - python-glanceclient
1188+ - python-heatclient
1189+ - python-keystoneclient
1190+ - python-neutronclient
1191+ - python-novaclient
1192+ - python-pika
1193+ - python-swiftclient

Subscribers

People subscribed via source and target branches