[Git][NTPsec/ntpsec][master] Fixed test_summary to properly test last_sync field.

Ian Bruene gitlab at mg.gitlab.com
Sun Oct 8 15:58:49 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
0f9cd92b by Ian Bruene at 2017-10-08T10:57:39-05:00
Fixed test_summary to properly test last_sync field.

- - - - -


1 changed file:

- tests/pylib/test_util.py


Changes:

=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -1087,106 +1087,106 @@ class TestPeerSummary(unittest.TestCase):
             ntp.util.canonicalize_dns = cdns_jig
             # Test, no units, hmode=BCLIENTX, peers
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 b    -"
+                             " clock_canon     .FAIL.           8 b 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=BROADCAST, not multicast
             data["hmode"] = (5, "5")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 B    -"
+                             " clock_canon     .FAIL.           8 B 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=BROADCAST, not multicast
             data["srcadr"] = ("224.2.3.4", "224.2.3.4")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 M    -"
+                             " clock_canon     .FAIL.           8 M 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=CLIENT, local refclock
             data["srcadr"] = ("10.20.30.40", "10.20.30.40")
             data["hmode"] = (3, "3")
             data["srchost"] = ("(blah)", "(blah)")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 l    -"
+                             " clock_canon     .FAIL.           8 l 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=CLIENT, pool
             data["srchost"] = ("15.25.35.45", "15.25.35.45")
             data["refid"] = ("POOL", "POOL")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .POOL.           8 p    -"
+                             " clock_canon     .POOL.           8 p 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=CLIENT, manycast client
             data["srcadr"] = ("224.2.3.4", "224.2.3.4")
             data["refid"] = ("FAIL", "FAIL")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 a    -"
+                             " clock_canon     .FAIL.           8 a 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=CLIENT, unicast
             data["srcadr"] = ("10.20.30.40", "10.20.30.40")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 u    -"
+                             " clock_canon     .FAIL.           8 u 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=ACTIVE
             data["hmode"] = (1, "1")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 s    -"
+                             " clock_canon     .FAIL.           8 s 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, hmode=PASSIVE
             data["hmode"] = (2, "2")
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 S    -"
+                             " clock_canon     .FAIL.           8 S 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, don't show hostnames
             cls.showhostnames = False
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " 10.20.30.40     .FAIL.           8 S    -"
+                             " 10.20.30.40     .FAIL.           8 S 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, name crop
             cls.showhostnames = True
             cdns_jig_returns = ["clock_canon_blah_jabber_quantum"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon_bla .FAIL.           8 S    -"
+                             " clock_canon_bla .FAIL.           8 S 3819"
                              "   32  764   1.2346   2.7183   3.1416\n")
             # Test, no units, name crop
             cls.wideremote = True
             cdns_jig_returns = ["clock_canon_blah_jabber_quantum"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
                              " clock_canon_blah_jabber_quantum\n"
                              "                 .FAIL.           8 S"
-                             "    -   32  764   1.2346   2.7183   3.1416\n")
+                             " 3819   32  764   1.2346   2.7183   3.1416\n")
             # Test, with units
             cls.showunits = True
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.           8 S    -"
+                             " clock_canon     .FAIL.           8 S 3819"
                              "   32  764 1.2346ms 2.7183ms 3.1416ms\n")
             # Test, apeers
             cls.showunits = True
             cls.displaymode = "apeers"
             cdns_jig_returns = ["clock_canon"]
-            faketimemod.time_returns = [0]
+            faketimemod.time_returns = [0xA0000000]
             self.assertEqual(cls.summary(5, data, 12345),
-                             " clock_canon     .FAIL.   12345   8 S    -"
+                             " clock_canon     .FAIL.   12345   8 S 3819"
                              "   32  764 1.2346ms 2.7183ms 3.1416ms\n")
         finally:
             ntp.util.time = timetemp



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0f9cd92b31375bc7d952ddb497a2a4876e70bfd7

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0f9cd92b31375bc7d952ddb497a2a4876e70bfd7
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171008/608f62cc/attachment.html>


More information about the vc mailing list