|
@@ -293,14 +293,14 @@ def test_ntp_server_configuration(host):
|
|
|
configuration = configuration_file.content_string.split("\n")
|
|
|
configuration = [c.strip() for c in configuration if re.match(r'^\s*(|#.*)$', c) is None]
|
|
|
|
|
|
# Ensure correct servers have been configured in the pool.
|
|
|
servers = [c for c in configuration if c.startswith('server')]
|
|
|
# Ensure correct pools have been configured.
|
|
|
pools = [c for c in configuration if c.startswith('pool')]
|
|
|
|
|
|
expected_servers = ["server 0.debian.pool.ntp.org iburst",
|
|
|
"server 1.debian.pool.ntp.org iburst",
|
|
|
"server 2.debian.pool.ntp.org iburst"]
|
|
|
expected_pools = ["pool 0.debian.pool.ntp.org iburst",
|
|
|
"pool 1.debian.pool.ntp.org iburst",
|
|
|
"pool 2.debian.pool.ntp.org iburst"]
|
|
|
|
|
|
assert sorted(servers) == sorted(expected_servers)
|
|
|
assert sorted(pools) == sorted(expected_pools)
|
|
|
|
|
|
# Ensure querying of server is disabled for untrusted clients.
|
|
|
restrictions = [c for c in configuration if c.startswith('restrict')]
|
|
@@ -311,15 +311,14 @@ def test_ntp_server_configuration(host):
|
|
|
assert sorted(restrictions) == sorted(expected_restrictions)
|
|
|
|
|
|
|
|
|
def test_ntp_query_server_count(host):
|
|
|
|
|
|
# Two lines for headers, and one line per configured server.
|
|
|
expected_stdout_line_count = 5
|
|
|
def test_ntp_runtime_pool_count(host):
|
|
|
|
|
|
ntpq = host.command("ntpq -p -n")
|
|
|
|
|
|
assert ntpq.rc == 0
|
|
|
assert len(ntpq.stdout.strip().split("\n")) == expected_stdout_line_count
|
|
|
|
|
|
# We expect 3 pools, as requested via role parameter.
|
|
|
ntpq_pool_info = [line for line in ntpq.stdout.split("\n") if ".POOL." in line]
|
|
|
assert len(ntpq_pool_info) == 3
|
|
|
|
|
|
|
|
|
def test_ntp_listening_interfaces(host):
|