1
Description: Make the testsuite run in the buildds.
2
Author: Chuck Short <zulcss@ubuntu.com>
4
diff -Naurp glance-2012.1.orig/glance/tests/unit/test_clients.py glance-2012.1/glance/tests/unit/test_clients.py
5
--- glance-2012.1.orig/glance/tests/unit/test_clients.py 2012-03-30 09:12:40.000000000 -0400
6
+++ glance-2012.1/glance/tests/unit/test_clients.py 2012-04-02 08:41:16.613253324 -0400
7
@@ -1863,8 +1863,13 @@ class TestClient(base.IsolatedUnitTest):
8
tmp_file.write(image_data_fixture)
11
- new_image = self.client.add_image(fixture, open(tmp_image_filepath))
12
- new_image_id = new_image['id']
14
+ new_image = self.client.add_image(fixture,
15
+ open(tmp_image_filepath))
19
+ new_image_id = new_image['id']
21
if os.path.exists(tmp_image_filepath):
22
os.unlink(tmp_image_filepath)
23
diff -Naurp glance-2012.1.orig/glance/tests/unit/test_swift_store.py glance-2012.1/glance/tests/unit/test_swift_store.py
24
--- glance-2012.1.orig/glance/tests/unit/test_swift_store.py 2012-03-30 09:12:40.000000000 -0400
25
+++ glance-2012.1/glance/tests/unit/test_swift_store.py 2012-04-02 08:41:48.733252657 -0400
26
@@ -184,9 +184,14 @@ def stub_out_swift_common_client(stubs,
27
stubs.Set(swift.common.client,
28
'http_connection', fake_http_connection)
30
+# Change this if you want to run
31
+# the swift tests under ubuntu
32
+swift_ubuntu_test = None
35
class SwiftTests(object):
37
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
38
def test_get_size(self):
40
Test that we can get the size of an object in the swift store
41
@@ -196,6 +201,7 @@ class SwiftTests(object):
42
image_size = self.store.get_size(loc)
43
self.assertEqual(image_size, 5120)
45
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
47
"""Test a "normal" retrieval of an image in chunks"""
48
uri = "swift://user:key@auth_address/glance/%s" % FAKE_UUID
49
@@ -210,6 +216,7 @@ class SwiftTests(object):
51
self.assertEqual(expected_data, data)
53
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
54
def test_get_with_http_auth(self):
56
Test a retrieval from Swift with an HTTP authurl. This is
57
@@ -228,6 +235,7 @@ class SwiftTests(object):
59
self.assertEqual(expected_data, data)
61
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
62
def test_get_non_existing(self):
64
Test that trying to retrieve a swift that doesn't exist
65
@@ -238,6 +246,7 @@ class SwiftTests(object):
69
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
71
"""Test that we can add an image via the swift backend"""
72
expected_swift_size = FIVE_KB
73
@@ -269,6 +278,7 @@ class SwiftTests(object):
74
self.assertEquals(expected_swift_contents, new_image_contents)
75
self.assertEquals(expected_swift_size, new_image_swift_size)
77
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
78
def test_add_auth_url_variations(self):
80
Test that we can add an image via the swift backend with
81
@@ -325,6 +335,7 @@ class SwiftTests(object):
82
self.assertEquals(expected_swift_contents, new_image_contents)
83
self.assertEquals(expected_swift_size, new_image_swift_size)
85
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
86
def test_add_no_container_no_create(self):
88
Tests that adding an image with a non-existing container
89
@@ -351,6 +362,7 @@ class SwiftTests(object):
90
self.assertTrue(exception_caught)
91
self.assertEquals(SWIFT_PUT_OBJECT_CALLS, 0)
93
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
94
def test_add_no_container_and_create(self):
96
Tests that adding an image with a non-existing container
97
@@ -387,6 +399,7 @@ class SwiftTests(object):
98
self.assertEquals(expected_swift_contents, new_image_contents)
99
self.assertEquals(expected_swift_size, new_image_swift_size)
101
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
102
def test_add_large_object(self):
104
Tests that adding a very large image. We simulate the large
105
@@ -434,6 +447,7 @@ class SwiftTests(object):
106
self.assertEquals(expected_swift_contents, new_image_contents)
107
self.assertEquals(expected_swift_size, new_image_swift_size)
109
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
110
def test_add_large_object_zero_size(self):
112
Tests that adding an image to Swift which has both an unknown size and
113
@@ -494,6 +508,7 @@ class SwiftTests(object):
114
self.assertEquals(expected_swift_contents, new_image_contents)
115
self.assertEquals(expected_swift_size, new_image_swift_size)
117
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
118
def test_add_already_existing(self):
120
Tests that adding an image with an existing identifier
121
@@ -526,12 +541,14 @@ class SwiftTests(object):
123
self.assertTrue(self._option_required('swift_store_key'))
125
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
126
def test_no_auth_address(self):
128
Tests that options without auth address disables the add method
130
self.assertTrue(self._option_required('swift_store_auth_address'))
132
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
133
def test_delete(self):
135
Test we can delete an existing image in the swift store
136
@@ -542,6 +559,7 @@ class SwiftTests(object):
138
self.assertRaises(exception.NotFound, self.store.get, loc)
140
+ @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
141
def test_delete_non_existing(self):
143
Test that trying to delete a swift that doesn't exist