This commit is contained in:
Clay Gerrard 2011-01-19 16:19:43 -06:00
parent 29eddb8c24
commit e64e21dd01
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,7 @@ def tmpfile(content):
xattr_data = {} xattr_data = {}
def _get_inode(fd): def _get_inode(fd):
if not isinstance(fd, int): if not isinstance(fd, int):
try: try:
@ -47,12 +48,14 @@ def _get_inode(fd):
return os.stat(fd).st_ino return os.stat(fd).st_ino
return os.fstat(fd).st_ino return os.fstat(fd).st_ino
def _setxattr(fd, k, v): def _setxattr(fd, k, v):
inode = _get_inode(fd) inode = _get_inode(fd)
data = xattr_data.get(inode, {}) data = xattr_data.get(inode, {})
data[k] = v data[k] = v
xattr_data[inode] = data xattr_data[inode] = data
def _getxattr(fd, k): def _getxattr(fd, k):
inode = _get_inode(fd) inode = _get_inode(fd)
data = xattr_data.get(inode, {}).get(k) data = xattr_data.get(inode, {}).get(k)

View File

@ -34,7 +34,8 @@ 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.testdir = os.path.join(mkdtemp(), 'tmp_test_object_server_ObjectController') self.testdir = os.path.join(mkdtemp(),
'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'))