Skip to content

Instantly share code, notes, and snippets.

@bloodeagle40234
Created February 16, 2017 02:25
Show Gist options
  • Save bloodeagle40234/bf9eada4ecc41d6516c55fa014c0d78c to your computer and use it in GitHub Desktop.
Save bloodeagle40234/bf9eada4ecc41d6516c55fa014c0d78c to your computer and use it in GitHub Desktop.
diff --git a/test/test_pyeclib_api.py b/test/test_pyeclib_api.py
index 7d1cccb..30a9fe9 100644
--- a/test/test_pyeclib_api.py
+++ b/test/test_pyeclib_api.py
@@ -730,6 +730,27 @@ class TestPyECLibDriver(unittest.TestCase):
'Memory usage is increased unexpectedly %s -> %s' %
(baseline_usage, new_usage))
+ def test_reconstruct_memory_usage_liberasurecode_rs_vand(self):
+ # 1. Prepare the expected memory allocation
+ ec_driver = ECDriver(ec_type='liberasurecode_rs_vand', k=10, m=4)
+ encoded = ec_driver.encode(b'aaa')
+ loop_range = range(1000000)
+ recon = ec_driver.reconstruct(encoded[-10:], [0])
+ self.assertEqual(recon[0], encoded[0])
+
+ # 2. Get current memory usage
+ baseline_usage = resource.getrusage(resource.RUSAGE_SELF)[2]
+
+ # 3. Loop to call get_metadata
+ for x in loop_range:
+ ec_driver.reconstruct(encoded[:10], [13])
+
+ # 4. memory usage shouldn't increase
+ new_usage = resource.getrusage(resource.RUSAGE_SELF)[2]
+ self.assertEqual(baseline_usage, new_usage,
+ 'Memory usage is increased unexpectedly %s -> %s' %
+ (baseline_usage, new_usage))
+
class TestBackendsEnabled(unittest.TestCase):
'''Based on TestPyECLibDriver.test_valid_algo above, but these tests
======================================================================
FAIL: test_reconstruct_memory_usage_liberasurecode_rs_vand (test.test_pyeclib_api.TestPyECLibDriver)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tsuyuzaki/git_repos/pyeclib/test/test_pyeclib_api.py", line 752, in test_reconstruct_memory_usage_liberasurecode_rs_vand
(baseline_usage, new_usage))
AssertionError: Memory usage is increased unexpectedly 55036 -> 101764
-------------------- >> begin captured logging << --------------------
pyeclib: WARNING: DEPRECATED WARNING: your liberasurecode 1.0.9 will be deprecated in the near future because of the issue https://bugs.launchpad.net/swift/+bug/1639691; Please upgrade to >=1.3.1 and rebuild pyeclib to suppress this message
--------------------- >> end captured logging << ---------------------
----------------------------------------------------------------------
@bloodeagle40234
Copy link
Author

Please ignore deprecated warning caused from my hookey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment