diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2017-05-19 16:49:11 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2017-05-19 16:55:08 -0400 |
commit | e11d3899d47ec5fcb545e0c7820af9d3995cb574 (patch) | |
tree | a36c05438254df94b410ff88fba2c672709b5673 /tests/cloud_tests/testcases/modules/ntp_servers.py | |
parent | afdddf8eea34866b43d1fc92624f9ac175802f36 (diff) | |
download | vyos-cloud-init-e11d3899d47ec5fcb545e0c7820af9d3995cb574.tar.gz vyos-cloud-init-e11d3899d47ec5fcb545e0c7820af9d3995cb574.zip |
cc_ntp: write template before installing and add service restart
On systems which installed ntp and specified servers or pools in the
config ntpd didn't notice the updated configuration file and didn't
use the correct configuration. Resolve this by rendering the template
first which allows the package install to use the existing
configuration. Additionally add a service restart to handle the case
where ntp does not need to be installed but it may not have started.
Add an integration test to confirm that cc_ntp enables ntp to use the
specific servers and pools in the cloud-config.
LP: #1645644
Diffstat (limited to 'tests/cloud_tests/testcases/modules/ntp_servers.py')
-rw-r--r-- | tests/cloud_tests/testcases/modules/ntp_servers.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/cloud_tests/testcases/modules/ntp_servers.py b/tests/cloud_tests/testcases/modules/ntp_servers.py index 4879bb6f..9ef270ee 100644 --- a/tests/cloud_tests/testcases/modules/ntp_servers.py +++ b/tests/cloud_tests/testcases/modules/ntp_servers.py @@ -13,13 +13,22 @@ class TestNtpServers(base.CloudTestCase): self.assertEqual(1, int(out)) def test_ntp_dist_entries(self): - """Test dist config file has one entry""" + """Test dist config file is empty""" out = self.get_data_file('ntp_conf_dist_servers') - self.assertEqual(1, int(out)) + self.assertEqual(0, int(out)) def test_ntp_entires(self): - """Test config entries""" - out = self.get_data_file('ntp_conf_servers') - self.assertIn('server pool.ntp.org iburst', out) + """Test config pools entries""" + out = self.get_data_file('ntp_conf_pools') + servers = self.cloud_config.get('ntp').get('servers') + for server in servers: + self.assertIn('server %s iburst' % server, out) + + def test_ntpq_servers(self): + """Test ntpq output has configured servers""" + out = self.get_data_file('ntpq_servers') + servers = self.cloud_config.get('ntp').get('servers') + for server in servers: + self.assertIn(server, out) # vi: ts=4 expandtab |