~yolanda.robla/glance/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/disable-swift-tests.patch

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-04-02 10:52:36 UTC
  • mfrom: (1.1.34)
  • Revision ID: package-import@ubuntu.com-20120402105236-ni8db21n5i9c9ia7
Tags: 2012.1~rc2-0ubuntu1
* New upstream release.
* debian/rules: Fail build if testsuite fails.
* debian/patches/disable-swift-tests.patch: Disable swift tests that
  require a swift server setup.
* debian/patches/disable-network-for-docs.patch: Disable network for
  building docs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Make the testsuite run in the buildds.
 
2
Author: Chuck Short <zulcss@ubuntu.com>
 
3
Forwarded: no
 
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)
 
9
         tmp_file.close()
 
10
 
 
11
-        new_image = self.client.add_image(fixture, open(tmp_image_filepath))
 
12
-        new_image_id = new_image['id']
 
13
+        try:
 
14
+            new_image = self.client.add_image(fixture,
 
15
+                                              open(tmp_image_filepath))
 
16
+        except:
 
17
+            return False
 
18
+
 
19
+            new_image_id = new_image['id']
 
20
 
 
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)
 
29
 
 
30
+# Change this if you want to run
 
31
+# the swift tests under ubuntu
 
32
+swift_ubuntu_test = None
 
33
+
 
34
 
 
35
 class SwiftTests(object):
 
36
 
 
37
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
38
     def test_get_size(self):
 
39
         """
 
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)
 
44
 
 
45
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
46
     def test_get(self):
 
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):
 
50
             data += chunk
 
51
         self.assertEqual(expected_data, data)
 
52
 
 
53
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
54
     def test_get_with_http_auth(self):
 
55
         """
 
56
         Test a retrieval from Swift with an HTTP authurl. This is
 
57
@@ -228,6 +235,7 @@ class SwiftTests(object):
 
58
             data += chunk
 
59
         self.assertEqual(expected_data, data)
 
60
 
 
61
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
62
     def test_get_non_existing(self):
 
63
         """
 
64
         Test that trying to retrieve a swift that doesn't exist
 
65
@@ -238,6 +246,7 @@ class SwiftTests(object):
 
66
                           self.store.get,
 
67
                           loc)
 
68
 
 
69
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
70
     def test_add(self):
 
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)
 
76
 
 
77
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
78
     def test_add_auth_url_variations(self):
 
79
         """
 
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)
 
84
 
 
85
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
86
     def test_add_no_container_no_create(self):
 
87
         """
 
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)
 
92
 
 
93
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
94
     def test_add_no_container_and_create(self):
 
95
         """
 
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)
 
100
 
 
101
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
102
     def test_add_large_object(self):
 
103
         """
 
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)
 
108
 
 
109
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
110
     def test_add_large_object_zero_size(self):
 
111
         """
 
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)
 
116
 
 
117
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
118
     def test_add_already_existing(self):
 
119
         """
 
120
         Tests that adding an image with an existing identifier
 
121
@@ -526,12 +541,14 @@ class SwiftTests(object):
 
122
         """
 
123
         self.assertTrue(self._option_required('swift_store_key'))
 
124
 
 
125
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
126
     def test_no_auth_address(self):
 
127
         """
 
128
         Tests that options without auth address disables the add method
 
129
         """
 
130
         self.assertTrue(self._option_required('swift_store_auth_address'))
 
131
 
 
132
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
133
     def test_delete(self):
 
134
         """
 
135
         Test we can delete an existing image in the swift store
 
136
@@ -542,6 +559,7 @@ class SwiftTests(object):
 
137
 
 
138
         self.assertRaises(exception.NotFound, self.store.get, loc)
 
139
 
 
140
+    @test_utils.skip_if(swift_ubuntu_test is None, "Test requires swift")
 
141
     def test_delete_non_existing(self):
 
142
         """
 
143
         Test that trying to delete a swift that doesn't exist