fixed tests
This commit is contained in:
parent
4e8d10cb44
commit
b4c3307cdf
3 changed files with 5 additions and 3 deletions
|
@ -9,7 +9,7 @@ class DiskSpaceManager:
|
|||
@property
|
||||
def space_used_bytes(self):
|
||||
used = 0
|
||||
data_dir = self.config.data_dir
|
||||
data_dir = os.path.join(self.config.data_dir, 'blobfiles')
|
||||
for item in os.listdir(data_dir):
|
||||
blob_path = os.path.join(data_dir, item)
|
||||
if os.path.isfile(blob_path):
|
||||
|
|
|
@ -520,6 +520,7 @@ class DiskSpaceManagement(CommandTestCase):
|
|||
self.assertIn('disk_space', status)
|
||||
self.assertEqual(status['disk_space']['used'], '0')
|
||||
await self.stream_create('foo', '0.01', data=('0' * 3 * 1024 * 1024).encode())
|
||||
await self.stream_create('foo', '0.01', data=('0' * 2 * 1024 * 1024).encode())
|
||||
status = await self.daemon.jsonrpc_status()
|
||||
self.assertIn('disk_space', status)
|
||||
self.assertEqual(status['disk_space']['used'], '3')
|
||||
self.assertEqual(status['disk_space']['used'], '5')
|
||||
|
|
|
@ -11,6 +11,7 @@ class ConfigurationTests(unittest.TestCase):
|
|||
|
||||
def test_space_calculation(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.mkdir(os.path.join(temp_dir, 'blobfiles'))
|
||||
config = Config(
|
||||
data_dir=temp_dir,
|
||||
wallet_dir=temp_dir,
|
||||
|
@ -18,6 +19,6 @@ class ConfigurationTests(unittest.TestCase):
|
|||
)
|
||||
dsm = DiskSpaceManager(config)
|
||||
self.assertEqual(0, dsm.space_used_mb)
|
||||
with open(os.path.join(config.data_dir, '3mb-file'), 'w') as blob:
|
||||
with open(os.path.join(config.data_dir, 'blobfiles', '3mb-file'), 'w') as blob:
|
||||
blob.write('0' * 3 * 1024 * 1024)
|
||||
self.assertEqual(3, dsm.space_used_mb)
|
||||
|
|
Loading…
Add table
Reference in a new issue