]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add tests for get_install_task_flavor() 495/head
authorZack Cerza <zack@redhat.com>
Wed, 20 May 2015 21:35:11 +0000 (15:35 -0600)
committerZack Cerza <zack@redhat.com>
Wed, 20 May 2015 21:37:04 +0000 (15:37 -0600)
Also a couple bonus linter fixes

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/test/test_suite.py

index 4ec756f0e88de551d23d4cc34c9035942648b180..b7e03edbf95ee0a225aab071928a4944b4673bd9 100644 (file)
@@ -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?