Commit c16a8274 authored by Lu Xu's avatar Lu Xu 👀

software/end-to-end-testing: ensure cleanup

parent 10cef4df
...@@ -6,6 +6,7 @@ from websocket import create_connection ...@@ -6,6 +6,7 @@ from websocket import create_connection
class WebsocketTestClass(e2e.EndToEndTestCase): class WebsocketTestClass(e2e.EndToEndTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
try:
super().setUpClass() super().setUpClass()
cls.enb_instance_name = time.strftime('e2e-cb003-enb-%Y-%B-%d-%H:%M:%S') cls.enb_instance_name = time.strftime('e2e-cb003-enb-%Y-%B-%d-%H:%M:%S')
...@@ -32,6 +33,12 @@ class WebsocketTestClass(e2e.EndToEndTestCase): ...@@ -32,6 +33,12 @@ class WebsocketTestClass(e2e.EndToEndTestCase):
cls.waitUntilGreen(cls.enb_instance_name) cls.waitUntilGreen(cls.enb_instance_name)
cls.waitUntilGreen(cls.cn_instance_name) cls.waitUntilGreen(cls.cn_instance_name)
except Exception as e:
cls.logger.error("Error during setup: " + str(e))
# Ensure cleanup
cls.tearDownClass()
raise
@classmethod @classmethod
def retry_request(cls, func, *args, **kwargs): def retry_request(cls, func, *args, **kwargs):
for attempt in range(cls.max_retries): for attempt in range(cls.max_retries):
......
...@@ -6,6 +6,7 @@ from websocket import create_connection ...@@ -6,6 +6,7 @@ from websocket import create_connection
class WebsocketTestClass(e2e.EndToEndTestCase): class WebsocketTestClass(e2e.EndToEndTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
try:
super().setUpClass() super().setUpClass()
cls.enb_instance_name = time.strftime('e2e-ors84-enb-%Y-%B-%d-%H:%M:%S') cls.enb_instance_name = time.strftime('e2e-ors84-enb-%Y-%B-%d-%H:%M:%S')
...@@ -31,6 +32,12 @@ class WebsocketTestClass(e2e.EndToEndTestCase): ...@@ -31,6 +32,12 @@ class WebsocketTestClass(e2e.EndToEndTestCase):
cls.waitUntilGreen(cls.enb_instance_name) cls.waitUntilGreen(cls.enb_instance_name)
cls.waitUntilGreen(cls.cn_instance_name) cls.waitUntilGreen(cls.cn_instance_name)
except Exception as e:
cls.logger.error("Error during setup: " + str(e))
# Ensure cleanup
cls.tearDownClass()
raise
@classmethod @classmethod
def retry_request(cls, func, *args, **kwargs): def retry_request(cls, func, *args, **kwargs):
for attempt in range(cls.max_retries): for attempt in range(cls.max_retries):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment