From ef2447e9d273a37b896de05d0ddfe74220034596 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Mon, 13 Apr 2015 12:41:00 +0200 Subject: Fix random test error in swift store delete On random gate jobs gate-glance_store-python27 would fail with exception "swiftclient.exceptions.ClientException: Object DELETE failed" on test test_delete_with_some_segments_failing in tests.unit.test_swift_store. Error would happen when test_image_id's UUID ended in 001 or 003 as fake_delete_object method had a bug. Change-Id: If279d19d38507e12087b412a6f367850bd9bfb6f Closes-Bug: #1442517 --- glance_store/tests/unit/test_swift_store.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py index d4547c8..c83381e 100644 --- a/glance_store/tests/unit/test_swift_store.py +++ b/glance_store/tests/unit/test_swift_store.py @@ -900,14 +900,14 @@ class SwiftTests(object): def fake_get_container(container, **kwargs): # Returning 5 fake segments - return None, [{'name': '%s-%05d' % (test_image_id, x)} + return None, [{'name': '%s-%03d' % (test_image_id, x)} for x in range(1, 6)] def fake_delete_object(container, object_name): # Simulate error on 1st and 3rd segments global SWIFT_DELETE_OBJECT_CALLS SWIFT_DELETE_OBJECT_CALLS += 1 - if object_name.endswith('001') or object_name.endswith('003'): + if object_name.endswith('-001') or object_name.endswith('-003'): raise swiftclient.ClientException('Object DELETE failed') else: pass -- cgit v1.2.1