diff --git a/roles/common/tests/test_parameters_optional.py b/roles/common/tests/test_parameters_optional.py index 89c405877be2704dc5dd14cef5b846147acbbbec..5ffc9474cd9b2ce04cc7ee5b985cf66cac8a2829 100644 --- a/roles/common/tests/test_parameters_optional.py +++ b/roles/common/tests/test_parameters_optional.py @@ -320,12 +320,25 @@ def test_ntp_server_configuration(File, Sudo): # Ensure querying of server is disable for untrusted clients. restrictions = [c for c in configuration if c.startswith('restrict')] - expected_restrictions = ["restrict -4 default kod notrap nomodify nopeer noquery notrust", - "restrict -6 default kod notrap nomodify nopeer noquery notrust"] + expected_restrictions = ["restrict -4 default kod notrap nomodify nopeer noquery", + "restrict -6 default kod notrap nomodify nopeer noquery", + "restrict 127.0.0.1", + "restrict ::1"] assert sorted(restrictions) == sorted(expected_restrictions) +def test_ntp_query_server_count(Command): + + # Two lines for headers, and one line per configured server. + expected_stdout_line_count = 5 + + ntpq = Command("ntpq -p -n") + + assert ntpq.rc == 0 + assert len(ntpq.stdout.split("\n")) == expected_stdout_line_count + + def test_ntp_listening_interfaces(Socket): """ Tests if NTP server is listening on correct ports.