From c7289833848ba5003c7493f9d15a9f5518e457eb Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 11 Oct 2021 15:29:03 +0200 Subject: [PATCH] Add a test checking memory consumption of container --- src/Container/Test/testcontainer.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Container/Test/testcontainer.py b/src/Container/Test/testcontainer.py index 3789420ed..5eb7b255f 100644 --- a/src/Container/Test/testcontainer.py +++ b/src/Container/Test/testcontainer.py @@ -96,7 +96,20 @@ class TestResourceManager(unittest.TestCase): self.assertGreater(memory_total, memory_in_use) self.assertGreater(memory_in_use, memory_by_me) cont.Shutdown() - + + def test5(self): + """ + Test checking memory consumption of container + """ + cont = self.getContainer("test_container_5") + memory_by_me_start = cont.getTotalPhysicalMemoryInUseByMe() + import pickle + psn = cont.createPyScriptNode("n","""b = bytearray(10485760)""")# create 10MB byte array abroad + psn.execute([],pickle.dumps(((),{}))) + memory_by_me_end = cont.getTotalPhysicalMemoryInUseByMe() + self.assertGreater(memory_by_me_end,memory_by_me_start) + self.assertIn(memory_by_me_end-memory_by_me_start,[10,11,12])# test elevation of memory + cont.Shutdown() if __name__ == '__main__': salome.standalone() -- 2.39.2