]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add unit tests for '$' file. 1157/head 1159/head
authorWarren Usui <wusui@redhat.com>
Fri, 23 Mar 2018 01:51:57 +0000 (01:51 +0000)
committerWarren Usui <wusui@redhat.com>
Fri, 23 Mar 2018 01:51:57 +0000 (01:51 +0000)
Signed-off-by: Warren Usui <wusui@redhat.com>
teuthology/suite/test/test_build_matrix.py
teuthology/suite/test/test_matrix.py

index ea547be2ffb51d8f68890d6117558f25ff798dec..28728a984e927685eb716926e8c6eb69ea6010ec 100644 (file)
@@ -174,6 +174,83 @@ class TestBuildMatrix(object):
             assert 'd0_0/d1_2/d1_2_2.yaml' in i[1]
             assert 'd0_0/d1_2/d1_2_3.yaml' in i[1]
 
+    def test_random_dollar_sign_2x2x3(self):
+        fake_fs = {
+            'd0_0': {
+                '$': None,
+                'd1_0': {
+                    'd1_0_0.yaml': None,
+                    'd1_0_1.yaml': None,
+                },
+                'd1_1': {
+                    'd1_1_0.yaml': None,
+                    'd1_1_1.yaml': None,
+                },
+                'd1_2': {
+                    'd1_2_0.yaml': None,
+                    'd1_2_1.yaml': None,
+                    'd1_2_2.yaml': None,
+                },
+            },
+        }
+        self.start_patchers(fake_fs)
+        result = build_matrix.build_matrix('d0_0')
+        assert len(result) == 1
+
+    def test_random_dollar_sign_with_concat(self):
+        fake_fs = {
+            'd0_0': {
+                '$': None,
+                'd1_0': {
+                    'd1_0_0.yaml': None,
+                },
+                'd1_1': {
+                    'd1_1_0.yaml': None,
+                    'd1_1_1.yaml': None,
+                },
+                'd1_2': {
+                    '+': None,
+                    'd1_2_0.yaml': None,
+                    'd1_2_1.yaml': None,
+                    'd1_2_2.yaml': None,
+                    'd1_2_3.yaml': None,
+                },
+            },
+        }
+        self.start_patchers(fake_fs)
+        result = build_matrix.build_matrix('d0_0')
+        assert len(result) == 1
+        if result[0][0][1:].startswith('d1_2'):
+            for i in result:
+                assert 'd0_0/d1_2/d1_2_0.yaml' in i[1]
+                assert 'd0_0/d1_2/d1_2_1.yaml' in i[1]
+                assert 'd0_0/d1_2/d1_2_2.yaml' in i[1]
+                assert 'd0_0/d1_2/d1_2_3.yaml' in i[1]
+
+    def test_random_dollar_sign_with_convolve(self):
+        fake_fs = {
+            'd0_0': {
+                '%': None,
+                'd1_0': {
+                    'd1_0_0.yaml': None,
+                    'd1_0_1.yaml': None,
+                },
+                'd1_1': {
+                    'd1_1_0.yaml': None,
+                    'd1_1_1.yaml': None,
+                },
+                'd1_2': {
+                    '$': None,
+                    'd1_2_0.yaml': None,
+                    'd1_2_1.yaml': None,
+                    'd1_2_2.yaml': None,
+                },
+            },
+        }
+        self.start_patchers(fake_fs)
+        result = build_matrix.build_matrix('d0_0')
+        assert len(result) == 4
+
     def test_emulate_teuthology_noceph(self):
         fake_fs = {
             'teuthology': {
index 3333e52b511fc918467f1bc1f3409cd44b1648f7..596bb37a74dfeb35b5582153f17e957510a1d78c 100644 (file)
@@ -72,3 +72,11 @@ class TestMatrix(object):
                             mbs(5, range(4))])
                     ]
                 ))
+
+    def test_product_with_pick_random(self):
+        verify_matrix_output_diversity(matrix.PickRandom(1, [
+                    mbs(1, range(6)),
+                    mbs(3, range(3)),
+                    mbs(2, range(2)),
+                    mbs(4, range(9)),
+                    ]))