diff options
Diffstat (limited to 'testcases/features')
-rwxr-xr-x | testcases/features/copper.py | 16 | ||||
-rwxr-xr-x | testcases/features/doctor.py | 28 | ||||
-rwxr-xr-x | testcases/features/domino.py | 9 |
3 files changed, 38 insertions, 15 deletions
diff --git a/testcases/features/copper.py b/testcases/features/copper.py index 73def7db2..9be909427 100755 --- a/testcases/features/copper.py +++ b/testcases/features/copper.py @@ -14,23 +14,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import argparse import sys import time -import argparse import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as functest_utils + parser = argparse.ArgumentParser() parser.add_argument("-r", "--report", help="Create json result file", action="store_true") args = parser.parse_args() -functest_yaml = functest_utils.get_functest_yaml() - -dirs = functest_yaml.get('general').get('directories') -COPPER_REPO = dirs.get('dir_repo_copper') +COPPER_REPO = functest_utils.get_parameter_from_yaml( + 'general.directories.dir_repo_copper') +RESULTS_DIR = functest_utils.get_parameter_from_yaml( + 'general.directories.dir_results') logger = ft_logger.Logger("copper").getLogger() @@ -40,7 +41,10 @@ def main(): start_time = time.time() - ret_val = functest_utils.execute_command(cmd, logger, exit_on_error=False) + log_file = RESULTS_DIR + "/copper.log" + ret_val = functest_utils.execute_command(cmd, + exit_on_error=False, + output_file=log_file) stop_time = time.time() duration = round(stop_time - start_time, 1) diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py index 6e6f26f37..68c80a9e4 100755 --- a/testcases/features/doctor.py +++ b/testcases/features/doctor.py @@ -13,12 +13,14 @@ # 0.2: measure test duration and publish results under json format # # +import argparse +import os import time -import argparse import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as functest_utils + parser = argparse.ArgumentParser() parser.add_argument("-r", "--report", help="Create json result file", @@ -27,28 +29,40 @@ args = parser.parse_args() functest_yaml = functest_utils.get_functest_yaml() -dirs = functest_yaml.get('general').get('directories') -DOCTOR_REPO = dirs.get('dir_repo_doctor') +DOCTOR_REPO = functest_utils.get_parameter_from_yaml( + 'general.directories.dir_repo_doctor') +RESULTS_DIR = functest_utils.get_parameter_from_yaml( + 'general.directories.dir_results') logger = ft_logger.Logger("doctor").getLogger() def main(): exit_code = -1 + + # if the image name is explicitly set for the doctor suite, set it as + # enviroment variable + if 'doctor' in functest_yaml and 'image_name' in functest_yaml['doctor']: + os.environ["IMAGE_NAME"] = functest_yaml['doctor']['image_name'] + cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO + log_file = RESULTS_DIR + "/doctor.log" + start_time = time.time() - ret = functest_utils.execute_command(cmd, logger, info=True, - exit_on_error=False) + ret = functest_utils.execute_command(cmd, + info=True, + exit_on_error=False, + output_file=log_file) stop_time = time.time() duration = round(stop_time - start_time, 1) if ret == 0: - logger.info("doctor OK") + logger.info("Doctor test case OK") test_status = 'OK' exit_code = 0 else: - logger.info("doctor FAILED") + logger.info("Doctor test case FAILED") test_status = 'NOK' details = { diff --git a/testcases/features/domino.py b/testcases/features/domino.py index cc98f546d..c717c060e 100755 --- a/testcases/features/domino.py +++ b/testcases/features/domino.py @@ -14,9 +14,9 @@ # 0.3: add report flag to push results when needed # +import argparse import time -import argparse import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as functest_utils @@ -31,15 +31,20 @@ functest_yaml = functest_utils.get_functest_yaml() dirs = functest_yaml.get('general').get('directories') DOMINO_REPO = dirs.get('dir_repo_domino') +RESULTS_DIR = functest_utils.get_parameter_from_yaml( + 'general.directories.dir_results') logger = ft_logger.Logger("domino").getLogger() def main(): cmd = 'cd %s && ./tests/run_multinode.sh' % DOMINO_REPO + log_file = RESULTS_DIR + "/domino.log" start_time = time.time() - ret = functest_utils.execute_command(cmd, logger, exit_on_error=False) + ret = functest_utils.execute_command(cmd, + exit_on_error=False, + output_file=log_file) stop_time = time.time() duration = round(stop_time - start_time, 1) |