summaryrefslogtreecommitdiffstats
path: root/utils/functest_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2016-09-01Add print-to-a-file option when executing a command in functest_utilsjose.lausuch1-4/+11
Change-Id: I8b91979380d0f4794d5ceaf8edb2a9d80cd7170f Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-09-01stop hardcoded FUNCTEST_REPO path everywhereSerenaFeng1-1/+1
functest repo is used by almost every testcase, each place we get it like: REPOS_DIR = os.getenv('repos_dir') FUNCTEST_REPO = ("%s/functest" % REPOS_DIR) provide a common interface in functest_util.py JIRA: FUNCTEST-453 Change-Id: Ie0635dacc761ed2d05b7e606530368844f32ebaf Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-09-01Merge "unify functest_yaml obtain process"Jose Lausuch1-6/+9
2016-08-31unify functest_yaml obtain processSerenaFeng1-6/+9
functest_yaml is needed in almost all of the testcases, the obtain process is the same: with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() abstract a method to unify the process, and provide the interface JIRA: FUNCTEST-447 Change-Id: I96a9a9962d7b466f10bbd3b5ab2495957524e22a Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-31Remove all logers as utils method args.Cédric Ollivier1-32/+29
As it modifies method params, it could break the testcases. JIRA: FUNCTEST-428 Change-Id: I4263d9bd812f1803e513464e3c321cc4a7281958 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-31Use a global logger instead of method argsCédric Ollivier1-74/+44
It's the first step to safely remove all logers as method args. Outputs printed by bash scripts called by execute_command are no longer written in functest.log. Else logs printed by python scripts will be duplicated in it. JIRA: FUNCTEST-428 Change-Id: I60702f3b62121f731cd6845c335e227f97df37c9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-31unify testcases.yaml obtain processSerenaFeng1-1/+5
hardcoded "''FUNCTEST_REPO + "/ci/testcases.yaml"''' appears wherever testcases.yaml is needed, abstract a method to provide unified interface JIRA: FUNCTEST-449 Change-Id: Ida8e3d90926d3e2245883a29f577ecb121bd5d6c Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-30Flush stdout as it can be redirected to logCédric Ollivier1-0/+1
It avoids mixed logs in Jenkins' console by flushing every message printed by the forked programs as logger.info() does. It must be complete by refactoring logger management in util functions [1] and by preventing output buffering in forked programs. [1] https://jira.opnfv.org/browse/FUNCTEST-428 JIRA: FUNCTEST-441 Change-Id: Id8da814d79ea6b1e6b91b49e23a85c3802e11515 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-26Set env vars as mandatory to push to DBCédric Ollivier1-5/+24
Now env vars are mandatory in push_results_to_db. It avoids testing programs to check them even if they are useless from their points of view. The related getters aren't removed to help debugging via logger_test_results which could be run without report. Change-Id: Iadb94319529f5ec4230fb62042511948183b93ed Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-23Avoid duplicating logs in run_tests.pyCédric Ollivier1-1/+2
When run_tests.py sets logger as execute_command arg, logs are duplicated in functest.log and not shown in console (as every DEBUG message). As logger is mainly managed by the python scripts in charge of testing, it can be safely removed here. stderr is also redirected to stdout in execute_command to print possible relevant data. JIRA: FUNCTEST-431 Change-Id: Ie77544b4679e12e0a0ac7f5e5989d86862fe106b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-23refactor push_result_to_db print thingSerenaFeng1-11/+38
when Exceptions happen, the print code is too difficult to understand and maintain, modify to make it clear jira: FUNCTEST-425 Change-Id: Ie12af989e711df3791167955642f2edf1164b146 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-22bugfix: push_result_to_db exception showSerenaFeng1-0/+5
When pod is not exist in DB, exception will be shown as 'Error pushing results into Database '<type 'exceptions.TypeError'>'', very unclear, make it very difficult to fix the problem. Modify it to show as the testapi returned 'HTTPError: HTTP 404: Not Found (Could not find pod [zte-no])' JIRA: FUNCTEST-424 Change-Id: I55fc4639d745b84f6d32a148bd13793d236e2a09 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-19Fix print when push_results_to_db failsCédric Ollivier1-2/+2
Change-Id: I82741a8727fc17bc6648e1b1e92511b3efd93b8a Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-17Check the response status codeCédric Ollivier1-0/+1
Now an HTTPError exception is raised in case of a 4XX or 5XX error response. Change-Id: Idd91c1d2b2a1b81a1cf7d075527cb302099cdb4e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-17Add reporting flag to push reuslts only from CIMorgan Richomme1-3/+12
JIRA: FUNCTEST-416 Change-Id: I1a5800be0dcf75573f44e6214b23917aadc1cbf7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-08-10Create config_functest patch to update the conf with scenarioboucherv1-4/+17
Adding support of LXD scenario JIRA: FUNCTEST-268 Change-Id: I5891ff9de674d99d32d8db747be501ee8a2e6609 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-08-04Merge "unify test result check for feature project and apply to parser"valentin boucher1-2/+19
2016-08-04unify test result check for feature project and apply to parserSerenaFeng1-2/+19
add check_test_result() method to unify test result process JIRA: FUNCTEST-405 Change-Id: Iee4d2876cbbf372f8c3e3bf94448036669bc7f7e Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-03functest utils - get_resolvconf_ns() Ensure that dns works with dns name ↵boucherv1-5/+9
resolution JIRA: FUNCTEST-402 Change-Id: I5fa9204aafb13330eb810950aa7bc728f1a69162 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-07-29correct rally criteria checkSerenaFeng1-0/+19
add method check_success_rate() to unify criteria check by success_rate JIRA: FUNCTEST-398 Change-Id: I1b3f0ccd7061b80ac88356206f29844e31e4101b Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-07-29unify test results logger and apply to parserSerenaFeng1-0/+21
refine a unified method to log the test results and use it to parser. JIRA: FUNCTEST-397 Change-Id: I5ed6b04107be5590b1d9d5683c8f1846fef5a4d4 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-07-22Fix execute_command function to show all the outputjose.lausuch1-8/+6
This function wasn't showing anything for some commands, like 'rally show images' and 'rally show flavors' JIRA: FUNCTEST-348 Change-Id: I75bf5f3504ea8ffea42c2fb237d6863c655259e1 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-19Show real time tempest test executionjose.lausuch1-1/+2
JIRA: FUNCTEST-375 Change-Id: I4f0cb68639b927f2980389d9331ec260605c8caf Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-04Add openstack clients and create instance in openstack_utilsjose.lausuch1-2/+4
JIRA: FUNCTEST-346 Change-Id: Ie10d55872bc8c5a404b0d0156ee49a9d94482008 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-04Change OpenStack clean behaviourjose.lausuch1-4/+29
JIRA: FUNCTEST-236 The openstack snapshot generation is now triggered before running a test case and removed from prepare_env Change-Id: I4d1bc95dedd7f59d4b1d5866f288e1c1a70ec69e Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-06-13Fix bug: use right format for date when pushing to DBMorgan Richomme1-2/+5
JIRA: FUNCTEST-303 Change-Id: I53e7c8f963ef0fa248d76e0d1c5f04326a750dcc Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-06-08Adapt functest testcase to APi refactoringMorgan Richomme1-6/+24
JIRA: FUNCTEST-303 Change-Id: Ia276d9ca6e8d62b496c3b5f81561b14b02c43fd7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-06-01Add criteria in testcases.yaml and Test classjose.lausuch1-0/+18
JIRA: FUNCTEST-257 Added example of usage in vping_ssh Change-Id: Iac143b811db163f0f86682b0688948c20843ede5 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-05-31Avoid tuples when printing multiple stringsCédric Ollivier1-1/+1
It fixes bugs induced by [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/12623 Change-Id: I0232b14bed767b3ff857192146551a7963699bb9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-05-16BGPVPN test case refactoredvitikkan1-0/+26
BGPVPN test case is refactored and moved into bgpvpn.py module. JIRA: FUNCTEST-234 Change-Id: Ib0dd6e11f3c568470d9c3837ca192da767c64843 Signed-off-by: vitikkan <viktor.tikkanen@nokia.com>
2016-05-09CLI implementationjose.lausuch1-9/+11
JIRA: FUNCTEST-243 Change-Id: Ibf0ef9bcc5f3aeda96b050827b954ce060317613 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-05-05Don't exit on error when destroying rally deploymentjose.lausuch1-13/+28
Also, some improvements in execute_command function Change-Id: I8271d55202b8859701275d5f7322a7bd4894e475 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-05-04Refactor, add logger handler to collect all the logs to a file as welljose.lausuch1-116/+18
JIRA: FUNCTEST-190 Also: - remove old code that are not used any more - improve execute_command function - fix logger output for run_tempest Change-Id: Ib268738ada1b9de2a418ef01e684a90e6f4e02ed Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-04-26Move functest_utils and openstack_utils to directory /utilsjose.lausuch1-0/+318
JIRA: FUNCTEST-226 Change-Id: I74d09f6322844b25ab45a02156317ae76ab40d8a Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>