obsolete PATH_TO_TEST_XFS
This commit is contained in:
commit
e784f1c3a4
@ -50,7 +50,7 @@ If you are going to use a separate partition for Swift data, be sure to add anot
|
|||||||
`/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0`
|
`/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0`
|
||||||
#. `mkdir /mnt/sdb1`
|
#. `mkdir /mnt/sdb1`
|
||||||
#. `mount /mnt/sdb1`
|
#. `mount /mnt/sdb1`
|
||||||
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 /mnt/sdb1/test`
|
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4`
|
||||||
#. `chown <your-user-name>:<your-group-name> /mnt/sdb1/*`
|
#. `chown <your-user-name>:<your-group-name> /mnt/sdb1/*`
|
||||||
#. `mkdir /srv`
|
#. `mkdir /srv`
|
||||||
#. `for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done`
|
#. `for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done`
|
||||||
@ -77,7 +77,7 @@ If you want to use a loopback device instead of another partition, follow these
|
|||||||
`/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0`
|
`/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0`
|
||||||
#. `mkdir /mnt/sdb1`
|
#. `mkdir /mnt/sdb1`
|
||||||
#. `mount /mnt/sdb1`
|
#. `mount /mnt/sdb1`
|
||||||
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 /mnt/sdb1/test`
|
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4`
|
||||||
#. `chown <your-user-name>:<your-group-name> /mnt/sdb1/*`
|
#. `chown <your-user-name>:<your-group-name> /mnt/sdb1/*`
|
||||||
#. `mkdir /srv`
|
#. `mkdir /srv`
|
||||||
#. `for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done`
|
#. `for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done`
|
||||||
@ -204,7 +204,6 @@ Do these commands as you on guest:
|
|||||||
#. `cd ~/swift/trunk; sudo python setup.py develop`
|
#. `cd ~/swift/trunk; sudo python setup.py develop`
|
||||||
#. Edit `~/.bashrc` and add to the end::
|
#. Edit `~/.bashrc` and add to the end::
|
||||||
|
|
||||||
export PATH_TO_TEST_XFS=/mnt/sdb1/test
|
|
||||||
export SWIFT_TEST_CONFIG_FILE=/etc/swift/func_test.conf
|
export SWIFT_TEST_CONFIG_FILE=/etc/swift/func_test.conf
|
||||||
export PATH=${PATH}:~/bin
|
export PATH=${PATH}:~/bin
|
||||||
|
|
||||||
@ -536,7 +535,7 @@ Setting up scripts for running Swift
|
|||||||
sudo umount /mnt/sdb1
|
sudo umount /mnt/sdb1
|
||||||
sudo mkfs.xfs -f -i size=1024 /dev/sdb1
|
sudo mkfs.xfs -f -i size=1024 /dev/sdb1
|
||||||
sudo mount /mnt/sdb1
|
sudo mount /mnt/sdb1
|
||||||
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 /mnt/sdb1/test
|
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
|
||||||
sudo chown <your-user-name>:<your-group-name> /mnt/sdb1/*
|
sudo chown <your-user-name>:<your-group-name> /mnt/sdb1/*
|
||||||
mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4
|
mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4
|
||||||
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
|
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
|
||||||
|
@ -37,6 +37,36 @@ def tmpfile(content):
|
|||||||
finally:
|
finally:
|
||||||
os.unlink(file_name)
|
os.unlink(file_name)
|
||||||
|
|
||||||
|
xattr_data = {}
|
||||||
|
|
||||||
|
|
||||||
|
def _get_inode(fd):
|
||||||
|
if not isinstance(fd, int):
|
||||||
|
try:
|
||||||
|
fd = fd.fileno()
|
||||||
|
except AttributeError:
|
||||||
|
return os.stat(fd).st_ino
|
||||||
|
return os.fstat(fd).st_ino
|
||||||
|
|
||||||
|
|
||||||
|
def _setxattr(fd, k, v):
|
||||||
|
inode = _get_inode(fd)
|
||||||
|
data = xattr_data.get(inode, {})
|
||||||
|
data[k] = v
|
||||||
|
xattr_data[inode] = data
|
||||||
|
|
||||||
|
|
||||||
|
def _getxattr(fd, k):
|
||||||
|
inode = _get_inode(fd)
|
||||||
|
data = xattr_data.get(inode, {}).get(k)
|
||||||
|
if not data:
|
||||||
|
raise IOError
|
||||||
|
return data
|
||||||
|
|
||||||
|
import xattr
|
||||||
|
xattr.setxattr = _setxattr
|
||||||
|
xattr.getxattr = _getxattr
|
||||||
|
|
||||||
|
|
||||||
class MockTrue(object):
|
class MockTrue(object):
|
||||||
"""
|
"""
|
||||||
|
@ -19,6 +19,7 @@ import unittest
|
|||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from time import time
|
from time import time
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from eventlet import spawn, TimeoutError, listen
|
from eventlet import spawn, TimeoutError, listen
|
||||||
from eventlet.timeout import Timeout
|
from eventlet.timeout import Timeout
|
||||||
@ -33,16 +34,7 @@ class TestContainerController(unittest.TestCase):
|
|||||||
""" Test swift.container_server.ContainerController """
|
""" Test swift.container_server.ContainerController """
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
""" Set up for testing swift.object_server.ObjectController """
|
""" Set up for testing swift.object_server.ObjectController """
|
||||||
self.path_to_test_xfs = os.environ.get('PATH_TO_TEST_XFS')
|
self.testdir = os.path.join(mkdtemp(),
|
||||||
if not self.path_to_test_xfs or \
|
|
||||||
not os.path.exists(self.path_to_test_xfs):
|
|
||||||
print >>sys.stderr, 'WARNING: PATH_TO_TEST_XFS not set or not ' \
|
|
||||||
'pointing to a valid directory.\n' \
|
|
||||||
'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \
|
|
||||||
'system for testing.'
|
|
||||||
self.testdir = '/tmp/SWIFTUNITTEST'
|
|
||||||
else:
|
|
||||||
self.testdir = os.path.join(self.path_to_test_xfs,
|
|
||||||
'tmp_test_object_server_ObjectController')
|
'tmp_test_object_server_ObjectController')
|
||||||
mkdirs(self.testdir)
|
mkdirs(self.testdir)
|
||||||
rmtree(self.testdir)
|
rmtree(self.testdir)
|
||||||
|
@ -19,6 +19,7 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
from gzip import GzipFile
|
from gzip import GzipFile
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from eventlet import spawn, TimeoutError, listen
|
from eventlet import spawn, TimeoutError, listen
|
||||||
from eventlet.timeout import Timeout
|
from eventlet.timeout import Timeout
|
||||||
@ -35,17 +36,7 @@ class TestContainerUpdater(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
utils.HASH_PATH_SUFFIX = 'endcap'
|
utils.HASH_PATH_SUFFIX = 'endcap'
|
||||||
self.path_to_test_xfs = os.environ.get('PATH_TO_TEST_XFS')
|
self.testdir = os.path.join(mkdtemp(), 'tmp_test_container_updater')
|
||||||
if not self.path_to_test_xfs or \
|
|
||||||
not os.path.exists(self.path_to_test_xfs):
|
|
||||||
print >>sys.stderr, 'WARNING: PATH_TO_TEST_XFS not set or not ' \
|
|
||||||
'pointing to a valid directory.\n' \
|
|
||||||
'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \
|
|
||||||
'system for testing.'
|
|
||||||
self.testdir = '/tmp/SWIFTUNITTEST'
|
|
||||||
else:
|
|
||||||
self.testdir = os.path.join(self.path_to_test_xfs,
|
|
||||||
'tmp_test_container_updater')
|
|
||||||
rmtree(self.testdir, ignore_errors=1)
|
rmtree(self.testdir, ignore_errors=1)
|
||||||
os.mkdir(self.testdir)
|
os.mkdir(self.testdir)
|
||||||
pickle.dump(RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
|
pickle.dump(RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
|
||||||
|
@ -14,13 +14,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# TODO: Tests
|
# TODO: Tests
|
||||||
|
from test import unit as _setup_mocks
|
||||||
import unittest
|
import unittest
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
from tempfile import mkdtemp
|
||||||
from swift.obj import auditor
|
from swift.obj import auditor
|
||||||
|
from swift.obj import server as object_server
|
||||||
from swift.obj.server import DiskFile, write_metadata
|
from swift.obj.server import DiskFile, write_metadata
|
||||||
from swift.common.utils import hash_path, mkdirs, normalize_timestamp, renamer
|
from swift.common.utils import hash_path, mkdirs, normalize_timestamp, renamer
|
||||||
from swift.obj.replicator import invalidate_hash
|
from swift.obj.replicator import invalidate_hash
|
||||||
@ -30,18 +33,8 @@ from swift.common.exceptions import AuditException
|
|||||||
class TestAuditor(unittest.TestCase):
|
class TestAuditor(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.path_to_test_xfs = os.environ.get('PATH_TO_TEST_XFS')
|
self.testdir = \
|
||||||
if not self.path_to_test_xfs or \
|
os.path.join(mkdtemp(), 'tmp_test_object_auditor')
|
||||||
not os.path.exists(self.path_to_test_xfs):
|
|
||||||
print >> sys.stderr, 'WARNING: PATH_TO_TEST_XFS not set or not ' \
|
|
||||||
'pointing to a valid directory.\n' \
|
|
||||||
'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \
|
|
||||||
'system for testing.'
|
|
||||||
self.testdir = '/tmp/SWIFTUNITTEST'
|
|
||||||
else:
|
|
||||||
self.testdir = os.path.join(self.path_to_test_xfs,
|
|
||||||
'tmp_test_object_auditor')
|
|
||||||
|
|
||||||
self.devices = os.path.join(self.testdir, 'node')
|
self.devices = os.path.join(self.testdir, 'node')
|
||||||
rmtree(self.testdir, ignore_errors=1)
|
rmtree(self.testdir, ignore_errors=1)
|
||||||
os.mkdir(self.testdir)
|
os.mkdir(self.testdir)
|
||||||
|
@ -23,10 +23,12 @@ from nose import SkipTest
|
|||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from time import gmtime, sleep, strftime, time
|
from time import gmtime, sleep, strftime, time
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from eventlet import sleep, spawn, wsgi, listen
|
from eventlet import sleep, spawn, wsgi, listen
|
||||||
from webob import Request
|
from webob import Request
|
||||||
from xattr import getxattr, setxattr
|
from test.unit import _getxattr as getxattr
|
||||||
|
from test.unit import _setxattr as setxattr
|
||||||
|
|
||||||
from test.unit import connect_tcp, readuntil2crlfs
|
from test.unit import connect_tcp, readuntil2crlfs
|
||||||
from swift.obj import server as object_server
|
from swift.obj import server as object_server
|
||||||
@ -39,17 +41,8 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
""" Set up for testing swift.object_server.ObjectController """
|
""" Set up for testing swift.object_server.ObjectController """
|
||||||
self.path_to_test_xfs = os.environ.get('PATH_TO_TEST_XFS')
|
self.testdir = \
|
||||||
if not self.path_to_test_xfs or \
|
os.path.join(mkdtemp(), 'tmp_test_object_server_ObjectController')
|
||||||
not os.path.exists(self.path_to_test_xfs):
|
|
||||||
print >> sys.stderr, 'WARNING: PATH_TO_TEST_XFS not set or not ' \
|
|
||||||
'pointing to a valid directory.\n' \
|
|
||||||
'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \
|
|
||||||
'system for testing.'
|
|
||||||
self.testdir = '/tmp/SWIFTUNITTEST'
|
|
||||||
else:
|
|
||||||
self.testdir = os.path.join(self.path_to_test_xfs,
|
|
||||||
'tmp_test_object_server_ObjectController')
|
|
||||||
mkdirs(self.testdir)
|
mkdirs(self.testdir)
|
||||||
rmtree(self.testdir)
|
rmtree(self.testdir)
|
||||||
mkdirs(os.path.join(self.testdir, 'sda1'))
|
mkdirs(os.path.join(self.testdir, 'sda1'))
|
||||||
@ -64,8 +57,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def test_POST_update_meta(self):
|
def test_POST_update_meta(self):
|
||||||
""" Test swift.object_server.ObjectController.POST """
|
""" Test swift.object_server.ObjectController.POST """
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': timestamp,
|
headers={'X-Timestamp': timestamp,
|
||||||
@ -93,8 +84,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.headers['Content-Type'], 'application/x-test')
|
self.assertEquals(resp.headers['Content-Type'], 'application/x-test')
|
||||||
|
|
||||||
def test_POST_not_exist(self):
|
def test_POST_not_exist(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/fail',
|
req = Request.blank('/sda1/p/a/c/fail',
|
||||||
environ={'REQUEST_METHOD': 'POST'},
|
environ={'REQUEST_METHOD': 'POST'},
|
||||||
@ -116,8 +105,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 400)
|
self.assertEquals(resp.status_int, 400)
|
||||||
|
|
||||||
def test_POST_container_connection(self):
|
def test_POST_container_connection(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
|
|
||||||
def mock_http_connect(response, with_exc=False):
|
def mock_http_connect(response, with_exc=False):
|
||||||
|
|
||||||
@ -222,8 +209,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 411)
|
self.assertEquals(resp.status_int, 411)
|
||||||
|
|
||||||
def test_PUT_common(self):
|
def test_PUT_common(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': timestamp,
|
headers={'X-Timestamp': timestamp,
|
||||||
@ -247,8 +232,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'name': '/a/c/o'})
|
'name': '/a/c/o'})
|
||||||
|
|
||||||
def test_PUT_overwrite(self):
|
def test_PUT_overwrite(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': normalize_timestamp(time()),
|
headers={'X-Timestamp': normalize_timestamp(time()),
|
||||||
'Content-Length': '6',
|
'Content-Length': '6',
|
||||||
@ -281,8 +264,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'Content-Encoding': 'gzip'})
|
'Content-Encoding': 'gzip'})
|
||||||
|
|
||||||
def test_PUT_no_etag(self):
|
def test_PUT_no_etag(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': normalize_timestamp(time()),
|
headers={'X-Timestamp': normalize_timestamp(time()),
|
||||||
'Content-Type': 'text/plain'})
|
'Content-Type': 'text/plain'})
|
||||||
@ -300,8 +281,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 422)
|
self.assertEquals(resp.status_int, 422)
|
||||||
|
|
||||||
def test_PUT_user_metadata(self):
|
def test_PUT_user_metadata(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': timestamp,
|
headers={'X-Timestamp': timestamp,
|
||||||
@ -329,8 +308,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'X-Object-Meta-Two': 'Two'})
|
'X-Object-Meta-Two': 'Two'})
|
||||||
|
|
||||||
def test_PUT_container_connection(self):
|
def test_PUT_container_connection(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
|
|
||||||
def mock_http_connect(response, with_exc=False):
|
def mock_http_connect(response, with_exc=False):
|
||||||
|
|
||||||
@ -399,8 +376,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def test_HEAD(self):
|
def test_HEAD(self):
|
||||||
""" Test swift.object_server.ObjectController.HEAD """
|
""" Test swift.object_server.ObjectController.HEAD """
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c')
|
req = Request.blank('/sda1/p/a/c')
|
||||||
resp = self.object_controller.HEAD(req)
|
resp = self.object_controller.HEAD(req)
|
||||||
self.assertEquals(resp.status_int, 400)
|
self.assertEquals(resp.status_int, 400)
|
||||||
@ -466,8 +441,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def test_GET(self):
|
def test_GET(self):
|
||||||
""" Test swift.object_server.ObjectController.GET """
|
""" Test swift.object_server.ObjectController.GET """
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c')
|
req = Request.blank('/sda1/p/a/c')
|
||||||
resp = self.object_controller.GET(req)
|
resp = self.object_controller.GET(req)
|
||||||
self.assertEquals(resp.status_int, 400)
|
self.assertEquals(resp.status_int, 400)
|
||||||
@ -555,8 +528,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 404)
|
self.assertEquals(resp.status_int, 404)
|
||||||
|
|
||||||
def test_GET_if_match(self):
|
def test_GET_if_match(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers={
|
||||||
'X-Timestamp': normalize_timestamp(time()),
|
'X-Timestamp': normalize_timestamp(time()),
|
||||||
@ -610,8 +581,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 412)
|
self.assertEquals(resp.status_int, 412)
|
||||||
|
|
||||||
def test_GET_if_none_match(self):
|
def test_GET_if_none_match(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers={
|
||||||
'X-Timestamp': normalize_timestamp(time()),
|
'X-Timestamp': normalize_timestamp(time()),
|
||||||
@ -661,8 +630,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.etag, etag)
|
self.assertEquals(resp.etag, etag)
|
||||||
|
|
||||||
def test_GET_if_modified_since(self):
|
def test_GET_if_modified_since(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers={
|
||||||
@ -698,8 +665,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 304)
|
self.assertEquals(resp.status_int, 304)
|
||||||
|
|
||||||
def test_GET_if_unmodified_since(self):
|
def test_GET_if_unmodified_since(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers={
|
||||||
@ -737,8 +702,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def test_DELETE(self):
|
def test_DELETE(self):
|
||||||
""" Test swift.object_server.ObjectController.DELETE """
|
""" Test swift.object_server.ObjectController.DELETE """
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c',
|
req = Request.blank('/sda1/p/a/c',
|
||||||
environ={'REQUEST_METHOD': 'DELETE'})
|
environ={'REQUEST_METHOD': 'DELETE'})
|
||||||
resp = self.object_controller.DELETE(req)
|
resp = self.object_controller.DELETE(req)
|
||||||
@ -865,8 +828,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(outbuf.getvalue()[:4], '405 ')
|
self.assertEquals(outbuf.getvalue()[:4], '405 ')
|
||||||
|
|
||||||
def test_chunked_put(self):
|
def test_chunked_put(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
listener = listen(('localhost', 0))
|
listener = listen(('localhost', 0))
|
||||||
port = listener.getsockname()[1]
|
port = listener.getsockname()[1]
|
||||||
killer = spawn(wsgi.server, listener, self.object_controller,
|
killer = spawn(wsgi.server, listener, self.object_controller,
|
||||||
@ -891,8 +852,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
killer.kill()
|
killer.kill()
|
||||||
|
|
||||||
def test_max_object_name_length(self):
|
def test_max_object_name_length(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/' + ('1' * 1024),
|
req = Request.blank('/sda1/p/a/c/' + ('1' * 1024),
|
||||||
environ={'REQUEST_METHOD': 'PUT'},
|
environ={'REQUEST_METHOD': 'PUT'},
|
||||||
@ -912,8 +871,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 400)
|
self.assertEquals(resp.status_int, 400)
|
||||||
|
|
||||||
def test_disk_file_app_iter_corners(self):
|
def test_disk_file_app_iter_corners(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
df = object_server.DiskFile(self.testdir, 'sda1', '0', 'a', 'c', 'o')
|
df = object_server.DiskFile(self.testdir, 'sda1', '0', 'a', 'c', 'o')
|
||||||
mkdirs(df.datadir)
|
mkdirs(df.datadir)
|
||||||
f = open(os.path.join(df.datadir,
|
f = open(os.path.join(df.datadir,
|
||||||
@ -946,8 +903,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assert_(os.path.exists(tmpdir))
|
self.assert_(os.path.exists(tmpdir))
|
||||||
|
|
||||||
def test_max_upload_time(self):
|
def test_max_upload_time(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
|
|
||||||
class SlowBody():
|
class SlowBody():
|
||||||
|
|
||||||
@ -996,8 +951,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 499)
|
self.assertEquals(resp.status_int, 499)
|
||||||
|
|
||||||
def test_bad_sinces(self):
|
def test_bad_sinces(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': normalize_timestamp(time()),
|
headers={'X-Timestamp': normalize_timestamp(time()),
|
||||||
'Content-Length': '4', 'Content-Type': 'text/plain'},
|
'Content-Length': '4', 'Content-Type': 'text/plain'},
|
||||||
@ -1022,8 +975,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int, 412)
|
self.assertEquals(resp.status_int, 412)
|
||||||
|
|
||||||
def test_content_encoding(self):
|
def test_content_encoding(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': normalize_timestamp(time()),
|
headers={'X-Timestamp': normalize_timestamp(time()),
|
||||||
'Content-Length': '4', 'Content-Type': 'text/plain',
|
'Content-Length': '4', 'Content-Type': 'text/plain',
|
||||||
@ -1042,8 +993,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.headers['content-encoding'], 'gzip')
|
self.assertEquals(resp.headers['content-encoding'], 'gzip')
|
||||||
|
|
||||||
def test_manifest_header(self):
|
def test_manifest_header(self):
|
||||||
if not self.path_to_test_xfs:
|
|
||||||
raise SkipTest
|
|
||||||
timestamp = normalize_timestamp(time())
|
timestamp = normalize_timestamp(time())
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Timestamp': timestamp,
|
headers={'X-Timestamp': timestamp,
|
||||||
|
@ -60,15 +60,8 @@ def setup():
|
|||||||
# Since we're starting up a lot here, we're going to test more than
|
# Since we're starting up a lot here, we're going to test more than
|
||||||
# just chunked puts; we're also going to test parts of
|
# just chunked puts; we're also going to test parts of
|
||||||
# proxy_server.Application we couldn't get to easily otherwise.
|
# proxy_server.Application we couldn't get to easily otherwise.
|
||||||
path_to_test_xfs = os.environ.get('PATH_TO_TEST_XFS')
|
|
||||||
if not path_to_test_xfs or not os.path.exists(path_to_test_xfs):
|
|
||||||
print >> sys.stderr, 'WARNING: PATH_TO_TEST_XFS not set or not ' \
|
|
||||||
'pointing to a valid directory.\n' \
|
|
||||||
'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \
|
|
||||||
'system for testing.'
|
|
||||||
raise SkipTest
|
|
||||||
_testdir = \
|
_testdir = \
|
||||||
os.path.join(path_to_test_xfs, 'tmp_test_proxy_server_chunked')
|
os.path.join(mkdtemp(), 'tmp_test_proxy_server_chunked')
|
||||||
mkdirs(_testdir)
|
mkdirs(_testdir)
|
||||||
rmtree(_testdir)
|
rmtree(_testdir)
|
||||||
mkdirs(os.path.join(_testdir, 'sda1'))
|
mkdirs(os.path.join(_testdir, 'sda1'))
|
||||||
@ -1639,7 +1632,6 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.headers.get('x-object-meta-ours'), 'okay')
|
self.assertEquals(resp.headers.get('x-object-meta-ours'), 'okay')
|
||||||
|
|
||||||
def test_chunked_put(self):
|
def test_chunked_put(self):
|
||||||
# quick test of chunked put w/o PATH_TO_TEST_XFS
|
|
||||||
|
|
||||||
class ChunkedFile():
|
class ChunkedFile():
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user