Skip to content

Commit

Permalink
test_big_file
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejs committed Oct 2, 2009
1 parent 7570323 commit c047e29
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/basic.py
Expand Up @@ -5,6 +5,7 @@
import subprocess import subprocess
import time import time
import glob import glob
import stat


class BasicGridfsFUSETestCase(unittest.TestCase): class BasicGridfsFUSETestCase(unittest.TestCase):


Expand Down Expand Up @@ -33,8 +34,6 @@ def test_read_write(self):
r.read()) r.read())


def test_stat(self): def test_stat(self):
import stat

path = os.path.join(self.mount, 'testfile.txt') path = os.path.join(self.mount, 'testfile.txt')
with open(path, 'w') as w: with open(path, 'w') as w:
w.write('test') w.write('test')
Expand Down Expand Up @@ -89,6 +88,21 @@ def test_rename(self):
with open(path2, 'r') as r: with open(path2, 'r') as r:
self.assertEquals('file1', r.read()) self.assertEquals('file1', r.read())


def test_big_file(self):
# Test creation/reading of a file that's bigger than
# the chunk size
path = os.path.join(self.mount, 'big')
size = 256 * 1024 * 3 + 100
data = 'A' * size

with open(path, 'w') as w:
w.write(data)

with open(path, 'r') as r:
self.assertEquals(data, r.read())

self.assertEquals(size, os.stat(path).st_size)

def suite(): def suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(BasicGridfsFUSETestCase()) suite.addTest(BasicGridfsFUSETestCase())
Expand Down

0 comments on commit c047e29

Please sign in to comment.