Various testing fixes:
- Tests involving large (5GB+) bodies are mocked, but on 32-bit python,
len() is limited to returning a ssize_t, which can represent 2GB.
- Solaris doesn't yet support syslog logging to /dev/log.
- Solaris exclusive file locks don't fail when applied multiple times
from a single process (it has to happen in a separate process).
- Uncomment portions of test/sample.conf to match what we ship in
/etc/swift/swift.conf, since the latter can't be read without
sufficient privileges. This allows us to set SWIFT_TEST_CONFIG_FILE
and run the functional tests.
The first, while potentially useful elsewhere, is really only an issue on
Solaris because Linux runs almost exclusively 64-bit, which makes this a
non-issue. The second is Solaris-only -- though clearly a similar problem
exists on MacOS -- and we will want to fix this in our Python. The third
is not in a form that is worth sending upstream. To test this properly,
the test should fork a separate process to test the lock, which should work
regardless of the OS.
--- swift-2.3.0/test/sample.conf.~1~ 2015-04-30 06:57:42.000000000 -0700
+++ swift-2.3.0/test/sample.conf 2016-02-08 01:24:17.841343735 -0800
@@ -87,17 +87,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
-#max_account_name_length = 256
-#max_container_name_length = 256
+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
+max_account_name_length = 256
+max_container_name_length = 256
# Newer swift versions default to strict cors mode, but older ones were the
# opposite.
--- swift-2.3.0/test/unit/__init__.py.~1~ 2015-04-30 06:57:42.000000000 -0700
+++ swift-2.3.0/test/unit/__init__.py 2016-02-08 01:24:17.842339594 -0800
@@ -817,7 +817,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.3.0/test/unit/common/test_utils.py.~1~ 2015-04-30 06:57:42.000000000 -0700
+++ swift-2.3.0/test/unit/common/test_utils.py 2016-02-08 01:24:17.844724978 -0800
@@ -53,6 +53,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,
@@ -748,6 +749,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):
@@ -764,6 +767,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]
@@ -788,6 +793,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):
@@ -1214,7 +1221,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 \
# Since socket on OSX is in /var/run/syslog, there will be
@@ -2402,6 +2410,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")
@@ -2480,6 +2490,8 @@ cluster_dfw1 = http://dfw1.host/v1/
def test_lock_file_held_on_unlink(self):
+ if sys.platform == 'sunos5':
+ raise SkipTest
os_unlink = os.unlink
def flocking_unlink(filename):
@@ -2496,6 +2508,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.3.0/test/unit/obj/test_diskfile.py.~1~ 2015-04-30 06:57:42.000000000 -0700
+++ swift-2.3.0/test/unit/obj/test_diskfile.py 2016-02-08 01:24:17.846568734 -0800
@@ -18,6 +18,7 @@
import cPickle as pickle
import os
+import sys
import errno
import itertools
import mock
@@ -608,6 +609,8 @@ class DiskFileManagerMixin(BaseDiskFileT
self.assertEqual(locations, [])
def test_replication_lock_on(self):
+ if sys.platform == 'sunos5':
+ raise SkipTest
# Double check settings
--- swift-2.3.0/test/unit/proxy/test_server.py.~1~ 2015-04-30 06:57:42.000000000 -0700
+++ swift-2.3.0/test/unit/proxy/test_server.py 2016-02-08 01:24:17.849738022 -0800
@@ -4263,6 +4263,9 @@ class TestObjectController(unittest.Test
class LargeResponseBody(object):
+ def __nonzero__(self):
+ return True
+
def __len__(self):
return constraints.MAX_FILE_SIZE + 1
@@ -4510,6 +4513,9 @@ class TestObjectController(unittest.Test
class LargeResponseBody(object):
+ def __nonzero__(self):
+ return True
+
def __len__(self):
return constraints.MAX_FILE_SIZE + 1
@@ -4537,6 +4543,9 @@ class TestObjectController(unittest.Test
class LargeResponseBody(object):
+ def __nonzero__(self):
+ return True
+
def __len__(self):
return constraints.MAX_FILE_SIZE + 1