summaryrefslogtreecommitdiffstats
path: root/ufo/test
diff options
context:
space:
mode:
authorMohammed Junaid <junaid@redhat.com>2012-12-18 10:55:24 +0530
committerVijay Bellur <vbellur@redhat.com>2013-01-22 19:14:30 -0800
commit16d2801f072f5eb1d2ddb56a2ab5eecd3a42010a (patch)
tree23629bbc03ed925200745cc84e75cb8dfbb48f47 /ufo/test
parent2f60c8a4776a6052cfba43605263dd32c616cfa2 (diff)
object-storage: use temp file optimization
A file name '.<FILENAME>.<RANDOM>' will hash to the same GlusterFS node as a file named '<FILENAME>', thus avoiding creation/deletion of linkfiles on a rename. This is part of the work needed to address BZ 876660 (https://bugzilla.redhat.com/show_bug.cgi?id=876660). Change-Id: I6f18c14b8eaa7a35c96f7e455ef3a19bee7dbde5 BUG: 876660 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.org/4325 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Peter Portante <pportant@redhat.com>
Diffstat (limited to 'ufo/test')
-rw-r--r--ufo/test/unit/common/test_diskfile.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/ufo/test/unit/common/test_diskfile.py b/ufo/test/unit/common/test_diskfile.py
index 7583fd7fa5d..fb0dc3e16d5 100644
--- a/ufo/test/unit/common/test_diskfile.py
+++ b/ufo/test/unit/common/test_diskfile.py
@@ -108,7 +108,6 @@ class TestDiskFile(unittest.TestCase):
assert gdf.datadir == "/tmp/foo/vol0/bar"
assert gdf.device_path == "/tmp/foo/vol0"
assert gdf._container_path == "/tmp/foo/vol0/bar"
- assert gdf.tmpdir == "/tmp/foo/vol0/tmp"
assert gdf.disk_chunk_size == 65536
assert gdf.iter_hook == None
assert gdf.logger == self.lg
@@ -134,7 +133,6 @@ class TestDiskFile(unittest.TestCase):
assert gdf.name == "bar/b/a"
assert gdf.datadir == "/tmp/foo/vol0/bar/b/a"
assert gdf.device_path == "/tmp/foo/vol0"
- assert gdf.tmpdir == "/tmp/foo/vol0/tmp"
def test_constructor_no_metadata(self):
td = tempfile.mkdtemp()
@@ -848,10 +846,11 @@ class TestDiskFile(unittest.TestCase):
"dir/z", self.lg)
saved_tmppath = ''
with gdf.mkstemp() as fd:
- assert gdf.tmpdir == os.path.join(td, "vol0", "tmp")
- assert os.path.isdir(gdf.tmpdir)
+ assert gdf.datadir == os.path.join(td, "vol0", "bar", "dir")
+ assert os.path.isdir(gdf.datadir)
saved_tmppath = gdf.tmppath
- assert os.path.dirname(saved_tmppath) == gdf.tmpdir
+ assert os.path.dirname(saved_tmppath) == gdf.datadir
+ assert os.path.basename(saved_tmppath)[:3] == '.z.'
assert os.path.exists(saved_tmppath)
os.write(fd, "123")
assert not os.path.exists(saved_tmppath)
@@ -867,10 +866,11 @@ class TestDiskFile(unittest.TestCase):
"dir/z", self.lg)
saved_tmppath = ''
with gdf.mkstemp() as fd:
- assert gdf.tmpdir == os.path.join(td, "vol0", "tmp")
- assert os.path.isdir(gdf.tmpdir)
+ assert gdf.datadir == os.path.join(td, "vol0", "bar", "dir")
+ assert os.path.isdir(gdf.datadir)
saved_tmppath = gdf.tmppath
- assert os.path.dirname(saved_tmppath) == gdf.tmpdir
+ assert os.path.dirname(saved_tmppath) == gdf.datadir
+ assert os.path.basename(saved_tmppath)[:3] == '.z.'
assert os.path.exists(saved_tmppath)
os.write(fd, "123")
os.close(fd)
@@ -887,10 +887,11 @@ class TestDiskFile(unittest.TestCase):
"dir/z", self.lg)
saved_tmppath = ''
with gdf.mkstemp() as fd:
- assert gdf.tmpdir == os.path.join(td, "vol0", "tmp")
- assert os.path.isdir(gdf.tmpdir)
+ assert gdf.datadir == os.path.join(td, "vol0", "bar", "dir")
+ assert os.path.isdir(gdf.datadir)
saved_tmppath = gdf.tmppath
- assert os.path.dirname(saved_tmppath) == gdf.tmpdir
+ assert os.path.dirname(saved_tmppath) == gdf.datadir
+ assert os.path.basename(saved_tmppath)[:3] == '.z.'
assert os.path.exists(saved_tmppath)
os.write(fd, "123")
os.unlink(saved_tmppath)