From c6cba5a261dc61357d7d2a50a3e68b319789bebc Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 20 May 2015 15:35:11 -0600 Subject: [PATCH] Add tests for get_install_task_flavor() Also a couple bonus linter fixes Signed-off-by: Zack Cerza --- teuthology/test/test_suite.py | 55 ++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/teuthology/test/test_suite.py b/teuthology/test/test_suite.py index 4ec756f0e8..b7e03edbf9 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? -- 2.39.5