timoninmaxim commented on a change in pull request #8352:
URL: https://github.com/apache/ignite/pull/8352#discussion_r510861671
##########
File path: modules/ducktests/tests/ignitetest/tests/self_test.py
##########
@@ -53,3 +55,38 @@ def test_assertion_convertion(self, ignite_version):
else:
app.stop()
assert False
+
+ def test_clock_sync(self):
+ """
+ Tests if clocks are synchronized between nodes.
+ """
+
+ service = GetTimeService(self.test_context,
self.test_context.cluster.num_available_nodes())
+ service.start()
+
+ service.clocks.sort(key=operator.itemgetter(1))
+
+ for _ in service.clocks:
+ self.logger.info("NodeClock[%s] = %d" % (_[0], _[1]))
+
+ max_clock_spread_ms = 300
+ min_res = service.clocks[0]
+ max_res = service.clocks[-1]
+ assert max_res[1] - min_res[1] < max_clock_spread_ms, \
+ "Clock difference between %s and %s exceeds %d ms." % (min_res[0],
max_res[0], max_clock_spread_ms)
+
+
+class GetTimeService(BackgroundThreadService):
+ """
+ Collects clock timestamps from a set of nodes.
+ """
+
+ def __init__(self, context, num_nodes):
+ super().__init__(context, num_nodes)
+ self.clocks = []
+
+ def start_node(self, node):
+ self.clocks.append((node.name, int(node.account.ssh_output("date
+%s"))))
Review comment:
`date +%s` returns seconds. But max_clock_spread_ms is milliseconds.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]