diff options
Diffstat (limited to 'tests/cloud_tests/testcases')
61 files changed, 281 insertions, 305 deletions
diff --git a/tests/cloud_tests/testcases/__init__.py b/tests/cloud_tests/testcases/__init__.py index a1d86d45..47217ce6 100644 --- a/tests/cloud_tests/testcases/__init__.py +++ b/tests/cloud_tests/testcases/__init__.py @@ -1,5 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. +"""Main init.""" + import importlib import inspect import unittest @@ -9,12 +11,12 @@ from tests.cloud_tests.testcases.base import CloudTestCase as base_test def discover_tests(test_name): - """ - discover tests in test file for 'testname' - return_value: list of test classes + """Discover tests in test file for 'testname'. + + @return_value: list of test classes """ testmod_name = 'tests.cloud_tests.testcases.{}'.format( - config.name_sanatize(test_name)) + config.name_sanitize(test_name)) try: testmod = importlib.import_module(testmod_name) except NameError: @@ -26,9 +28,9 @@ def discover_tests(test_name): def get_suite(test_name, data, conf): - """ - get test suite with all tests for 'testname' - return_value: a test suite + """Get test suite with all tests for 'testname'. + + @return_value: a test suite """ suite = unittest.TestSuite() for test_class in discover_tests(test_name): diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py index 64d5507a..bb545ab9 100644 --- a/tests/cloud_tests/testcases/base.py +++ b/tests/cloud_tests/testcases/base.py @@ -1,61 +1,55 @@ # This file is part of cloud-init. See LICENSE file for license information. -from cloudinit import util as c_util +"""Base test case module.""" import crypt import json import unittest +from cloudinit import util as c_util + class CloudTestCase(unittest.TestCase): - """ - base test class for verifiers - """ + """Base test class for verifiers.""" + data = None conf = None _cloud_config = None def shortDescription(self): + """Prevent nose from using docstrings.""" return None @property def cloud_config(self): - """ - get the cloud-config used by the test - """ + """Get the cloud-config used by the test.""" if not self._cloud_config: self._cloud_config = c_util.load_yaml(self.conf) return self._cloud_config def get_config_entry(self, name): - """ - get a config entry from cloud-config ensuring that it is present - """ + """Get a config entry from cloud-config ensuring that it is present.""" if name not in self.cloud_config: raise AssertionError('Key "{}" not in cloud config'.format(name)) return self.cloud_config[name] def get_data_file(self, name): - """ - get data file failing test if it is not present - """ + """Get data file failing test if it is not present.""" if name not in self.data: raise AssertionError('File "{}" missing from collect data' .format(name)) return self.data[name] def get_instance_id(self): - """ - get recorded instance id - """ + """Get recorded instance id.""" return self.get_data_file('instance-id').strip() def get_status_data(self, data, version=None): - """ - parse result.json and status.json like data files - data: data to load - version: cloud-init output version, defaults to 'v1' - return_value: dict of data or None if missing + """Parse result.json and status.json like data files. + + @param data: data to load + @param version: cloud-init output version, defaults to 'v1' + @return_value: dict of data or None if missing """ if not version: version = 'v1' @@ -63,16 +57,12 @@ class CloudTestCase(unittest.TestCase): return data.get(version) def get_datasource(self): - """ - get datasource name - """ + """Get datasource name.""" data = self.get_status_data(self.get_data_file('result.json')) return data.get('datasource') def test_no_stages_errors(self): - """ - ensure that there were no errors in any stage - """ + """Ensure that there were no errors in any stage.""" status = self.get_status_data(self.get_data_file('status.json')) for stage in ('init', 'init-local', 'modules-config', 'modules-final'): self.assertIn(stage, status) @@ -84,7 +74,10 @@ class CloudTestCase(unittest.TestCase): class PasswordListTest(CloudTestCase): + """Base password test case class.""" + def test_shadow_passwords(self): + """Test shadow passwords.""" shadow = self.get_data_file('shadow') users = {} dupes = [] @@ -121,7 +114,7 @@ class PasswordListTest(CloudTestCase): self.assertNotEqual(users['harry'], users['dick']) def test_shadow_expected_users(self): - """Test every tom, dick, and harry user in shadow""" + """Test every tom, dick, and harry user in shadow.""" out = self.get_data_file('shadow') self.assertIn('tom:', out) self.assertIn('dick:', out) @@ -130,7 +123,7 @@ class PasswordListTest(CloudTestCase): self.assertIn('mikey:', out) def test_sshd_config(self): - """Test sshd config allows passwords""" + """Test sshd config allows passwords.""" out = self.get_data_file('sshd_config') self.assertIn('PasswordAuthentication yes', out) diff --git a/tests/cloud_tests/testcases/bugs/__init__.py b/tests/cloud_tests/testcases/bugs/__init__.py index 5251d7c1..c6452f9c 100644 --- a/tests/cloud_tests/testcases/bugs/__init__.py +++ b/tests/cloud_tests/testcases/bugs/__init__.py @@ -1,7 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. -""" -Test verifiers for cloud-init bugs +"""Test verifiers for cloud-init bugs. + See configs/bugs/README.md for more information """ diff --git a/tests/cloud_tests/testcases/bugs/lp1511485.py b/tests/cloud_tests/testcases/bugs/lp1511485.py index ac5ccb42..670d3aff 100644 --- a/tests/cloud_tests/testcases/bugs/lp1511485.py +++ b/tests/cloud_tests/testcases/bugs/lp1511485.py @@ -1,14 +1,14 @@ # 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 class TestLP1511485(base.CloudTestCase): - """Test LP# 1511485""" + """Test LP# 1511485.""" def test_final_message(self): - """Test final message exists""" + """Test final message exists.""" out = self.get_data_file('cloud-init-output.log') self.assertIn('Final message from cloud-config', out) diff --git a/tests/cloud_tests/testcases/bugs/lp1628337.py b/tests/cloud_tests/testcases/bugs/lp1628337.py index af0ffc75..a2c90481 100644 --- a/tests/cloud_tests/testcases/bugs/lp1628337.py +++ b/tests/cloud_tests/testcases/bugs/lp1628337.py @@ -1,14 +1,14 @@ # 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 class TestLP1628337(base.CloudTestCase): - """Test LP# 1511485""" + """Test LP# 1511485.""" def test_fetch_indices(self): - """Verify no apt errors""" + """Verify no apt errors.""" out = self.get_data_file('cloud-init-output.log') self.assertNotIn('W: Failed to fetch', out) self.assertNotIn('W: Some index files failed to download. ' @@ -16,7 +16,7 @@ class TestLP1628337(base.CloudTestCase): out) def test_ntp(self): - """Verify can find ntp and install it""" + """Verify can find ntp and install it.""" out = self.get_data_file('cloud-init-output.log') self.assertNotIn('E: Unable to locate package ntp', out) diff --git a/tests/cloud_tests/testcases/examples/__init__.py b/tests/cloud_tests/testcases/examples/__init__.py index b3af7f8a..39af88c2 100644 --- a/tests/cloud_tests/testcases/examples/__init__.py +++ b/tests/cloud_tests/testcases/examples/__init__.py @@ -1,7 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. -""" -Test verifiers for cloud-init examples +"""Test verifiers for cloud-init examples. + See configs/examples/README.md for more information """ diff --git a/tests/cloud_tests/testcases/examples/add_apt_repositories.py b/tests/cloud_tests/testcases/examples/add_apt_repositories.py index 15b8f01c..71eede97 100644 --- a/tests/cloud_tests/testcases/examples/add_apt_repositories.py +++ b/tests/cloud_tests/testcases/examples/add_apt_repositories.py @@ -1,19 +1,19 @@ # 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 class TestAptconfigurePrimary(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_ubuntu_sources(self): - """Test no default Ubuntu entries exist""" + """Test no default Ubuntu entries exist.""" out = self.get_data_file('ubuntu.sources.list') self.assertEqual(0, int(out)) def test_gatech_sources(self): - """Test GaTech entires exist""" + """Test GaTech entires exist.""" out = self.get_data_file('gatech.sources.list') self.assertEqual(20, int(out)) diff --git a/tests/cloud_tests/testcases/examples/alter_completion_message.py b/tests/cloud_tests/testcases/examples/alter_completion_message.py index b06ad01b..b7b5d5e0 100644 --- a/tests/cloud_tests/testcases/examples/alter_completion_message.py +++ b/tests/cloud_tests/testcases/examples/alter_completion_message.py @@ -1,34 +1,27 @@ # 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 class TestFinalMessage(base.CloudTestCase): - """ - test cloud init module `cc_final_message` - """ + """Test cloud init module `cc_final_message`.""" + subs_char = '$' def get_final_message_config(self): - """ - get config for final message - """ + """Get config for final message.""" self.assertIn('final_message', self.cloud_config) return self.cloud_config['final_message'] def get_final_message(self): - """ - get final message from log - """ + """Get final message from log.""" out = self.get_data_file('cloud-init-output.log') lines = len(self.get_final_message_config().splitlines()) return '\n'.join(out.splitlines()[-1 * lines:]) def test_final_message_string(self): - """ - ensure final handles regular strings - """ + """Ensure final handles regular strings.""" for actual, config in zip( self.get_final_message().splitlines(), self.get_final_message_config().splitlines()): @@ -36,9 +29,7 @@ class TestFinalMessage(base.CloudTestCase): self.assertEqual(actual, config) def test_final_message_subs(self): - """ - test variable substitution in final message - """ + """Test variable substitution in final message.""" # TODO: add verification of other substitutions patterns = {'$datasource': self.get_datasource()} for key, expected in patterns.items(): diff --git a/tests/cloud_tests/testcases/examples/configure_instance_trusted_ca_certificates.py b/tests/cloud_tests/testcases/examples/configure_instance_trusted_ca_certificates.py index 8a4a0db0..38540eb8 100644 --- a/tests/cloud_tests/testcases/examples/configure_instance_trusted_ca_certificates.py +++ b/tests/cloud_tests/testcases/examples/configure_instance_trusted_ca_certificates.py @@ -1,24 +1,24 @@ # 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 class TestTrustedCA(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_cert_count_ca(self): - """Test correct count of CAs in .crt""" + """Test correct count of CAs in .crt.""" out = self.get_data_file('cert_count_ca') self.assertIn('7 /etc/ssl/certs/ca-certificates.crt', out) def test_cert_count_cloudinit(self): - """Test correct count of CAs in .pem""" + """Test correct count of CAs in .pem.""" out = self.get_data_file('cert_count_cloudinit') self.assertIn('7 /etc/ssl/certs/cloud-init-ca-certs.pem', out) def test_cloudinit_certs(self): - """Test text of cert""" + """Test text of cert.""" out = self.get_data_file('cloudinit_certs') self.assertIn('-----BEGIN CERTIFICATE-----', out) self.assertIn('YOUR-ORGS-TRUSTED-CA-CERT-HERE', out) diff --git a/tests/cloud_tests/testcases/examples/configure_instances_ssh_keys.py b/tests/cloud_tests/testcases/examples/configure_instances_ssh_keys.py index 4f651703..691a316b 100644 --- a/tests/cloud_tests/testcases/examples/configure_instances_ssh_keys.py +++ b/tests/cloud_tests/testcases/examples/configure_instances_ssh_keys.py @@ -1,29 +1,29 @@ # 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 class TestSSHKeys(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_cert_count(self): - """Test cert count""" + """Test cert count.""" out = self.get_data_file('cert_count') self.assertEqual(20, int(out)) def test_dsa_public(self): - """Test DSA key has ending""" + """Test DSA key has ending.""" out = self.get_data_file('dsa_public') self.assertIn('ZN4XnifuO5krqAybngIy66PMEoQ= smoser@localhost', out) def test_rsa_public(self): - """Test RSA key has specific ending""" + """Test RSA key has specific ending.""" out = self.get_data_file('rsa_public') self.assertIn('PemAWthxHO18QJvWPocKJtlsDNi3 smoser@localhost', out) def test_auth_keys(self): - """Test authorized keys has specific ending""" + """Test authorized keys has specific ending.""" out = self.get_data_file('auth_keys') self.assertIn('QPOt5Q8zWd9qG7PBl9+eiH5qV7NZ mykey@host', out) self.assertIn('Hj29SCmXp5Kt5/82cD/VN3NtHw== smoser@brickies', out) diff --git a/tests/cloud_tests/testcases/examples/including_user_groups.py b/tests/cloud_tests/testcases/examples/including_user_groups.py index e5732322..67af527b 100644 --- a/tests/cloud_tests/testcases/examples/including_user_groups.py +++ b/tests/cloud_tests/testcases/examples/including_user_groups.py @@ -1,42 +1,42 @@ # 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 class TestUserGroups(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_group_ubuntu(self): - """Test ubuntu group exists""" + """Test ubuntu group exists.""" out = self.get_data_file('group_ubuntu') self.assertRegex(out, r'ubuntu:x:[0-9]{4}:') def test_group_cloud_users(self): - """Test cloud users group exists""" + """Test cloud users group exists.""" out = self.get_data_file('group_cloud_users') self.assertRegex(out, r'cloud-users:x:[0-9]{4}:barfoo') def test_user_ubuntu(self): - """Test ubuntu user exists""" + """Test ubuntu user exists.""" out = self.get_data_file('user_ubuntu') self.assertRegex( out, r'ubuntu:x:[0-9]{4}:[0-9]{4}:Ubuntu:/home/ubuntu:/bin/bash') def test_user_foobar(self): - """Test foobar user exists""" + """Test foobar user exists.""" out = self.get_data_file('user_foobar') self.assertRegex( out, r'foobar:x:[0-9]{4}:[0-9]{4}:Foo B. Bar:/home/foobar:') def test_user_barfoo(self): - """Test barfoo user exists""" + """Test barfoo user exists.""" out = self.get_data_file('user_barfoo') self.assertRegex( out, r'barfoo:x:[0-9]{4}:[0-9]{4}:Bar B. Foo:/home/barfoo:') def test_user_cloudy(self): - """Test cloudy user exists""" + """Test cloudy user exists.""" out = self.get_data_file('user_cloudy') self.assertRegex(out, r'cloudy:x:[0-9]{3,4}:') diff --git a/tests/cloud_tests/testcases/examples/install_arbitrary_packages.py b/tests/cloud_tests/testcases/examples/install_arbitrary_packages.py index 660d1aa3..df133844 100644 --- a/tests/cloud_tests/testcases/examples/install_arbitrary_packages.py +++ b/tests/cloud_tests/testcases/examples/install_arbitrary_packages.py @@ -1,19 +1,19 @@ # 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 class TestInstall(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_htop(self): - """Verify htop installed""" + """Verify htop installed.""" out = self.get_data_file('htop') self.assertEqual(1, int(out)) def test_tree(self): - """Verify tree installed""" + """Verify tree installed.""" out = self.get_data_file('treeutils') self.assertEqual(1, int(out)) diff --git a/tests/cloud_tests/testcases/examples/install_run_chef_recipes.py b/tests/cloud_tests/testcases/examples/install_run_chef_recipes.py index b36486f0..4ec26b8f 100644 --- a/tests/cloud_tests/testcases/examples/install_run_chef_recipes.py +++ b/tests/cloud_tests/testcases/examples/install_run_chef_recipes.py @@ -1,14 +1,14 @@ # 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 class TestChefExample(base.CloudTestCase): - """Test chef module""" + """Test chef module.""" def test_chef_basic(self): - """Test chef installed""" + """Test chef installed.""" out = self.get_data_file('chef_installed') self.assertIn('install ok', out) diff --git a/tests/cloud_tests/testcases/examples/run_apt_upgrade.py b/tests/cloud_tests/testcases/examples/run_apt_upgrade.py index 4c04d315..744e49cb 100644 --- a/tests/cloud_tests/testcases/examples/run_apt_upgrade.py +++ b/tests/cloud_tests/testcases/examples/run_apt_upgrade.py @@ -1,14 +1,14 @@ # 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 class TestUpgrade(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_upgrade(self): - """Test upgrade exists in apt history""" + """Test upgrade exists in apt history.""" out = self.get_data_file('cloud-init.log') self.assertIn( '[CLOUDINIT] util.py[DEBUG]: apt-upgrade ' diff --git a/tests/cloud_tests/testcases/examples/run_commands.py b/tests/cloud_tests/testcases/examples/run_commands.py index 0be21d0f..01d5d4fc 100644 --- a/tests/cloud_tests/testcases/examples/run_commands.py +++ b/tests/cloud_tests/testcases/examples/run_commands.py @@ -1,14 +1,14 @@ # 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 class TestRunCmd(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_run_cmd(self): - """Test run command worked""" + """Test run command worked.""" out = self.get_data_file('run_cmd') self.assertIn('cloud-init run cmd test', out) diff --git a/tests/cloud_tests/testcases/examples/run_commands_first_boot.py b/tests/cloud_tests/testcases/examples/run_commands_first_boot.py index baa23130..3f3d8f84 100644 --- a/tests/cloud_tests/testcases/examples/run_commands_first_boot.py +++ b/tests/cloud_tests/testcases/examples/run_commands_first_boot.py @@ -1,14 +1,14 @@ # 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 class TestBootCmd(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_bootcmd_host(self): - """Test boot command worked""" + """Test boot command worked.""" out = self.get_data_file('hosts') self.assertIn('192.168.1.130 us.archive.ubuntu.com', out) diff --git a/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.py b/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.py index 97dfeec3..7bd520f6 100644 --- a/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.py +++ b/tests/cloud_tests/testcases/examples/writing_out_arbitrary_files.py @@ -1,29 +1,29 @@ # 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 class TestWriteFiles(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_b64(self): - """Test b64 encoded file reads as ascii""" + """Test b64 encoded file reads as ascii.""" out = self.get_data_file('file_b64') self.assertIn('ASCII text', out) def test_binary(self): - """Test binary file reads as executable""" + """Test binary file reads as executable.""" out = self.get_data_file('file_binary') self.assertIn('ELF 64-bit LSB executable, x86-64, version 1', out) def test_gzip(self): - """Test gzip file shows up as a shell script""" + """Test gzip file shows up as a shell script.""" out = self.get_data_file('file_gzip') self.assertIn('POSIX shell script, ASCII text executable', out) def test_text(self): - """Test text shows up as ASCII text""" + """Test text shows up as ASCII text.""" out = self.get_data_file('file_text') self.assertIn('ASCII text', out) diff --git a/tests/cloud_tests/testcases/main/__init__.py b/tests/cloud_tests/testcases/main/__init__.py index 5888990d..0a592637 100644 --- a/tests/cloud_tests/testcases/main/__init__.py +++ b/tests/cloud_tests/testcases/main/__init__.py @@ -1,7 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. -""" -Test verifiers for cloud-init main features +"""Test verifiers for cloud-init main features. + See configs/main/README.md for more information """ diff --git a/tests/cloud_tests/testcases/main/command_output_simple.py b/tests/cloud_tests/testcases/main/command_output_simple.py index c0461a08..fe4c7670 100644 --- a/tests/cloud_tests/testcases/main/command_output_simple.py +++ b/tests/cloud_tests/testcases/main/command_output_simple.py @@ -1,17 +1,14 @@ # This file is part of cloud-init. See LICENSE file for license information. +"""cloud-init Integration Test Verify Script.""" from tests.cloud_tests.testcases import base class TestCommandOutputSimple(base.CloudTestCase): - """ - test functionality of simple output redirection - """ + """Test functionality of simple output redirection.""" def test_output_file(self): - """ - ensure that the output file is not empty and has all stages - """ + """Ensure that the output file is not empty and has all stages.""" data = self.get_data_file('cloud-init-test-output') self.assertNotEqual(len(data), 0, "specified log empty") self.assertEqual(self.get_config_entry('final_message'), diff --git a/tests/cloud_tests/testcases/modules/__init__.py b/tests/cloud_tests/testcases/modules/__init__.py index 9560fb26..6ab8114d 100644 --- a/tests/cloud_tests/testcases/modules/__init__.py +++ b/tests/cloud_tests/testcases/modules/__init__.py @@ -1,7 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. -""" -Test verifiers for cloud-init cc modules +"""Test verifiers for cloud-init cc modules. + See configs/modules/README.md for more information """ diff --git a/tests/cloud_tests/testcases/modules/apt_configure_conf.py b/tests/cloud_tests/testcases/modules/apt_configure_conf.py index 5d96d95c..3bf93447 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_conf.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_conf.py @@ -1,19 +1,19 @@ # 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 class TestAptconfigureConf(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_apt_conf_assumeyes(self): - """Test config assumes true""" + """Test config assumes true.""" out = self.get_data_file('94cloud-init-config') self.assertIn('Assume-Yes "true";', out) def test_apt_conf_fixbroken(self): - """Test config fixes broken""" + """Test config fixes broken.""" out = self.get_data_file('94cloud-init-config') self.assertIn('Fix-Broken "true";', out) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_disable_suites.py b/tests/cloud_tests/testcases/modules/apt_configure_disable_suites.py index 0e2dfdeb..eabe4607 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_disable_suites.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_disable_suites.py @@ -1,14 +1,14 @@ # 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 class TestAptconfigureDisableSuites(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_empty_sourcelist(self): - """Test source list is empty""" + """Test source list is empty.""" out = self.get_data_file('sources.list') self.assertEqual('', out) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_primary.py b/tests/cloud_tests/testcases/modules/apt_configure_primary.py index 2918785d..c1c4bbc0 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_primary.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_primary.py @@ -1,19 +1,19 @@ # 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 class TestAptconfigurePrimary(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_ubuntu_sources(self): - """Test no default Ubuntu entries exist""" + """Test no default Ubuntu entries exist.""" out = self.get_data_file('ubuntu.sources.list') self.assertEqual(0, int(out)) def test_gatech_sources(self): - """Test GaTech entires exist""" + """Test GaTech entires exist.""" out = self.get_data_file('gatech.sources.list') self.assertEqual(20, int(out)) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_proxy.py b/tests/cloud_tests/testcases/modules/apt_configure_proxy.py index 93ae64c6..0c61b6cc 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_proxy.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_proxy.py @@ -1,14 +1,14 @@ # 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 class TestAptconfigureProxy(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_proxy_config(self): - """Test proxy options added to apt config""" + """Test proxy options added to apt config.""" out = self.get_data_file('90cloud-init-aptproxy') self.assertIn( 'Acquire::http::Proxy "http://squid.internal:3128";', out) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_security.py b/tests/cloud_tests/testcases/modules/apt_configure_security.py index 19c79c64..7d7e2585 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_security.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_security.py @@ -1,14 +1,14 @@ # 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 class TestAptconfigureSecurity(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_security_mirror(self): - """Test security lines added and uncommented in source.list""" + """Test security lines added and uncommented in source.list.""" out = self.get_data_file('sources.list') self.assertEqual(6, int(out)) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_sources_key.py b/tests/cloud_tests/testcases/modules/apt_configure_sources_key.py index d2ee2611..d9061f3c 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_sources_key.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_sources_key.py @@ -1,21 +1,21 @@ # 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 class TestAptconfigureSourcesKey(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_apt_key_list(self): - """Test key list updated""" + """Test key list updated.""" out = self.get_data_file('apt_key_list') self.assertIn( '1FF0 D853 5EF7 E719 E5C8 1B9C 083D 06FB E4D3 04DF', out) self.assertIn('Launchpad PPA for cloud init development team', out) def test_source_list(self): - """Test source.list updated""" + """Test source.list updated.""" out = self.get_data_file('sources.list') self.assertIn( 'http://ppa.launchpad.net/cloud-init-dev/test-archive/ubuntu', out) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_sources_keyserver.py b/tests/cloud_tests/testcases/modules/apt_configure_sources_keyserver.py index 3931a92c..2e6b293f 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_sources_keyserver.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_sources_keyserver.py @@ -1,21 +1,21 @@ # 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 class TestAptconfigureSourcesKeyserver(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_apt_key_list(self): - """Test specific key added""" + """Test specific key added.""" out = self.get_data_file('apt_key_list') self.assertIn( '1BC3 0F71 5A3B 8612 47A8 1A5E 55FE 7C8C 0165 013E', out) self.assertIn('Launchpad PPA for curtin developers', out) def test_source_list(self): - """Test source.list updated""" + """Test source.list updated.""" out = self.get_data_file('sources.list') self.assertIn( 'http://ppa.launchpad.net/cloud-init-dev/test-archive/ubuntu', out) diff --git a/tests/cloud_tests/testcases/modules/apt_configure_sources_list.py b/tests/cloud_tests/testcases/modules/apt_configure_sources_list.py index a0bb5e6b..129d2264 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_sources_list.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_sources_list.py @@ -1,14 +1,14 @@ # 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 class TestAptconfigureSourcesList(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_sources_list(self): - """Test sources.list includes sources""" + """Test sources.list includes sources.""" out = self.get_data_file('sources.list') self.assertRegex(out, r'deb http:\/\/archive.ubuntu.com\/ubuntu ' '[a-z].* main restricted') diff --git a/tests/cloud_tests/testcases/modules/apt_configure_sources_ppa.py b/tests/cloud_tests/testcases/modules/apt_configure_sources_ppa.py index dcdb3767..d299e9ad 100644 --- a/tests/cloud_tests/testcases/modules/apt_configure_sources_ppa.py +++ b/tests/cloud_tests/testcases/modules/apt_configure_sources_ppa.py @@ -1,20 +1,20 @@ # 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 class TestAptconfigureSourcesPPA(base.CloudTestCase): - """Test apt-configure module""" + """Test apt-configure module.""" def test_ppa(self): - """test specific ppa added""" + """Test specific ppa added.""" out = self.get_data_file('sources.list') self.assertIn( 'http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu', out) def test_ppa_key(self): - """test ppa key added""" + """Test ppa key added.""" out = self.get_data_file('apt-key') self.assertIn( '1BC3 0F71 5A3B 8612 47A8 1A5E 55FE 7C8C 0165 013E', out) diff --git a/tests/cloud_tests/testcases/modules/apt_pipelining_disable.py b/tests/cloud_tests/testcases/modules/apt_pipelining_disable.py index 446c597d..c98eedef 100644 --- a/tests/cloud_tests/testcases/modules/apt_pipelining_disable.py +++ b/tests/cloud_tests/testcases/modules/apt_pipelining_disable.py @@ -1,14 +1,14 @@ # 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 class TestAptPipeliningDisable(base.CloudTestCase): - """Test apt-pipelining module""" + """Test apt-pipelining module.""" def test_disable_pipelining(self): - """Test pipelining disabled""" + """Test pipelining disabled.""" out = self.get_data_file('90cloud-init-pipelining') self.assertIn('Acquire::http::Pipeline-Depth "0";', out) diff --git a/tests/cloud_tests/testcases/modules/apt_pipelining_os.py b/tests/cloud_tests/testcases/modules/apt_pipelining_os.py index ad2a8884..740dc7c0 100644 --- a/tests/cloud_tests/testcases/modules/apt_pipelining_os.py +++ b/tests/cloud_tests/testcases/modules/apt_pipelining_os.py @@ -1,14 +1,14 @@ # 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 class TestAptPipeliningOS(base.CloudTestCase): - """Test apt-pipelining module""" + """Test apt-pipelining module.""" def test_os_pipelining(self): - """Test pipelining set to os""" + """Test pipelining set to os.""" out = self.get_data_file('90cloud-init-pipelining') self.assertIn('Acquire::http::Pipeline-Depth "0";', out) diff --git a/tests/cloud_tests/testcases/modules/bootcmd.py b/tests/cloud_tests/testcases/modules/bootcmd.py index 47a51e0a..f5b86b03 100644 --- a/tests/cloud_tests/testcases/modules/bootcmd.py +++ b/tests/cloud_tests/testcases/modules/bootcmd.py @@ -1,14 +1,14 @@ # 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 class TestBootCmd(base.CloudTestCase): - """Test bootcmd module""" + """Test bootcmd module.""" def test_bootcmd_host(self): - """Test boot cmd worked""" + """Test boot cmd worked.""" out = self.get_data_file('hosts') self.assertIn('192.168.1.130 us.archive.ubuntu.com', out) diff --git a/tests/cloud_tests/testcases/modules/byobu.py b/tests/cloud_tests/testcases/modules/byobu.py index 204b37b9..005ca014 100644 --- a/tests/cloud_tests/testcases/modules/byobu.py +++ b/tests/cloud_tests/testcases/modules/byobu.py @@ -1,24 +1,24 @@ # 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 class TestByobu(base.CloudTestCase): - """Test Byobu module""" + """Test Byobu module.""" def test_byobu_installed(self): - """Test byobu installed""" + """Test byobu installed.""" out = self.get_data_file('byobu_installed') self.assertIn('/usr/bin/byobu', out) def test_byobu_profile_enabled(self): - """Test byobu profile.d file exists""" + """Test byobu profile.d file exists.""" out = self.get_data_file('byobu_profile_enabled') self.assertIn('/etc/profile.d/Z97-byobu.sh', out) def test_byobu_launch_exists(self): - """Test byobu-launch exists""" + """Test byobu-launch exists.""" out = self.get_data_file('byobu_launch_exists') self.assertIn('/usr/bin/byobu-launch', out) diff --git a/tests/cloud_tests/testcases/modules/ca_certs.py b/tests/cloud_tests/testcases/modules/ca_certs.py index 7448e480..e75f0413 100644 --- a/tests/cloud_tests/testcases/modules/ca_certs.py +++ b/tests/cloud_tests/testcases/modules/ca_certs.py @@ -1,19 +1,19 @@ # 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 class TestCaCerts(base.CloudTestCase): - """Test ca certs module""" + """Test ca certs module.""" def test_cert_count(self): - """Test the count is proper""" + """Test the count is proper.""" out = self.get_data_file('cert_count') self.assertEqual(5, int(out)) def test_cert_installed(self): - """Test line from our cert exists""" + """Test line from our cert exists.""" out = self.get_data_file('cert') self.assertIn('a36c744454555024e7f82edc420fd2c8', out) diff --git a/tests/cloud_tests/testcases/modules/debug_disable.py b/tests/cloud_tests/testcases/modules/debug_disable.py index 9899fdfe..e40e4b89 100644 --- a/tests/cloud_tests/testcases/modules/debug_disable.py +++ b/tests/cloud_tests/testcases/modules/debug_disable.py @@ -1,14 +1,14 @@ # 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 class TestDebugDisable(base.CloudTestCase): - """Disable debug messages""" + """Disable debug messages.""" def test_debug_disable(self): - """Test verbose output missing from logs""" + """Test verbose output missing from logs.""" out = self.get_data_file('cloud-init.log') self.assertNotIn( out, r'Skipping module named [a-z].* verbose printing disabled') diff --git a/tests/cloud_tests/testcases/modules/debug_enable.py b/tests/cloud_tests/testcases/modules/debug_enable.py index 21c89524..28d26062 100644 --- a/tests/cloud_tests/testcases/modules/debug_enable.py +++ b/tests/cloud_tests/testcases/modules/debug_enable.py @@ -1,14 +1,14 @@ # 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 class TestDebugEnable(base.CloudTestCase): - """Test debug messages""" + """Test debug messages.""" def test_debug_enable(self): - """Test debug messages in cloud-init log""" + """Test debug messages in cloud-init log.""" out = self.get_data_file('cloud-init.log') self.assertIn('[DEBUG]', out) diff --git a/tests/cloud_tests/testcases/modules/final_message.py b/tests/cloud_tests/testcases/modules/final_message.py index b06ad01b..b7b5d5e0 100644 --- a/tests/cloud_tests/testcases/modules/final_message.py +++ b/tests/cloud_tests/testcases/modules/final_message.py @@ -1,34 +1,27 @@ # 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 class TestFinalMessage(base.CloudTestCase): - """ - test cloud init module `cc_final_message` - """ + """Test cloud init module `cc_final_message`.""" + subs_char = '$' def get_final_message_config(self): - """ - get config for final message - """ + """Get config for final message.""" self.assertIn('final_message', self.cloud_config) return self.cloud_config['final_message'] def get_final_message(self): - """ - get final message from log - """ + """Get final message from log.""" out = self.get_data_file('cloud-init-output.log') lines = len(self.get_final_message_config().splitlines()) return '\n'.join(out.splitlines()[-1 * lines:]) def test_final_message_string(self): - """ - ensure final handles regular strings - """ + """Ensure final handles regular strings.""" for actual, config in zip( self.get_final_message().splitlines(), self.get_final_message_config().splitlines()): @@ -36,9 +29,7 @@ class TestFinalMessage(base.CloudTestCase): self.assertEqual(actual, config) def test_final_message_subs(self): - """ - test variable substitution in final message - """ + """Test variable substitution in final message.""" # TODO: add verification of other substitutions patterns = {'$datasource': self.get_datasource()} for key, expected in patterns.items(): diff --git a/tests/cloud_tests/testcases/modules/keys_to_console.py b/tests/cloud_tests/testcases/modules/keys_to_console.py index b36c96cf..88b6812e 100644 --- a/tests/cloud_tests/testcases/modules/keys_to_console.py +++ b/tests/cloud_tests/testcases/modules/keys_to_console.py @@ -1,20 +1,20 @@ # 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 class TestKeysToConsole(base.CloudTestCase): - """Test proper keys are included and excluded to console""" + """Test proper keys are included and excluded to console.""" def test_excluded_keys(self): - """Test excluded keys missing""" + """Test excluded keys missing.""" out = self.get_data_file('syslog') self.assertNotIn('DSA', out) self.assertNotIn('ECDSA', out) def test_expected_keys(self): - """Test expected keys exist""" + """Test expected keys exist.""" out = self.get_data_file('syslog') self.assertIn('ED25519', out) self.assertIn('RSA', out) diff --git a/tests/cloud_tests/testcases/modules/locale.py b/tests/cloud_tests/testcases/modules/locale.py index bf4e1b07..63e53ff3 100644 --- a/tests/cloud_tests/testcases/modules/locale.py +++ b/tests/cloud_tests/testcases/modules/locale.py @@ -1,19 +1,19 @@ # 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 class TestLocale(base.CloudTestCase): - """Test locale is set properly""" + """Test locale is set properly.""" def test_locale(self): - """Test locale is set properly""" + """Test locale is set properly.""" out = self.get_data_file('locale_default') self.assertIn('LANG="en_GB.UTF-8"', out) def test_locale_a(self): - """Test locale -a has both options""" + """Test locale -a has both options.""" out = self.get_data_file('locale_a') self.assertIn('en_GB.utf8', out) self.assertIn('en_US.utf8', out) diff --git a/tests/cloud_tests/testcases/modules/lxd_bridge.py b/tests/cloud_tests/testcases/modules/lxd_bridge.py index 4087e2f2..c0262ba3 100644 --- a/tests/cloud_tests/testcases/modules/lxd_bridge.py +++ b/tests/cloud_tests/testcases/modules/lxd_bridge.py @@ -1,24 +1,24 @@ # 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 class TestLxdBridge(base.CloudTestCase): - """Test LXD module""" + """Test LXD module.""" def test_lxd(self): - """Test lxd installed""" + """Test lxd installed.""" out = self.get_data_file('lxd') self.assertIn('/usr/bin/lxd', out) def test_lxc(self): - """Test lxc installed""" + """Test lxc installed.""" out = self.get_data_file('lxc') self.assertIn('/usr/bin/lxc', out) def test_bridge(self): - """Test bridge config""" + """Test bridge config.""" out = self.get_data_file('lxc-bridge') self.assertIn('lxdbr0', out) self.assertIn('10.100.100.1/24', out) diff --git a/tests/cloud_tests/testcases/modules/lxd_dir.py b/tests/cloud_tests/testcases/modules/lxd_dir.py index 51a9a1f1..1495674e 100644 --- a/tests/cloud_tests/testcases/modules/lxd_dir.py +++ b/tests/cloud_tests/testcases/modules/lxd_dir.py @@ -1,19 +1,19 @@ # 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 class TestLxdDir(base.CloudTestCase): - """Test LXD module""" + """Test LXD module.""" def test_lxd(self): - """Test lxd installed""" + """Test lxd installed.""" out = self.get_data_file('lxd') self.assertIn('/usr/bin/lxd', out) def test_lxc(self): - """Test lxc installed""" + """Test lxc installed.""" out = self.get_data_file('lxc') self.assertIn('/usr/bin/lxc', out) 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 diff --git a/tests/cloud_tests/testcases/modules/ntp_pools.py b/tests/cloud_tests/testcases/modules/ntp_pools.py index ff6d8fa4..336076df 100644 --- a/tests/cloud_tests/testcases/modules/ntp_pools.py +++ b/tests/cloud_tests/testcases/modules/ntp_pools.py @@ -1,11 +1,11 @@ # 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 class TestNtpPools(base.CloudTestCase): - """Test ntp module""" + """Test ntp module.""" def test_ntp_installed(self): """Test ntp installed""" diff --git a/tests/cloud_tests/testcases/modules/package_update_upgrade_install.py b/tests/cloud_tests/testcases/modules/package_update_upgrade_install.py index 00353ead..a92dec22 100644 --- a/tests/cloud_tests/testcases/modules/package_update_upgrade_install.py +++ b/tests/cloud_tests/testcases/modules/package_update_upgrade_install.py @@ -1,24 +1,24 @@ # 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 class TestPackageInstallUpdateUpgrade(base.CloudTestCase): - """Test package install update upgrade module""" + """Test package install update upgrade module.""" def test_installed_htop(self): - """Test htop got installed""" + """Test htop got installed.""" out = self.get_data_file('dpkg_htop') self.assertEqual(1, int(out)) def test_installed_tree(self): - """Test tree got installed""" + """Test tree got installed.""" out = self.get_data_file('dpkg_tree') self.assertEqual(1, int(out)) def test_apt_history(self): - """Test apt history for update command""" + """Test apt history for update command.""" out = self.get_data_file('apt_history_cmdline') self.assertIn( 'Commandline: /usr/bin/apt-get --option=Dpkg::Options' @@ -26,7 +26,7 @@ class TestPackageInstallUpdateUpgrade(base.CloudTestCase): '--assume-yes --quiet install htop tree', out) def test_cloud_init_output(self): - """Test cloud-init-output for install & upgrade stuff""" + """Test cloud-init-output for install & upgrade stuff.""" out = self.get_data_file('cloud-init-output.log') self.assertIn('Setting up tree (', out) self.assertIn('Setting up htop (', out) diff --git a/tests/cloud_tests/testcases/modules/runcmd.py b/tests/cloud_tests/testcases/modules/runcmd.py index 780cd186..9fce3062 100644 --- a/tests/cloud_tests/testcases/modules/runcmd.py +++ b/tests/cloud_tests/testcases/modules/runcmd.py @@ -1,14 +1,14 @@ # 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 class TestRunCmd(base.CloudTestCase): - """Test runcmd module""" + """Test runcmd module.""" def test_run_cmd(self): - """Test run command worked""" + """Test run command worked.""" out = self.get_data_file('run_cmd') self.assertIn('cloud-init run cmd test', out) diff --git a/tests/cloud_tests/testcases/modules/salt_minion.py b/tests/cloud_tests/testcases/modules/salt_minion.py index 3ef30f7e..c697db2d 100644 --- a/tests/cloud_tests/testcases/modules/salt_minion.py +++ b/tests/cloud_tests/testcases/modules/salt_minion.py @@ -1,26 +1,26 @@ # 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 class Test(base.CloudTestCase): - """Test salt minion module""" + """Test salt minion module.""" def test_minon_master(self): - """Test master value in config""" + """Test master value in config.""" out = self.get_data_file('minion') self.assertIn('master: salt.mydomain.com', out) def test_minion_pem(self): - """Test private key""" + """Test private key.""" out = self.get_data_file('minion.pem') self.assertIn('------BEGIN PRIVATE KEY------', out) self.assertIn('<key data>', out) self.assertIn('------END PRIVATE KEY-------', out) def test_minion_pub(self): - """Test public key""" + """Test public key.""" out = self.get_data_file('minion.pub') self.assertIn('------BEGIN PUBLIC KEY-------', out) self.assertIn('<key data>', out) diff --git a/tests/cloud_tests/testcases/modules/seed_random_data.py b/tests/cloud_tests/testcases/modules/seed_random_data.py index b2121569..db433d26 100644 --- a/tests/cloud_tests/testcases/modules/seed_random_data.py +++ b/tests/cloud_tests/testcases/modules/seed_random_data.py @@ -1,14 +1,14 @@ # 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 class TestSeedRandom(base.CloudTestCase): - """Test seed random module""" + """Test seed random module.""" def test_random_seed_data(self): - """Test random data passed in exists""" + """Test random data passed in exists.""" out = self.get_data_file('seed_data') self.assertIn('MYUb34023nD:LFDK10913jk;dfnk:Df', out) diff --git a/tests/cloud_tests/testcases/modules/set_hostname.py b/tests/cloud_tests/testcases/modules/set_hostname.py index 9501b069..6e96a75c 100644 --- a/tests/cloud_tests/testcases/modules/set_hostname.py +++ b/tests/cloud_tests/testcases/modules/set_hostname.py @@ -1,14 +1,14 @@ # 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 class TestHostname(base.CloudTestCase): - """Test hostname module""" + """Test hostname module.""" def test_hostname(self): - """Test hostname command shows correct output""" + """Test hostname command shows correct output.""" out = self.get_data_file('hostname') self.assertIn('myhostname', out) diff --git a/tests/cloud_tests/testcases/modules/set_hostname_fqdn.py b/tests/cloud_tests/testcases/modules/set_hostname_fqdn.py index d89c299d..398f3d40 100644 --- a/tests/cloud_tests/testcases/modules/set_hostname_fqdn.py +++ b/tests/cloud_tests/testcases/modules/set_hostname_fqdn.py @@ -1,24 +1,24 @@ # 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 class TestHostnameFqdn(base.CloudTestCase): - """Test Hostname module""" + """Test Hostname module.""" def test_hostname(self): - """Test hostname output""" + """Test hostname output.""" out = self.get_data_file('hostname') self.assertIn('myhostname', out) def test_hostname_fqdn(self): - """Test hostname fqdn output""" + """Test hostname fqdn output.""" out = self.get_data_file('fqdn') self.assertIn('host.myorg.com', out) def test_hosts(self): - """Test /etc/hosts file""" + """Test /etc/hosts file.""" out = self.get_data_file('hosts') self.assertIn('127.0.1.1 host.myorg.com myhostname', out) self.assertIn('127.0.0.1 localhost', out) diff --git a/tests/cloud_tests/testcases/modules/set_password.py b/tests/cloud_tests/testcases/modules/set_password.py index 1411a296..a29b2261 100644 --- a/tests/cloud_tests/testcases/modules/set_password.py +++ b/tests/cloud_tests/testcases/modules/set_password.py @@ -1,21 +1,21 @@ # 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 class TestPassword(base.CloudTestCase): - """Test password module""" + """Test password module.""" # TODO add test to make sure password is actually "password" def test_shadow(self): - """Test ubuntu user in shadow""" + """Test ubuntu user in shadow.""" out = self.get_data_file('shadow') self.assertIn('ubuntu:', out) def test_sshd_config(self): - """Test sshd config allows passwords""" + """Test sshd config allows passwords.""" out = self.get_data_file('sshd_config') self.assertIn('PasswordAuthentication yes', out) diff --git a/tests/cloud_tests/testcases/modules/set_password_expire.py b/tests/cloud_tests/testcases/modules/set_password_expire.py index 1ac9c23f..a1c3aa08 100644 --- a/tests/cloud_tests/testcases/modules/set_password_expire.py +++ b/tests/cloud_tests/testcases/modules/set_password_expire.py @@ -1,14 +1,14 @@ # 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 class TestPasswordExpire(base.CloudTestCase): - """Test password module""" + """Test password module.""" def test_shadow(self): - """Test user frozen in shadow""" + """Test user frozen in shadow.""" out = self.get_data_file('shadow') self.assertIn('harry:!:', out) self.assertIn('dick:!:', out) @@ -16,7 +16,7 @@ class TestPasswordExpire(base.CloudTestCase): self.assertIn('harry:!:', out) def test_sshd_config(self): - """Test sshd config allows passwords""" + """Test sshd config allows passwords.""" out = self.get_data_file('sshd_config') self.assertIn('PasswordAuthentication no', out) diff --git a/tests/cloud_tests/testcases/modules/set_password_list.py b/tests/cloud_tests/testcases/modules/set_password_list.py index 6819d259..375cd27d 100644 --- a/tests/cloud_tests/testcases/modules/set_password_list.py +++ b/tests/cloud_tests/testcases/modules/set_password_list.py @@ -1,11 +1,12 @@ # 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 class TestPasswordList(base.PasswordListTest, base.CloudTestCase): - """Test password setting via list in chpasswd/list""" + """Test password setting via list in chpasswd/list.""" + __test__ = True # vi: ts=4 expandtab diff --git a/tests/cloud_tests/testcases/modules/set_password_list_string.py b/tests/cloud_tests/testcases/modules/set_password_list_string.py index 2c34fada..8c2634c5 100644 --- a/tests/cloud_tests/testcases/modules/set_password_list_string.py +++ b/tests/cloud_tests/testcases/modules/set_password_list_string.py @@ -1,11 +1,12 @@ # 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 class TestPasswordListString(base.PasswordListTest, base.CloudTestCase): - """Test password setting via string in chpasswd/list""" + """Test password setting via string in chpasswd/list.""" + __test__ = True # vi: ts=4 expandtab diff --git a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py index a0f8896b..82223217 100644 --- a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py +++ b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_disable.py @@ -1,24 +1,24 @@ # 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 class TestSshKeyFingerprintsDisable(base.CloudTestCase): - """Test ssh key fingerprints module""" + """Test ssh key fingerprints module.""" def test_cloud_init_log(self): - """Verify disabled""" + """Verify disabled.""" out = self.get_data_file('cloud-init.log') self.assertIn('Skipping module named ssh-authkey-fingerprints, ' 'logging of ssh fingerprints disabled', out) def test_syslog(self): - """Verify output of syslog""" + """Verify output of syslog.""" out = self.get_data_file('syslog') - self.assertNotRegexpMatches(out, r'256 SHA256:.*(ECDSA)') - self.assertNotRegexpMatches(out, r'256 SHA256:.*(ED25519)') - self.assertNotRegexpMatches(out, r'1024 SHA256:.*(DSA)') - self.assertNotRegexpMatches(out, r'2048 SHA256:.*(RSA)') + self.assertNotRegex(out, r'256 SHA256:.*(ECDSA)') + self.assertNotRegex(out, r'256 SHA256:.*(ED25519)') + self.assertNotRegex(out, r'1024 SHA256:.*(DSA)') + self.assertNotRegex(out, r'2048 SHA256:.*(RSA)') # vi: ts=4 expandtab diff --git a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_enable.py b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_enable.py index 3c44b0cc..3510e75a 100644 --- a/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_enable.py +++ b/tests/cloud_tests/testcases/modules/ssh_auth_key_fingerprints_enable.py @@ -1,18 +1,18 @@ # 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 class TestSshKeyFingerprintsEnable(base.CloudTestCase): - """Test ssh key fingerprints module""" + """Test ssh key fingerprints module.""" def test_syslog(self): - """Verify output of syslog""" + """Verify output of syslog.""" out = self.get_data_file('syslog') - self.assertRegexpMatches(out, r'256 SHA256:.*(ECDSA)') - self.assertRegexpMatches(out, r'256 SHA256:.*(ED25519)') - self.assertNotRegexpMatches(out, r'1024 SHA256:.*(DSA)') - self.assertNotRegexpMatches(out, r'2048 SHA256:.*(RSA)') + self.assertRegex(out, r'256 SHA256:.*(ECDSA)') + self.assertRegex(out, r'256 SHA256:.*(ED25519)') + self.assertNotRegex(out, r'1024 SHA256:.*(DSA)') + self.assertNotRegex(out, r'2048 SHA256:.*(RSA)') # vi: ts=4 expandtab diff --git a/tests/cloud_tests/testcases/modules/ssh_import_id.py b/tests/cloud_tests/testcases/modules/ssh_import_id.py index 214e710d..055c6a29 100644 --- a/tests/cloud_tests/testcases/modules/ssh_import_id.py +++ b/tests/cloud_tests/testcases/modules/ssh_import_id.py @@ -1,14 +1,14 @@ # 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 class TestSshImportId(base.CloudTestCase): - """Test ssh import id module""" + """Test ssh import id module.""" def test_authorized_keys(self): - """Test that ssh keys were imported""" + """Test that ssh keys were imported.""" out = self.get_data_file('auth_keys_ubuntu') # Rather than checking the key fingerprints, you could just check diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_generate.py b/tests/cloud_tests/testcases/modules/ssh_keys_generate.py index 161ace5f..fd6d9ba5 100644 --- a/tests/cloud_tests/testcases/modules/ssh_keys_generate.py +++ b/tests/cloud_tests/testcases/modules/ssh_keys_generate.py @@ -1,56 +1,56 @@ # 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 class TestSshKeysGenerate(base.CloudTestCase): - """Test ssh keys module""" + """Test ssh keys module.""" # TODO: Check cloud-init-output for the correct keys being generated def test_ubuntu_authorized_keys(self): - """Test passed in key is not in list for ubuntu""" + """Test passed in key is not in list for ubuntu.""" out = self.get_data_file('auth_keys_ubuntu') self.assertEqual('', out) def test_dsa_public(self): - """Test dsa public key not generated""" + """Test dsa public key not generated.""" out = self.get_data_file('dsa_public') self.assertEqual('', out) def test_dsa_private(self): - """Test dsa private key not generated""" + """Test dsa private key not generated.""" out = self.get_data_file('dsa_private') self.assertEqual('', out) def test_rsa_public(self): - """Test rsa public key not generated""" + """Test rsa public key not generated.""" out = self.get_data_file('rsa_public') self.assertEqual('', out) def test_rsa_private(self): - """Test rsa public key not generated""" + """Test rsa public key not generated.""" out = self.get_data_file('rsa_private') self.assertEqual('', out) def test_ecdsa_public(self): - """Test ecdsa public key generated""" + """Test ecdsa public key generated.""" out = self.get_data_file('ecdsa_public') self.assertIsNotNone(out) def test_ecdsa_private(self): - """Test ecdsa public key generated""" + """Test ecdsa public key generated.""" out = self.get_data_file('ecdsa_private') self.assertIsNotNone(out) def test_ed25519_public(self): - """Test ed25519 public key generated""" + """Test ed25519 public key generated.""" out = self.get_data_file('ed25519_public') self.assertIsNotNone(out) def test_ed25519_private(self): - """Test ed25519 public key generated""" + """Test ed25519 public key generated.""" out = self.get_data_file('ed25519_private') self.assertIsNotNone(out) diff --git a/tests/cloud_tests/testcases/modules/ssh_keys_provided.py b/tests/cloud_tests/testcases/modules/ssh_keys_provided.py index 8f18cb94..544649da 100644 --- a/tests/cloud_tests/testcases/modules/ssh_keys_provided.py +++ b/tests/cloud_tests/testcases/modules/ssh_keys_provided.py @@ -1,67 +1,67 @@ # 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 class TestSshKeysProvided(base.CloudTestCase): - """Test ssh keys module""" + """Test ssh keys module.""" def test_ubuntu_authorized_keys(self): - """Test passed in key is not in list for ubuntu""" + """Test passed in key is not in list for ubuntu.""" out = self.get_data_file('auth_keys_ubuntu') self.assertEqual('', out) def test_root_authorized_keys(self): - """Test passed in key is in authorized list for root""" + """Test passed in key is in authorized list for root.""" out = self.get_data_file('auth_keys_root') self.assertIn('lzrkPqONphoZx0LDV86w7RUz1ksDzAdcm0tvmNRFMN1a0frDs50' '6oA3aWK0oDk4Nmvk8sXGTYYw3iQSkOvDUUlIsqdaO+w==', out) def test_dsa_public(self): - """Test dsa public key passed in""" + """Test dsa public key passed in.""" out = self.get_data_file('dsa_public') self.assertIn('AAAAB3NzaC1kc3MAAACBAPkWy1zbchVIN7qTgM0/yyY8q4RZS8c' 'NM4ZpeuE5UB/Nnr6OSU/nmbO8LuM', out) def test_dsa_private(self): - """Test dsa private key passed in""" + """Test dsa private key passed in.""" out = self.get_data_file('dsa_private') self.assertIn('MIIBuwIBAAKBgQD5Fstc23IVSDe6k4DNP8smPKuEWUvHDTOGaXr' 'hOVAfzZ6+jklP', out) def test_rsa_public(self): - """Test rsa public key passed in""" + """Test rsa public key passed in.""" out = self.get_data_file('rsa_public') self.assertIn('AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgT' 'LnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4', out) def test_rsa_private(self): - """Test rsa public key passed in""" + """Test rsa public key passed in.""" out = self.get_data_file('rsa_private') self.assertIn('4DOkqNiUGl80Zp1RgZNohHUXlJMtAbrIlAVEk+mTmg7vjfyp2un' 'RQvLZpMRdywBm', out) def test_ecdsa_public(self): - """Test ecdsa public key passed in""" + """Test ecdsa public key passed in.""" out = self.get_data_file('ecdsa_public') self.assertIn('AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAAB' 'BBFsS5Tvky/IC/dXhE/afxxU', out) def test_ecdsa_private(self): - """Test ecdsa public key passed in""" + """Test ecdsa public key passed in.""" out = self.get_data_file('ecdsa_private') self.assertIn('AwEHoUQDQgAEWxLlO+TL8gL91eET9p/HFQbqR1A691AkJgZk3jY' '5mpZqxgX4vcgb', out) def test_ed25519_public(self): - """Test ed25519 public key passed in""" + """Test ed25519 public key passed in.""" out = self.get_data_file('ed25519_public') self.assertIn('AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6' 'G15dqjQ2XkNVOEnb5', out) def test_ed25519_private(self): - """Test ed25519 public key passed in""" + """Test ed25519 public key passed in.""" out = self.get_data_file('ed25519_private') self.assertIn('XAAAAAtzc2gtZWQyNTUxOQAAACDbnQGUruL42aVVsyHeaV5mYNT' 'OhteXao0Nl5DVThJ2+Q', out) diff --git a/tests/cloud_tests/testcases/modules/timezone.py b/tests/cloud_tests/testcases/modules/timezone.py index bf91d490..654fa53d 100644 --- a/tests/cloud_tests/testcases/modules/timezone.py +++ b/tests/cloud_tests/testcases/modules/timezone.py @@ -1,14 +1,14 @@ # 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 class TestTimezone(base.CloudTestCase): - """Test timezone module""" + """Test timezone module.""" def test_timezone(self): - """Test date prints correct timezone""" + """Test date prints correct timezone.""" out = self.get_data_file('timezone') self.assertEqual('HDT', out.rstrip()) diff --git a/tests/cloud_tests/testcases/modules/user_groups.py b/tests/cloud_tests/testcases/modules/user_groups.py index e5732322..67af527b 100644 --- a/tests/cloud_tests/testcases/modules/user_groups.py +++ b/tests/cloud_tests/testcases/modules/user_groups.py @@ -1,42 +1,42 @@ # 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 class TestUserGroups(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_group_ubuntu(self): - """Test ubuntu group exists""" + """Test ubuntu group exists.""" out = self.get_data_file('group_ubuntu') self.assertRegex(out, r'ubuntu:x:[0-9]{4}:') def test_group_cloud_users(self): - """Test cloud users group exists""" + """Test cloud users group exists.""" out = self.get_data_file('group_cloud_users') self.assertRegex(out, r'cloud-users:x:[0-9]{4}:barfoo') def test_user_ubuntu(self): - """Test ubuntu user exists""" + """Test ubuntu user exists.""" out = self.get_data_file('user_ubuntu') self.assertRegex( out, r'ubuntu:x:[0-9]{4}:[0-9]{4}:Ubuntu:/home/ubuntu:/bin/bash') def test_user_foobar(self): - """Test foobar user exists""" + """Test foobar user exists.""" out = self.get_data_file('user_foobar') self.assertRegex( out, r'foobar:x:[0-9]{4}:[0-9]{4}:Foo B. Bar:/home/foobar:') def test_user_barfoo(self): - """Test barfoo user exists""" + """Test barfoo user exists.""" out = self.get_data_file('user_barfoo') self.assertRegex( out, r'barfoo:x:[0-9]{4}:[0-9]{4}:Bar B. Foo:/home/barfoo:') def test_user_cloudy(self): - """Test cloudy user exists""" + """Test cloudy user exists.""" out = self.get_data_file('user_cloudy') self.assertRegex(out, r'cloudy:x:[0-9]{3,4}:') diff --git a/tests/cloud_tests/testcases/modules/write_files.py b/tests/cloud_tests/testcases/modules/write_files.py index 97dfeec3..7bd520f6 100644 --- a/tests/cloud_tests/testcases/modules/write_files.py +++ b/tests/cloud_tests/testcases/modules/write_files.py @@ -1,29 +1,29 @@ # 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 class TestWriteFiles(base.CloudTestCase): - """Example cloud-config test""" + """Example cloud-config test.""" def test_b64(self): - """Test b64 encoded file reads as ascii""" + """Test b64 encoded file reads as ascii.""" out = self.get_data_file('file_b64') self.assertIn('ASCII text', out) def test_binary(self): - """Test binary file reads as executable""" + """Test binary file reads as executable.""" out = self.get_data_file('file_binary') self.assertIn('ELF 64-bit LSB executable, x86-64, version 1', out) def test_gzip(self): - """Test gzip file shows up as a shell script""" + """Test gzip file shows up as a shell script.""" out = self.get_data_file('file_gzip') self.assertIn('POSIX shell script, ASCII text executable', out) def test_text(self): - """Test text shows up as ASCII text""" + """Test text shows up as ASCII text.""" out = self.get_data_file('file_text') self.assertIn('ASCII text', out) |