diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-10 11:38:32 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-16 15:01:57 +0200 |
commit | 3218f1fa1d7bb265f3b5c50e0853a00446ac2e93 (patch) | |
tree | 6c87d9a4a2c15d6a0830247dd9892bfdc54401bf | |
parent | ccb98c22390fd97a3bb55aa225c7241cc4daa85d (diff) |
Fix how to get tier_name
The tier name was incorrect when passing a test case as run_test.py arg.
Change-Id: I6f439fc7b90facb3f0553798bd1fe06ac9f09475
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rwxr-xr-x | functest/ci/run_tests.py | 2 | ||||
-rw-r--r-- | functest/ci/tier_builder.py | 6 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_tier_builder.py | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index 1396644f7..7035992b8 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -243,7 +243,7 @@ def main(**kwargs): run_tier(_tiers.get_tier(kwargs['test'])) elif _tiers.get_test(kwargs['test']): run_test(_tiers.get_test(kwargs['test']), - _tiers.get_tier(kwargs['test']), + _tiers.get_tier_name(kwargs['test']), kwargs['test']) elif kwargs['test'] == "all": run_all(_tiers) diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py index 44b272584..e1939c377 100644 --- a/functest/ci/tier_builder.py +++ b/functest/ci/tier_builder.py @@ -72,6 +72,12 @@ class TierBuilder(object): return self.tier_objects[i] return None + def get_tier_name(self, test_name): + for i in range(0, len(self.tier_objects)): + if self.tier_objects[i].is_test(test_name): + return self.tier_objects[i].name + return None + def get_test(self, test_name): for i in range(0, len(self.tier_objects)): if self.tier_objects[i].is_test(test_name): diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py index 438fa7c25..1c0914983 100644 --- a/functest/tests/unit/ci/test_tier_builder.py +++ b/functest/tests/unit/ci/test_tier_builder.py @@ -78,6 +78,13 @@ class TierBuilderTesting(unittest.TestCase): self.assertEqual(self.tierbuilder.get_tests('test_tier2'), None) + def test_get_tier_name_ok(self): + self.assertEqual(self.tierbuilder.get_tier_name('test_name'), + 'test_tier') + + def test_get_tier_name_ko(self): + self.assertEqual(self.tierbuilder.get_tier_name('test_name2'), None) + if __name__ == "__main__": unittest.main(verbosity=2) |