Review at

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
M src/osmo_gsm_tester/
M src/osmo_gsm_tester/
2 files changed, 4 insertions(+), 0 deletions(-)

  git pull ssh:// refs/changes/63/3463/1

diff --git a/src/osmo_gsm_tester/ b/src/osmo_gsm_tester/
index 7063c33..376152a 100644
--- a/src/osmo_gsm_tester/
+++ b/src/osmo_gsm_tester/
@@ -52,6 +52,9 @@
         self.next_user_message_reference = 1
     def __del__(self):
+        self.cleanup()
+    def cleanup(self):
         except smpplib.exceptions.ConnectionError:
diff --git a/src/osmo_gsm_tester/ b/src/osmo_gsm_tester/
index d510b93..2ac2062 100644
--- a/src/osmo_gsm_tester/
+++ b/src/osmo_gsm_tester/
@@ -368,6 +368,7 @@
     def esme(self):
         esme_obj = esme.Esme(self.msisdn())
+        self.register_for_cleanup(esme_obj)
         return esme_obj
     def msisdn(self):

To view, visit
To unsubscribe, visit

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3a23bb8bbccfe7ac5c544521b5566164609f0a5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <>

Reply via email to