From 4a0e460f18d8cbf2651286565efec1f00cbb20cd Mon Sep 17 00:00:00 2001 From: "Nate House nathan.house@rackspace.com" <> Date: Mon, 3 Feb 2014 15:58:43 -0600 Subject: Update yum unittest --- tests/unittests/test_handler/test_handler_yum_add_repo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_handler/test_handler_yum_add_repo.py b/tests/unittests/test_handler/test_handler_yum_add_repo.py index 8df592f9..ddf0ef9c 100644 --- a/tests/unittests/test_handler/test_handler_yum_add_repo.py +++ b/tests/unittests/test_handler/test_handler_yum_add_repo.py @@ -2,6 +2,7 @@ from cloudinit import helpers from cloudinit import util from cloudinit.config import cc_yum_add_repo +from cloudinit.distros import rhel from tests.unittests import helpers @@ -18,6 +19,8 @@ class TestConfig(helpers.FilesystemMockingTestCase): def setUp(self): super(TestConfig, self).setUp() self.tmp = self.makeDir(prefix="unittest_") + self.cloud = type('', (), {})() + self.cloud.distro = rhel.Distro('test', {}, None) def test_bad_config(self): cfg = { @@ -34,7 +37,7 @@ class TestConfig(helpers.FilesystemMockingTestCase): }, } self.patchUtils(self.tmp) - cc_yum_add_repo.handle('yum_add_repo', cfg, None, LOG, []) + cc_yum_add_repo.handle('yum_add_repo', cfg, self.cloud, LOG, []) self.assertRaises(IOError, util.load_file, "/etc/yum.repos.d/epel_testing.repo") @@ -52,7 +55,7 @@ class TestConfig(helpers.FilesystemMockingTestCase): }, } self.patchUtils(self.tmp) - cc_yum_add_repo.handle('yum_add_repo', cfg, None, LOG, []) + cc_yum_add_repo.handle('yum_add_repo', cfg, self.cloud, LOG, []) contents = util.load_file("/etc/yum.repos.d/epel_testing.repo") contents = configobj.ConfigObj(StringIO(contents)) expected = { -- cgit v1.2.3 From 0efeb26736ddae2967c14a9440088594da32070d Mon Sep 17 00:00:00 2001 From: "Nate House nathan.house@rackspace.com" <> Date: Mon, 3 Feb 2014 16:53:31 -0600 Subject: Added is_excluded tests and updated gentoo init script --- setup.py | 2 -- sysvinit/gentoo/cloud-init-local | 1 - tests/unittests/test_distros/test_is_excluded.py | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/unittests/test_distros/test_is_excluded.py (limited to 'tests') diff --git a/setup.py b/setup.py index b0766970..9118e5f6 100755 --- a/setup.py +++ b/setup.py @@ -39,14 +39,12 @@ def is_f(p): INITSYS_FILES = { 'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)], 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)], - 'sysvinit_gentoo': [f for f in glob('sysvinit/gentoo/*') if is_f(f)], 'systemd': [f for f in glob('systemd/*') if is_f(f)], 'upstart': [f for f in glob('upstart/*') if is_f(f)], } INITSYS_ROOTS = { 'sysvinit': '/etc/rc.d/init.d', 'sysvinit_deb': '/etc/init.d', - 'sysvinit_gentoo': '/etc/init.d', 'systemd': '/etc/systemd/system/', 'upstart': '/etc/init/', } diff --git a/sysvinit/gentoo/cloud-init-local b/sysvinit/gentoo/cloud-init-local index 1d22a79d..8c9968d8 100644 --- a/sysvinit/gentoo/cloud-init-local +++ b/sysvinit/gentoo/cloud-init-local @@ -1,7 +1,6 @@ #!/sbin/runscript depend() { - after net # remove after nova-agent fix before cloud-init provide cloud-init-local } diff --git a/tests/unittests/test_distros/test_is_excluded.py b/tests/unittests/test_distros/test_is_excluded.py new file mode 100644 index 00000000..53a4445c --- /dev/null +++ b/tests/unittests/test_distros/test_is_excluded.py @@ -0,0 +1,15 @@ +from cloudinit.distros import gentoo +import unittest + + +class TestIsExcluded(unittest.TestCase): + + def setUp(self): + self.distro = gentoo.Distro('gentoo', {}, None) + self.distro.exclude_modules = ['test-module'] + + def test_is_excluded_success(self): + self.assertEqual(self.distro.is_excluded('test-module'), True) + + def test_is_excluded_fail(self): + self.assertEqual(self.distro.is_excluded('missing'), None) -- cgit v1.2.3