From: Warren Usui Date: Fri, 23 Mar 2018 01:51:57 +0000 (+0000) Subject: Add unit tests for '$' file. X-Git-Tag: 1.1.0~354^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1157%2Fhead;p=teuthology.git Add unit tests for '$' file. Signed-off-by: Warren Usui --- diff --git a/teuthology/suite/test/test_build_matrix.py b/teuthology/suite/test/test_build_matrix.py index ea547be2f..28728a984 100644 --- a/teuthology/suite/test/test_build_matrix.py +++ b/teuthology/suite/test/test_build_matrix.py @@ -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': { diff --git a/teuthology/suite/test/test_matrix.py b/teuthology/suite/test/test_matrix.py index 3333e52b5..596bb37a7 100644 --- a/teuthology/suite/test/test_matrix.py +++ b/teuthology/suite/test/test_matrix.py @@ -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)), + ]))