From: robk-tahoe Date: Fri, 3 Oct 2008 17:20:44 +0000 (-0700) Subject: fuse/runtests: add a very simple 'write' test X-Git-Url: https://git.rkrishnan.org/pf/content/it.html?a=commitdiff_plain;h=af9e1f62381f47c008ffd1052d6dbd09bfacb1fa;p=tahoe-lafs%2Ftahoe-lafs.git fuse/runtests: add a very simple 'write' test this performs a very simple write through the fuse layer and confirms that the file is stored correctly into the tahoe mesh. ('simple' in the sense that the entire file body fits trivially in a single write() operation, disk block etc) --- diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index 059d0818..0a25a40e 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -426,6 +426,29 @@ class SystemTest (object): tmpl = 'Expected file contents %r but found %r' raise TestFailure(tmpl, body, found) + def get_file(self, dircap, path): + body = self.webapi_call('GET', '/uri/%s/%s' % (dircap, path)) + return body + + def test_write_small_file(self, testcap, testdir): + name = 'smallfile.txt' + body = 'this is a small file' + + try: + path = os.path.join(testdir, name) + f = file(path, 'w') + f.write(body) + f.close() + except Exception, err: + tmpl = 'Could not write file contents at %r: %r' + raise TestFailure(tmpl, path, err) + + uploaded_body = self.get_file(testcap, name) + + if uploaded_body != body: + tmpl = 'Expected file contents %r but found %r' + raise TestFailure(tmpl, body, uploaded_body) + # Utilities: def run_tahoe(self, *args):