diff --git a/devops/helpers/ntp.py b/devops/helpers/ntp.py index 4ba51ecb..6315533a 100644 --- a/devops/helpers/ntp.py +++ b/devops/helpers/ntp.py @@ -119,7 +119,7 @@ class BaseNtp(AbstractNtp): for peer in peers: p = peer.split() remote = str(p[0]) - reach = int(p[6], 8) # From octal to int + # reach = int(p[6], 8) # From octal to int offset = float(p[8]) jitter = float(p[9]) @@ -134,8 +134,12 @@ class BaseNtp(AbstractNtp): # 3. reachability bit array should have '1' at least in # two lower bits as the last two successful checks - if reach & 3 != 3: - continue + # TODO(sbog): we should improve this, as unstable reference + # is still a reference and can be used for time sync. Moreover, + # if there are other servers which can easily be a reference + # one, that reachability of current one is not a problem at all. + # if reach & 3 != 3: + # continue return True return False diff --git a/devops/tests/helpers/test_ntp.py b/devops/tests/helpers/test_ntp.py index bdaf7b38..cf6284a6 100644 --- a/devops/tests/helpers/test_ntp.py +++ b/devops/tests/helpers/test_ntp.py @@ -155,7 +155,7 @@ class TestNtpInitscript(NtpTestCase): ntp_init = ntp.NtpInitscript(self.remote_mock, 'node') assert ntp_init._get_sync_complete() is True - def test_get_sync_complete_false(self): + def test_get_sync_complete_with_unstable_peer(self): self.remote_mock.execute.side_effect = ( self.make_exec_result('/etc/init.d/ntp'), self.make_exec_result("""\ @@ -169,7 +169,7 @@ class TestNtpInitscript(NtpTestCase): """)) ntp_init = ntp.NtpInitscript(self.remote_mock, 'node') - assert ntp_init._get_sync_complete() is False + assert ntp_init._get_sync_complete() is True def test_wait_peer(self): ntp_init = ntp.NtpInitscript(self.remote_mock, 'node')