components/openstack/swift/patches/test.patch
changeset 3998 5bd484384122
parent 2167 c9ff638a3018
child 5448 56f4540f741d
--- a/components/openstack/swift/patches/test.patch	Fri Mar 20 03:13:26 2015 -0700
+++ b/components/openstack/swift/patches/test.patch	Thu Mar 19 14:41:20 2015 -0700
@@ -21,86 +21,18 @@
 the test should fork a separate process to test the lock, which should work
 regardless of the OS.
 
-diff --git a/test/unit/__init__.py b/test/unit/__init__.py
---- a/test/unit/__init__.py
-+++ b/test/unit/__init__.py
-@@ -450,7 +450,7 @@ def fake_http_connect(*code_iter, **kwar
-                 else:
-                     etag = '"68b329da9893e34099c7d8ad5cb9c940"'
- 
--            headers = {'content-length': len(self.body),
-+            headers = {'content-length': self.body.__len__(),
-                        'content-type': 'x-application/test',
-                        'x-timestamp': self.timestamp,
-                        'last-modified': self.timestamp,
-diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py
---- a/test/unit/proxy/test_server.py
-+++ b/test/unit/proxy/test_server.py
-@@ -2876,6 +2876,9 @@ class TestObjectController(unittest.Test
- 
-             class LargeResponseBody(object):
- 
-+                def __nonzero__(self):
-+                    return True
-+
-                 def __len__(self):
-                     return MAX_FILE_SIZE + 1
- 
-@@ -3006,6 +3009,9 @@ class TestObjectController(unittest.Test
- 
-             class LargeResponseBody(object):
- 
-+                def __nonzero__(self):
-+                    return True
-+
-                 def __len__(self):
-                     return MAX_FILE_SIZE + 1
- 
-diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py
---- a/test/unit/common/test_utils.py
-+++ b/test/unit/common/test_utils.py
-@@ -437,7 +437,8 @@ class TestUtils(unittest.TestCase):
-             }, 'server', log_route='server')
-             expected_args = [((), {'address': '/dev/log',
-                                    'facility': orig_sysloghandler.LOG_LOCAL3})]
--            if not os.path.exists('/dev/log') or \
-+            if sys.platform == 'sunos5' or \
-+                    not os.path.exists('/dev/log') or \
-                     os.path.isfile('/dev/log') or \
-                     os.path.isdir('/dev/log'):
-                 # Since socket on OSX is in /var/run/syslog, there will be
-diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py
---- a/test/unit/common/test_utils.py
-+++ b/test/unit/common/test_utils.py
-@@ -46,6 +46,7 @@
- from tempfile import TemporaryFile, NamedTemporaryFile, mkdtemp
- from netifaces import AF_INET6
- from mock import MagicMock, patch
-+from nose import SkipTest
- 
- from swift.common.exceptions import (Timeout, MessageTimeout,
-                                      ConnectionTimeout, LockTimeout)
-@@ -1406,6 +1407,8 @@
-                 MagicMock(side_effect=BaseException('test3')))
- 
-     def test_lock_file(self):
-+        if sys.platform == 'sunos5':
-+            raise SkipTest
-         flags = os.O_CREAT | os.O_RDWR
-         with NamedTemporaryFile(delete=False) as nt:
-             nt.write("test string")
-diff --git a/test/sample.conf b/test/unit/sample.conf
---- a/test/sample.conf
-+++ b/test/sample.conf
-@@ -29,16 +29,16 @@ password3 = testing3
- # to set them from /etc/swift/swift.conf. If that file isn't found,
- # the test runner will skip tests that depend on these values.
- # Note that the cluster must have "sane" values for the test suite to pass.
+--- swift-2.2.2/test/sample.conf.~1~	2015-02-01 23:44:11.000000000 -0800
++++ swift-2.2.2/test/sample.conf	2015-02-26 16:36:42.753470819 -0800
+@@ -62,17 +62,17 @@ fake_syslog = False
+ # Note that the cluster must have "sane" values for the test suite to pass
+ # (for some definition of sane).
+ #
 -#max_file_size = 5368709122
 -#max_meta_name_length = 128
 -#max_meta_value_length = 256
 -#max_meta_count = 90
 -#max_meta_overall_size = 4096
+-#max_header_size = 8192
 -#max_object_name_length = 1024
 -#container_listing_limit = 10000
 -#account_listing_limit = 10000
@@ -111,11 +43,148 @@
 +max_meta_value_length = 256
 +max_meta_count = 90
 +max_meta_overall_size = 4096
++max_header_size = 8192
 +max_object_name_length = 1024
 +container_listing_limit = 10000
 +account_listing_limit = 10000
 +max_account_name_length = 256
 +max_container_name_length = 256
  
- collate = C
+ # Newer swift versions default to strict cors mode, but older ones were the
+ # opposite.
+--- swift-2.2.2/test/unit/__init__.py.~1~	2015-02-26 16:36:42.754399372 -0800
++++ swift-2.2.2/test/unit/__init__.py	2015-02-26 16:41:30.006380635 -0800
+@@ -670,7 +670,7 @@ def fake_http_connect(*code_iter, **kwar
+                     etag = '"68b329da9893e34099c7d8ad5cb9c940"'
+ 
+             headers = swob.HeaderKeyDict({
+-                'content-length': len(self.body),
++                'content-length': self.body.__len__(),
+                 'content-type': 'x-application/test',
+                 'x-timestamp': self.timestamp,
+                 'x-backend-timestamp': self.timestamp,
+--- swift-2.2.2/test/unit/common/test_utils.py.~1~	2015-02-01 23:44:11.000000000 -0800
++++ swift-2.2.2/test/unit/common/test_utils.py	2015-02-26 16:36:42.756657286 -0800
+@@ -52,6 +52,7 @@ from functools import partial
+ from tempfile import TemporaryFile, NamedTemporaryFile, mkdtemp
+ from netifaces import AF_INET6
+ from mock import MagicMock, patch
++from nose import SkipTest
+ 
+ from swift.common.exceptions import (Timeout, MessageTimeout,
+                                      ConnectionTimeout, LockTimeout,
+@@ -733,6 +734,8 @@ class TestUtils(unittest.TestCase):
+         utils.HASH_PATH_PREFIX = 'startcap'
+ 
+     def test_lock_path(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         tmpdir = mkdtemp()
+         try:
+             with utils.lock_path(tmpdir, 0.1):
+@@ -749,6 +752,8 @@ class TestUtils(unittest.TestCase):
+             shutil.rmtree(tmpdir)
+ 
+     def test_lock_path_num_sleeps(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         tmpdir = mkdtemp()
+         num_short_calls = [0]
+         exception_raised = [False]
+@@ -773,6 +778,8 @@ class TestUtils(unittest.TestCase):
+         self.assertTrue(exception_raised[0])
+ 
+     def test_lock_path_class(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         tmpdir = mkdtemp()
+         try:
+             with utils.lock_path(tmpdir, 0.1, ReplicationLockTimeout):
+@@ -1195,7 +1202,8 @@ class TestUtils(unittest.TestCase):
+             }, 'server', log_route='server')
+             expected_args = [((), {'address': '/dev/log',
+                                    'facility': orig_sysloghandler.LOG_LOCAL3})]
+-            if not os.path.exists('/dev/log') or \
++            if sys.platform == 'sunos5' or \
++                    not os.path.exists('/dev/log') or \
+                     os.path.isfile('/dev/log') or \
+                     os.path.isdir('/dev/log'):
+                 # Since socket on OSX is in /var/run/syslog, there will be
+@@ -2374,6 +2382,8 @@ cluster_dfw1 = http://dfw1.host/v1/
+                 MagicMock(side_effect=BaseException('test3')))
  
+     def test_lock_file(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         flags = os.O_CREAT | os.O_RDWR
+         with NamedTemporaryFile(delete=False) as nt:
+             nt.write("test string")
+@@ -2452,6 +2462,8 @@ cluster_dfw1 = http://dfw1.host/v1/
+                                         os.fstat(f.fileno()).st_ino)
+ 
+     def test_lock_file_held_on_unlink(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         os_unlink = os.unlink
+ 
+         def flocking_unlink(filename):
+@@ -2468,6 +2480,8 @@ cluster_dfw1 = http://dfw1.host/v1/
+                     pass
+ 
+     def test_lock_file_no_unlink_if_fail(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         os_open = os.open
+         with NamedTemporaryFile(delete=True) as nt:
+ 
+--- swift-2.2.2/test/unit/obj/test_diskfile.py.~1~	2015-02-01 23:44:11.000000000 -0800
++++ swift-2.2.2/test/unit/obj/test_diskfile.py	2015-02-26 16:36:42.757582696 -0800
+@@ -18,6 +18,7 @@
+ 
+ import cPickle as pickle
+ import os
++import sys
+ import errno
+ import mock
+ import unittest
+@@ -902,6 +903,8 @@ class TestDiskFileManager(unittest.TestC
+         self.assertEqual(hashes, {})
+ 
+     def test_replication_lock_on(self):
++        if sys.platform == 'sunos5':
++            raise SkipTest
+         # Double check settings
+         self.df_mgr.replication_one_per_device = True
+         self.df_mgr.replication_lock_timeout = 0.1
+--- swift-2.2.2/test/unit/proxy/test_server.py.~1~	2015-02-01 23:44:11.000000000 -0800
++++ swift-2.2.2/test/unit/proxy/test_server.py	2015-02-26 16:36:42.760354922 -0800
+@@ -3376,6 +3376,9 @@ class TestObjectController(unittest.Test
+ 
+         class LargeResponseBody(object):
+ 
++            def __nonzero__(self):
++                return True
++
+             def __len__(self):
+                 return constraints.MAX_FILE_SIZE + 1
+ 
+@@ -3620,6 +3623,9 @@ class TestObjectController(unittest.Test
+ 
+         class LargeResponseBody(object):
+ 
++            def __nonzero__(self):
++                return True
++
+             def __len__(self):
+                 return constraints.MAX_FILE_SIZE + 1
+ 
+@@ -3644,6 +3650,9 @@ class TestObjectController(unittest.Test
+ 
+         class LargeResponseBody(object):
+ 
++            def __nonzero__(self):
++                return True
++
+             def __len__(self):
+                 return constraints.MAX_FILE_SIZE + 1
+