From 76d58265e34851b78e952a7f275340863c90a9f5 Mon Sep 17 00:00:00 2001 From: Wesley Wiedenmeier Date: Thu, 8 Jun 2017 18:23:31 -0400 Subject: Integration Testing: tox env, pyxld 2.2.3, and revamp framework Massive update to clean up and greatly enhance the integration testing framework developed by Wesley Wiedenmeier. - Updated tox environment to run integration test 'citest' to utilize pylxd 2.2.3 - Add support for distro feature flags - add framework for feature flags to release config with feature groups and overrides allowed in any release conf override level - add support for feature flags in platform and config handling - during collect, skip testcases that require features not supported by the image with a warning message - Enable additional distros (i.e. centos, debian) - Add 'bddeb' command to build a deb from the current working tree cleanly in a container, so deps do not have to be installed on host - Adds a command line option '--preserve-data' that ensures that collected data will be left after tests run. This also allows the directory to store collected data in during the run command to be specified using '--data-dir'. - Updated Read the Docs testing page and doc strings for pep 257 compliance --- tests/cloud_tests/testcases/modules/ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/cloud_tests/testcases/modules/ntp.py') diff --git a/tests/cloud_tests/testcases/modules/ntp.py b/tests/cloud_tests/testcases/modules/ntp.py index 82d32880..a4b8c3d8 100644 --- a/tests/cloud_tests/testcases/modules/ntp.py +++ b/tests/cloud_tests/testcases/modules/ntp.py @@ -1,6 +1,6 @@ # This file is part of cloud-init. See LICENSE file for license information. -"""cloud-init Integration Test Verify Script""" +"""cloud-init Integration Test Verify Script.""" from tests.cloud_tests.testcases import base -- cgit v1.2.3 From f0529559f9688a397f59f041dc6362e91faf96b6 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Mon, 26 Jun 2017 10:16:56 -0700 Subject: tests: update ntp tests after sntp added Recent change to ntp in artful has added the sntp package whenever ntp is installed. The tests, rather poorly, did a dpkg -l instead of checking with `which`. This fixes the ntp tests to all use `which` over expecting a certain number of lines using dpkg and as a result make the tests OS independent. --- tests/cloud_tests/configs/modules/ntp.yaml | 20 +++++--------------- tests/cloud_tests/configs/modules/ntp_pools.yaml | 8 ++------ tests/cloud_tests/configs/modules/ntp_servers.yaml | 8 ++------ tests/cloud_tests/testcases/modules/ntp.py | 11 ++++------- tests/cloud_tests/testcases/modules/ntp_pools.py | 2 +- tests/cloud_tests/testcases/modules/ntp_servers.py | 2 +- 6 files changed, 15 insertions(+), 36 deletions(-) (limited to 'tests/cloud_tests/testcases/modules/ntp.py') diff --git a/tests/cloud_tests/configs/modules/ntp.yaml b/tests/cloud_tests/configs/modules/ntp.yaml index 0d07ef5a..fbef431b 100644 --- a/tests/cloud_tests/configs/modules/ntp.yaml +++ b/tests/cloud_tests/configs/modules/ntp.yaml @@ -1,31 +1,21 @@ # # Emtpy NTP config to setup using defaults # -# NOTE: this should not require apt feature, use 'which' rather than 'dpkg -l' -# NOTE: this should not require no_ntpdate feature, use 'which' to check for -# installation rather than 'dpkg -l', as 'grep ntp' matches 'ntpdate' -# NOTE: the verifier should check for any ntp server not 'ubuntu.pool.ntp.org' -required_features: - - apt - - no_ntpdate - - ubuntu_ntp cloud_config: | #cloud-config ntp: pools: {} servers: {} collect_scripts: - ntp_installed_empty: | + ntp_installed: | #!/bin/bash - dpkg -l | grep ntp | wc -l + ntpd --version > /dev/null 2>&1 + echo $? ntp_conf_dist_empty: | #!/bin/bash ls /etc/ntp.conf.dist | wc -l - ntp_conf_empty: | + ntp_conf_pool_list: | #!/bin/bash - grep '^pool' /etc/ntp.conf - ntp_installed_list: | - #!/bin/bash - dpkg -l | grep ntp + grep 'pool.ntp.org' /etc/ntp.conf | grep -v ^# # vi: ts=4 expandtab diff --git a/tests/cloud_tests/configs/modules/ntp_pools.yaml b/tests/cloud_tests/configs/modules/ntp_pools.yaml index 7561c7f3..3a93faa2 100644 --- a/tests/cloud_tests/configs/modules/ntp_pools.yaml +++ b/tests/cloud_tests/configs/modules/ntp_pools.yaml @@ -1,15 +1,10 @@ # # NTP config using specific pools # -# NOTE: this should not require apt feature, use 'which' rather than 'dpkg -l' -# NOTE: this should not require no_ntpdate feature, use 'which' to check for -# installation rather than 'dpkg -l', as 'grep ntp' matches 'ntpdate' # NOTE: lsb_release listed here because with recent cloud-init deb with # (LP: 1628337) resolved, cloud-init will attempt to configure archives. # this fails without lsb_release as UNAVAILABLE is used for $RELEASE required_features: - - apt - - no_ntpdate - lsb_release cloud_config: | #cloud-config @@ -21,7 +16,8 @@ cloud_config: | collect_scripts: ntp_installed_pools: | #!/bin/bash - dpkg -l | grep ntp | wc -l + ntpd --version > /dev/null 2>&1 + echo $? ntp_conf_dist_pools: | #!/bin/bash ls /etc/ntp.conf.dist | wc -l diff --git a/tests/cloud_tests/configs/modules/ntp_servers.yaml b/tests/cloud_tests/configs/modules/ntp_servers.yaml index 9d1d65ef..d59d45a8 100644 --- a/tests/cloud_tests/configs/modules/ntp_servers.yaml +++ b/tests/cloud_tests/configs/modules/ntp_servers.yaml @@ -1,12 +1,7 @@ # # NTP config using specific servers # -# NOTE: this should not require apt feature, use 'which' rather than 'dpkg -l' -# NOTE: this should not require no_ntpdate feature, use 'which' to check for -# installation rather than 'dpkg -l', as 'grep ntp' matches 'ntpdate' required_features: - - apt - - no_ntpdate - lsb_release cloud_config: | #cloud-config @@ -17,7 +12,8 @@ cloud_config: | collect_scripts: ntp_installed_servers: | #!/bin/sh - dpkg -l | grep -c ntp + ntpd --version > /dev/null 2>&1 + echo $? ntp_conf_dist_servers: | #!/bin/sh cat /etc/ntp.conf.dist | wc -l diff --git a/tests/cloud_tests/testcases/modules/ntp.py b/tests/cloud_tests/testcases/modules/ntp.py index a4b8c3d8..b50e52fe 100644 --- a/tests/cloud_tests/testcases/modules/ntp.py +++ b/tests/cloud_tests/testcases/modules/ntp.py @@ -9,8 +9,8 @@ class TestNtp(base.CloudTestCase): def test_ntp_installed(self): """Test ntp installed""" - out = self.get_data_file('ntp_installed_empty') - self.assertEqual(1, int(out)) + out = self.get_data_file('ntp_installed') + self.assertEqual(0, int(out)) def test_ntp_dist_entries(self): """Test dist config file is empty""" @@ -19,10 +19,7 @@ class TestNtp(base.CloudTestCase): def test_ntp_entires(self): """Test config entries""" - out = self.get_data_file('ntp_conf_empty') - self.assertIn('pool 0.ubuntu.pool.ntp.org iburst', out) - self.assertIn('pool 1.ubuntu.pool.ntp.org iburst', out) - self.assertIn('pool 2.ubuntu.pool.ntp.org iburst', out) - self.assertIn('pool 3.ubuntu.pool.ntp.org iburst', out) + out = self.get_data_file('ntp_conf_pool_list') + self.assertIn('pool.ntp.org iburst', out) # vi: ts=4 expandtab diff --git a/tests/cloud_tests/testcases/modules/ntp_pools.py b/tests/cloud_tests/testcases/modules/ntp_pools.py index 336076df..152fd3f1 100644 --- a/tests/cloud_tests/testcases/modules/ntp_pools.py +++ b/tests/cloud_tests/testcases/modules/ntp_pools.py @@ -10,7 +10,7 @@ class TestNtpPools(base.CloudTestCase): def test_ntp_installed(self): """Test ntp installed""" out = self.get_data_file('ntp_installed_pools') - self.assertEqual(1, int(out)) + self.assertEqual(0, int(out)) def test_ntp_dist_entries(self): """Test dist config file is empty""" diff --git a/tests/cloud_tests/testcases/modules/ntp_servers.py b/tests/cloud_tests/testcases/modules/ntp_servers.py index 4010cf80..8d2a68b3 100644 --- a/tests/cloud_tests/testcases/modules/ntp_servers.py +++ b/tests/cloud_tests/testcases/modules/ntp_servers.py @@ -10,7 +10,7 @@ class TestNtpServers(base.CloudTestCase): def test_ntp_installed(self): """Test ntp installed""" out = self.get_data_file('ntp_installed_servers') - self.assertEqual(1, int(out)) + self.assertEqual(0, int(out)) def test_ntp_dist_entries(self): """Test dist config file is empty""" -- cgit v1.2.3