2810N/AVarious testing fixes:
2810N/A
2810N/A - Tests involving large (5GB+) bodies are mocked, but on 32-bit python,
2810N/A len() is limited to returning a ssize_t, which can represent 2GB.
2810N/A
2810N/A - Solaris doesn't yet support syslog logging to /dev/log.
2810N/A
3482N/A - Solaris exclusive file locks don't fail when applied multiple times
3482N/A from a single process (it has to happen in a separate process).
3482N/A
3482N/A - Uncomment portions of test/sample.conf to match what we ship in
3482N/A /etc/swift/swift.conf, since the latter can't be read without
3482N/A sufficient privileges. This allows us to set SWIFT_TEST_CONFIG_FILE
3482N/A and run the functional tests.
3482N/A
2900N/AThe first, while potentially useful elsewhere, is really only an issue on
2900N/ASolaris because Linux runs almost exclusively 64-bit, which makes this a
3482N/Anon-issue. The second is Solaris-only -- though clearly a similar problem
3482N/Aexists on MacOS -- and we will want to fix this in our Python. The third
3482N/Ais not in a form that is worth sending upstream. To test this properly,
3482N/Athe test should fork a separate process to test the lock, which should work
3482N/Aregardless of the OS.
2810N/A
6033N/A--- swift-2.3.0/test/sample.conf.~1~ 2015-04-30 06:57:42.000000000 -0700
6033N/A+++ swift-2.3.0/test/sample.conf 2016-02-08 01:24:17.841343735 -0800
6033N/A@@ -87,17 +87,17 @@ fake_syslog = False
4070N/A # Note that the cluster must have "sane" values for the test suite to pass
4070N/A # (for some definition of sane).
4070N/A #
3482N/A-#max_file_size = 5368709122
3482N/A-#max_meta_name_length = 128
3482N/A-#max_meta_value_length = 256
3482N/A-#max_meta_count = 90
3482N/A-#max_meta_overall_size = 4096
4070N/A-#max_header_size = 8192
3482N/A-#max_object_name_length = 1024
3482N/A-#container_listing_limit = 10000
3482N/A-#account_listing_limit = 10000
3482N/A-#max_account_name_length = 256
3482N/A-#max_container_name_length = 256
3482N/A+max_file_size = 5368709122
3482N/A+max_meta_name_length = 128
3482N/A+max_meta_value_length = 256
3482N/A+max_meta_count = 90
3482N/A+max_meta_overall_size = 4096
4070N/A+max_header_size = 8192
3482N/A+max_object_name_length = 1024
3482N/A+container_listing_limit = 10000
3482N/A+account_listing_limit = 10000
3482N/A+max_account_name_length = 256
3482N/A+max_container_name_length = 256
3482N/A
4070N/A # Newer swift versions default to strict cors mode, but older ones were the
4070N/A # opposite.
6033N/A--- swift-2.3.0/test/unit/__init__.py.~1~ 2015-04-30 06:57:42.000000000 -0700
6033N/A+++ swift-2.3.0/test/unit/__init__.py 2016-02-08 01:24:17.842339594 -0800
6033N/A@@ -817,7 +817,7 @@ def fake_http_connect(*code_iter, **kwar
4070N/A etag = '"68b329da9893e34099c7d8ad5cb9c940"'
4070N/A
4070N/A headers = swob.HeaderKeyDict({
4070N/A- 'content-length': len(self.body),
4070N/A+ 'content-length': self.body.__len__(),
4070N/A 'content-type': 'x-application/test',
4070N/A 'x-timestamp': self.timestamp,
4070N/A 'x-backend-timestamp': self.timestamp,
6033N/A--- swift-2.3.0/test/unit/common/test_utils.py.~1~ 2015-04-30 06:57:42.000000000 -0700
6033N/A+++ swift-2.3.0/test/unit/common/test_utils.py 2016-02-08 01:24:17.844724978 -0800
6033N/A@@ -53,6 +53,7 @@ from functools import partial
4070N/A from tempfile import TemporaryFile, NamedTemporaryFile, mkdtemp
4070N/A from netifaces import AF_INET6
4070N/A from mock import MagicMock, patch
4070N/A+from nose import SkipTest
4070N/A
4070N/A from swift.common.exceptions import (Timeout, MessageTimeout,
4070N/A ConnectionTimeout, LockTimeout,
6033N/A@@ -748,6 +749,8 @@ class TestUtils(unittest.TestCase):
4070N/A utils.HASH_PATH_PREFIX = 'startcap'
4070N/A
4070N/A def test_lock_path(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A tmpdir = mkdtemp()
4070N/A try:
4070N/A with utils.lock_path(tmpdir, 0.1):
6033N/A@@ -764,6 +767,8 @@ class TestUtils(unittest.TestCase):
4070N/A shutil.rmtree(tmpdir)
4070N/A
4070N/A def test_lock_path_num_sleeps(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A tmpdir = mkdtemp()
4070N/A num_short_calls = [0]
4070N/A exception_raised = [False]
6033N/A@@ -788,6 +793,8 @@ class TestUtils(unittest.TestCase):
4070N/A self.assertTrue(exception_raised[0])
4070N/A
4070N/A def test_lock_path_class(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A tmpdir = mkdtemp()
4070N/A try:
4070N/A with utils.lock_path(tmpdir, 0.1, ReplicationLockTimeout):
6033N/A@@ -1214,7 +1221,8 @@ class TestUtils(unittest.TestCase):
4070N/A }, 'server', log_route='server')
4070N/A expected_args = [((), {'address': '/dev/log',
4070N/A 'facility': orig_sysloghandler.LOG_LOCAL3})]
4070N/A- if not os.path.exists('/dev/log') or \
4070N/A+ if sys.platform == 'sunos5' or \
4070N/A+ not os.path.exists('/dev/log') or \
4070N/A os.path.isfile('/dev/log') or \
4070N/A os.path.isdir('/dev/log'):
4070N/A # Since socket on OSX is in /var/run/syslog, there will be
6033N/A@@ -2402,6 +2410,8 @@ cluster_dfw1 = http://dfw1.host/v1/
4070N/A MagicMock(side_effect=BaseException('test3')))
3482N/A
4070N/A def test_lock_file(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A flags = os.O_CREAT | os.O_RDWR
4070N/A with NamedTemporaryFile(delete=False) as nt:
4070N/A nt.write("test string")
6033N/A@@ -2480,6 +2490,8 @@ cluster_dfw1 = http://dfw1.host/v1/
4070N/A os.fstat(f.fileno()).st_ino)
4070N/A
4070N/A def test_lock_file_held_on_unlink(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A os_unlink = os.unlink
4070N/A
4070N/A def flocking_unlink(filename):
6033N/A@@ -2496,6 +2508,8 @@ cluster_dfw1 = http://dfw1.host/v1/
4070N/A pass
4070N/A
4070N/A def test_lock_file_no_unlink_if_fail(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A os_open = os.open
4070N/A with NamedTemporaryFile(delete=True) as nt:
4070N/A
6033N/A--- swift-2.3.0/test/unit/obj/test_diskfile.py.~1~ 2015-04-30 06:57:42.000000000 -0700
6033N/A+++ swift-2.3.0/test/unit/obj/test_diskfile.py 2016-02-08 01:24:17.846568734 -0800
4070N/A@@ -18,6 +18,7 @@
4070N/A
4070N/A import cPickle as pickle
4070N/A import os
4070N/A+import sys
4070N/A import errno
6033N/A import itertools
4070N/A import mock
6033N/A@@ -608,6 +609,8 @@ class DiskFileManagerMixin(BaseDiskFileT
6033N/A self.assertEqual(locations, [])
4070N/A
4070N/A def test_replication_lock_on(self):
4070N/A+ if sys.platform == 'sunos5':
4070N/A+ raise SkipTest
4070N/A # Double check settings
4070N/A self.df_mgr.replication_one_per_device = True
4070N/A self.df_mgr.replication_lock_timeout = 0.1
6033N/A--- swift-2.3.0/test/unit/proxy/test_server.py.~1~ 2015-04-30 06:57:42.000000000 -0700
6033N/A+++ swift-2.3.0/test/unit/proxy/test_server.py 2016-02-08 01:24:17.849738022 -0800
6033N/A@@ -4263,6 +4263,9 @@ class TestObjectController(unittest.Test
4070N/A
4070N/A class LargeResponseBody(object):
4070N/A
4070N/A+ def __nonzero__(self):
4070N/A+ return True
4070N/A+
4070N/A def __len__(self):
4070N/A return constraints.MAX_FILE_SIZE + 1
4070N/A
6033N/A@@ -4510,6 +4513,9 @@ class TestObjectController(unittest.Test
4070N/A
4070N/A class LargeResponseBody(object):
4070N/A
4070N/A+ def __nonzero__(self):
4070N/A+ return True
4070N/A+
4070N/A def __len__(self):
4070N/A return constraints.MAX_FILE_SIZE + 1
4070N/A
6033N/A@@ -4537,6 +4543,9 @@ class TestObjectController(unittest.Test
4070N/A
4070N/A class LargeResponseBody(object):
4070N/A
4070N/A+ def __nonzero__(self):
4070N/A+ return True
4070N/A+
4070N/A def __len__(self):
4070N/A return constraints.MAX_FILE_SIZE + 1
4070N/A