diff options
-rw-r--r-- | doctor_tests/main.py | 8 | ||||
-rw-r--r-- | doctor_tests/scenario/__init__.py | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/doctor_tests/main.py b/doctor_tests/main.py index f54b6403..5bd3c596 100644 --- a/doctor_tests/main.py +++ b/doctor_tests/main.py @@ -163,7 +163,13 @@ class DoctorTest(object): self.test_fault_management() self.test_maintenance() else: - getattr(self, self.conf.test_case)() + function = 'test_%s' % self.conf.test_case + if hasattr(self, function): + getattr(self, function)() + else: + raise Exception('Can not find function <%s> in' + 'DoctorTest, see config manual' + % function) except Exception as e: LOG.error('doctor test failed, Exception=%s' % e) sys.exit(1) diff --git a/doctor_tests/scenario/__init__.py b/doctor_tests/scenario/__init__.py index 9e7cd11d..b9dfa307 100644 --- a/doctor_tests/scenario/__init__.py +++ b/doctor_tests/scenario/__init__.py @@ -11,7 +11,12 @@ from oslo_config import cfg OPTS = [ cfg.StrOpt('test_case', - default='all', - help='the name of test case', + default='fault_management', + help="A name of test case to be executed," + " choices are 'all', 'fault_management' or 'maintenance'." + " Set 'all' to execute all the test cases existing in" + " this repo. Default is 'fault_management'. Another test" + " case can be specified only if a function named" + " test_<test_case>() was implemented in DoctorTest.", required=False), ] |