Add possibility to trace UEs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import logging
|
||||
import tempfile
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
stream=sys.stdout,
|
||||
@@ -16,6 +17,7 @@ import cls_cmd
|
||||
class TestModule(unittest.TestCase):
|
||||
def test_simple_module(self):
|
||||
c = cls_module.Module_UE("test", filename="tests/config/test_module_infra.yaml")
|
||||
self.assertFalse(c.trace)
|
||||
success = c.initialize()
|
||||
self.assertTrue(success)
|
||||
ip = c.attach()
|
||||
@@ -37,5 +39,20 @@ class TestModule(unittest.TestCase):
|
||||
logs = c.terminate()
|
||||
self.assertEqual(logs, None) # no tracing
|
||||
|
||||
def test_simple_trace(self):
|
||||
c = cls_module.Module_UE("test-trace", filename="tests/config/test_module_infra.yaml")
|
||||
self.assertTrue(c.trace)
|
||||
success = c.initialize()
|
||||
self.assertTrue(success)
|
||||
ip = c.attach()
|
||||
self.assertEqual(ip, "127.0.0.1")
|
||||
self.assertTrue(c.checkMTU())
|
||||
c.detach()
|
||||
tmp = tempfile.mkdtemp()
|
||||
log_file = c.terminate(log_dir=tmp)
|
||||
with cls_cmd.LocalCmd() as c:
|
||||
c.run(f'rm -rf {tmp}')
|
||||
self.assertEqual(log_file, [f"{tmp}/tttf"]) # matches test-trace UE collection file
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user