path: root/src/osmo_gsm_tester/esme.py
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-10 10:59:40 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-10 10:59:43 +0200
commitac9c1bb32f4a2d02e8e661f2b4f3ce628f3a9c6b (patch)
treead3b91c227c1ac4d97956e7b07fdf9c52789c1f5 /src/osmo_gsm_tester/esme.py
parenta10aeaea4be72638657251afdbe91c0e9522d7fa (diff)
esme: Add cleanup function to avoid cascade failure of tests
In commit 6100b629e55ed4aa319f46ad797741131b9da8e7 I assumed esme already had a cleanup function, which doesn't seem to be the case. This means if a test calls esme.connect() and fails afterwards without calling esme.disconnect(), the connection will be kept but as the test will finish and the NITB is closed, then the connection will be kept forever in an erroneous state. With the cleanup function we ensure we will close the connection after the test. Change-Id: Ia3a23bb8bbccfe7ac5c544521b5566164609f0a5
Diffstat (limited to 'src/osmo_gsm_tester/esme.py')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/osmo_gsm_tester/esme.py b/src/osmo_gsm_tester/esme.py
index 7063c33..376152a 100644
--- a/src/osmo_gsm_tester/esme.py
+++ b/src/osmo_gsm_tester/esme.py
@@ -52,6 +52,9 @@ class Esme(log.Origin):
self.next_user_message_reference = 1
def __del__(self):
+ self.cleanup()
+ def cleanup(self):
except smpplib.exceptions.ConnectionError: