From: Zack Cerza Date: Wed, 20 May 2015 21:35:11 +0000 (-0600) Subject: Add tests for get_install_task_flavor() X-Git-Tag: 1.1.0~935^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F495%2Fhead;p=teuthology.git Add tests for get_install_task_flavor() Also a couple bonus linter fixes Signed-off-by: Zack Cerza --- diff --git a/teuthology/test/test_suite.py b/teuthology/test/test_suite.py index 4ec756f0e..b7e03edbf 100644 --- a/teuthology/test/test_suite.py +++ b/teuthology/test/test_suite.py @@ -135,6 +135,58 @@ class TestSuiteOffline(object): assert result == "/path/to/left" +class TestFlavor(object): + def test_get_install_task_flavor_bare(self): + config = dict( + tasks=[ + dict( + install=dict(), + ), + ], + ) + assert suite.get_install_task_flavor(config) == 'basic' + + def test_get_install_task_flavor_simple(self): + config = dict( + tasks=[ + dict( + install=dict( + flavor='notcmalloc', + ), + ), + ], + ) + assert suite.get_install_task_flavor(config) == 'notcmalloc' + + def test_get_install_task_flavor_override_simple(self): + config = dict( + tasks=[ + dict(install=dict()), + ], + overrides=dict( + install=dict( + flavor='notcmalloc', + ), + ), + ) + assert suite.get_install_task_flavor(config) == 'notcmalloc' + + def test_get_install_task_flavor_override_project(self): + config = dict( + tasks=[ + dict(install=dict()), + ], + overrides=dict( + install=dict( + ceph=dict( + flavor='notcmalloc', + ), + ), + ), + ) + assert suite.get_install_task_flavor(config) == 'notcmalloc' + + class TestMissingPackages(object): """ Tests the functionality that checks to see if a @@ -318,10 +370,11 @@ def make_fake_fstools(fake_filesystem): else: return False - def fake_isdir(path, fsdict = False): + def fake_isdir(path, fsdict=False): return not fake_isfile(path) return fake_listdir, fake_isfile, fake_isdir + class TestBuildMatrix(object): def fragment_occurences(self, jobs, fragment): # What fraction of jobs contain fragment?