Change in osmo-gsm-tester[master]: ms: Only use completed tests for min/max handling

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sat Jun 23 20:55:56 UTC 2018


Holger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/9718


Change subject: ms: Only use completed tests for min/max handling
......................................................................

ms: Only use completed tests for min/max handling

Remove non completed results before calculating the min/max. We will
need to check success/failure based on completion ratio.

Change-Id: Icaf9e90dd729b2339e409b3ec1593f456969fd19
---
M src/osmo_ms_driver/location_update_test.py
1 file changed, 11 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/18/9718/1

diff --git a/src/osmo_ms_driver/location_update_test.py b/src/osmo_ms_driver/location_update_test.py
index a5823a5..c1113b1 100644
--- a/src/osmo_ms_driver/location_update_test.py
+++ b/src/osmo_ms_driver/location_update_test.py
@@ -186,10 +186,18 @@
         from functools import reduce
         return reduce(lambda b, ms: b and ms.has_lu_time(), self._results.values(), True)
 
+    def results_min_max(self, results):
+        min_value = max_value = None
+        for result in results:
+            if min_value is None or result.lu_delay() < min_value:
+                min_value = result.lu_delay()
+            if max_value is None or result.lu_delay() > max_value:
+                max_value = result.lu_delay()
+        return min_value, max_value
+
     def print_stats(self):
         all_completed = self.all_completed()
-        min_value = min(self._results.values(), key=lambda x: x.lu_delay())
-        max_value = max(self._results.values(), key=lambda x: x.lu_delay())
+        min_value, max_value = self.results_min_max(filter(lambda x: x.has_lu_time(), self._results.values()))
 
         self.log("Tests done", all_completed=all_completed,
-                    min=min_value.lu_delay(), max=max_value.lu_delay())
+                    min=min_value, max=max_value)

-- 
To view, visit https://gerrit.osmocom.org/9718
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaf9e90dd729b2339e409b3ec1593f456969fd19
Gerrit-Change-Number: 9718
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180623/604188be/attachment.htm>


More information about the gerrit-log mailing list