aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/core
AgeCommit message (Collapse)AuthorFilesLines
2018-03-02Leverage on XtestingCédric Ollivier6-694/+2
It removes all the files which have moved to Xtesting. Vnf inheritances and env management will be improved in other changes. It keeps the same tree thanks to a symlink to allow publishing artifacts. Change-Id: I551bbd3f344cdab0158a50b7b09e541576695631 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-28Merge "Support different user/project domain values"valentin boucher1-2/+12
2018-02-22Support different user/project domain valuesValentin Boucher1-2/+12
For the moment, VNF works well only if OS_PROJECT_DOMAIN_NAME=Default OS_USER_DOMAIN_NAME=Default It's now possible to use domain != Default JIRA: FUNCTEST-935 Change-Id: I779a93538662ff32906d91d7cf3b2c5c3e872765 Signed-off-by: Valentin Boucher <valentin.boucher@kontron.com>
2018-02-22Use constants for Functest config fileCédric Ollivier1-4/+5
env_file can't be defined in a config file simply because it's an entry point (Jenkins jobs, end users) Change-Id: Ie23c0ef90efc839d60f0f3a9754c58746b1f3a00 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-09Ensure logging is disabled when unit testing featureCédric Ollivier1-3/+6
Change-Id: Ibe08477a8b50a6c9b71ab4e5b0ebaaab36692b08 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-09Unlink vnf from constantsCédric Ollivier1-12/+4
It generates a default description which all testcases can easily override. Change-Id: I81b97c394cf064088767cc934295602f01a7f739 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-07Add variablefile as possible robot.run() argsCédric Ollivier1-4/+12
Change-Id: Ic80840957b4d9c3c4a1615696a2851f3f5bf7bf4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-01Rename a common credential file for OS and K8SLinda Wang1-4/+4
Change-Id: Ib8d24be4b29ab1de00d5dd5e3442146b2437cb94 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2018-01-21Move push_results_to_db to TestCaseCédric Ollivier1-56/+101
It removes the link between TestCase and Functest utils (xtesting). It should be noted that testresults url can only be set by env var. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: Ie072c675890d0ae2e63619c599d2684a8c7d762d Signed-off-by: Jose Lausuch <jalausuch@suse.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-12-27Execute feature command by subprocess directlyLinda Wang1-24/+26
Change-Id: I77e86af4e96310c6520d743e4d16c9a7b2e9adf5 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-12-19Delete TestCase.create_snapshot()Cédric Ollivier1-4/+0
OSGC has been removed then this method can be safely removed. It also updates run_tests.py. Change-Id: I4030b7f0351d24d095313ae990b08e65d8f69115 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-12-19Remove OSGCTestCaseCédric Ollivier1-43/+3
This class is no longer used and must be removed before working on xtesting. JIRA: FUNCTEST-887 Change-Id: I3ac1db6ec90d9db301e5461cd79cfcf77291dffc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-11-29Cover vnf.prepare()Cédric Ollivier1-5/+63
It completes the previous commit [1] which increased the coverage of Vnf. [1] https://gerrit.opnfv.org/gerrit/#/c/47851/ Change-Id: Ibb0201d6165d89da2edd1a93b722008092726569 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-11-27Fully cover vnfCédric Ollivier1-43/+12
clean() is now covered by unit tests. It must be noted that clean() doesn't warn about the possible failures when cleaning resources. Change-Id: If64c0cc5777ac5d2ce8a04ea34cd4f50091ab273 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-11-27Create RobotFramework classCédric Ollivier1-0/+191
It moves the capability to run any robot script from ODL TestCase into a new class: RobotFramework. It updates ODL TestCase and the related unit tests to inherit from the new parent class. Change-Id: I73e59ee9652fb63d9d89d7c75c58cce9cf62b0d7 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-09-04More support of snaps for VNFboucherv1-78/+51
Remove OpenStack utils in vnf_base Support snaps for quotas management in cloudify_ims Change-Id: I44e5b01bb26569276133e85dfc25bc2cceb03056 Signed-off-by: boucherv <valentin.boucher@orange.com>
2017-08-07Add copper and domino in functest-featuresCédric Ollivier1-2/+2
Change-Id: I6f7a35b84c9b7f8cde88998f545b30cc200c8ff1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-07-05Convert files to Unix formatCédric Ollivier1-194/+194
It fixes "[cloudify_ims] Support Cloudify 4.0" [1] [1] https://gerrit.opnfv.org/gerrit/#/c/36315/ Change-Id: I70d04e781d7034f37783764ae5e8b399d62bb793 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-07-03[cloudify_ims] Support Cloudify 4.0boucherv1-210/+194
- Delete all shell commands to use cloudify python lib - Cloudify Manager installation with a packaged image - SNAPS integration - Adapt test_vnf unit tests - Initiate test cloudify_ims unit tests (to be completed) JIRA: FUNCTEST-838 Change-Id: Ia4b499d4155e6af5d37d6d5cf4310a5a9693c7ce Signed-off-by: boucherv <valentin.boucher@orange.com> Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-06-21Define logger as Feature instance attributeJose Lausuch1-4/+19
It allows any Feature subclass to print warning messages in console and debug messages in a dedicated file. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: Ic5b1b1184c16cf50f0baadc3904075d0acdf3c6d Signed-off-by: Jose Lausuch <jose.lausuch@ericsson.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-14Update Suite details pushed to DBCédric Ollivier1-4/+8
It now reports stats and dumps stream into details. By the way, it fixes a bug when serializing the former details. Change-Id: Idd388708071ca3185e5a07bc7e977f2d9837dc95 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-06Refactor core VNF classMorgan Richomme1-110/+153
- Simplify processing - Implement run method to inherit testcase methods - Add unit tests - Fix all pylint issues It also obliges vnf and its uts to be rated 10/10 by pylint. JIRA: FUNCTEST-830 Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I8dd24eea55089277c9e5b2b51fb14dc377f2fcaf Signed-off-by: Morgan Richomme <morgan.richomme@orange.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-30Define create_snapshot() and clean() in TestCaseCédric Ollivier1-0/+49
They replace the former calls in run_tests which are not suitable for all test cases. Now any test case can define how to clean its resources. If the snapshot cannot be created, the test case is considered as failed. Only a message is printed if any failure during cleaning. It also defines a new class called OSGCTestCase useful for test cases which don't clean their OpenStack resources. All test cases located in opnfv_tests/openstack inherit from it to keep the global behavior unchanged. It also deletes exit instructions in openstack_clean and openstack_snapshot, removes clean flags in testcases.yaml and updates the related utils. All Docs are modified as well. JIRA: FUNCTEST-438 Change-Id: I8938e6255708012380389763a24059ace4ce45d8 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-29Protect against self.suite = NoneCédric Ollivier1-1/+5
Change-Id: Ie3370ebfdd51b9aff707e50b754ca52796e49fbf Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-23Rename the class TestSuiteRunner to SuiteCédric Ollivier1-1/+1
It conforms with [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/35211/ Change-Id: I11bbdcd63a1691835fb7c6198549edbaf6b758a1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-23Rename test_pytest_suite_runner.py to test_unit.pyCédric Ollivier1-0/+0
It conforms with [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/35211/ Change-Id: Ife7a161970997cf6cd74e86c343d4879f87b5cf4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-23Rename pytest_suite_runner.py to unit.pyCédric Ollivier1-6/+4
It also adds the rst files to include this module in apidoc. Change-Id: Iabbb17bc8601265bd9436c75d1afc0b470df1eb4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-22Merge "Update test_vnf.py to support py3"valentin boucher1-2/+2
2017-05-22Update test_vnf.py to support py3Cédric Ollivier1-2/+2
Change-Id: I86dc83b1fc9205f7b8209d63e18439a7e05c646b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-19Fully cover pytest_suite_runner.pyCédric Ollivier1-6/+36
Change-Id: I766afb1d5c6ef53a5b551539662ee363ae8eadee Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-19Precise self.result in pytest_suite_runner.pyCédric Ollivier1-20/+32
It also adds the related unit tests. Change-Id: I8325bd9a55c69b229e3c48a9e64aa963e685e03d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-18Modify how to disable logging in unit test.Cédric Ollivier4-10/+6
Logs are only disabled when the unit tests are run from cmdline. It allows running them via pytest_suite_runner.py and printing their results to functest.log. You should notice that the unit test must disable the logger of the tested TestCase (e.g. testcase.TestCase.logger.disabled = 1). Otherwise false logs will be printed in console. Change-Id: Ic171e4575c8bab2e52db1897ae026b61a03b6247 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-16Merge "Fix one minor typo"Jose Lausuch1-1/+1
2017-05-16Merge "Additional Unit Tests for core modules"Jose Lausuch2-13/+180
2017-05-16Switch from generate_report to PrettyTableCédric Ollivier1-1/+0
run_tests.py now relies on PrettyTable as most of the openstack clients. generate_report.py and its related unit tests are simply removed. It sets padding_width=5 in testcase.py too to conform with run_tests.py. Now report is printed in every case. Change-Id: Id9ce93f984503f25d6a2150482f397853fa3dd64 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-15Fix one minor typoCédric Ollivier1-1/+1
Change-Id: Id17070985adfbe7817f3be25b47f583cb9ef90b6 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-15Additional Unit Tests for core modulesashishk19942-13/+180
This patch adds unit tests for vnf and pytest_suite_runner. It also fixes several pylint warnings/errors. Additional tests are required to check args values. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I75a829233481655c794402830e1da037ab7cdb8d Signed-off-by: ashishk1994 <ashishk.iiit@gmail.com>
2017-05-11Modify TestCase.__str__() to use PrettyTableCédric Ollivier1-2/+4
It adds PrettyTable as requirement even if it's already defined in OpenStack client dependencies. If the TestCase object is considered as invalid, it simply returns the default str. Change-Id: Iee788aef2a13694d9482560977cbbf21c7f2c967 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-10Merge changes from topic 'add_testcase_str'Morgan Richomme1-0/+33
* changes: Remove the former results in DB url Implement TestCase __str__()
2017-05-09Rename VnfOnBoardingBase to VnfOnBoardingCédric Ollivier1-2/+2
Change-Id: I514340fc6180e29b31ef11bdea9f719aa2bbb738 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-09Rename vnf_base to vnfCédric Ollivier1-3/+3
Change-Id: I0b8b9b2e85717fc92a233e4f7344b3419421778d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-06Implement TestCase __str__()Cédric Ollivier1-0/+33
It's designed to be called by run_tests.py when printing the results of test cases and when generating the global report. Change-Id: If4a6f023ef2344bbc4f940d07dde4b776dce5d68 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-05Rename TestCase check_result() to is_successful()Cédric Ollivier1-8/+8
Change-Id: I41cea33b4c1dae79e75231e7c7e069fc89736f34 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-05Print the real testcase durationCédric Ollivier1-1/+28
TestCase offers a new public method to calculate and print the duration. It also adds the related unit tests and adapts run_tests.py. Change-Id: Ib6a7e637dafacb9027146199aeb033c2dcb986c6 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-05Replace project_name by case_name in result file nameCédric Ollivier1-1/+1
It avoids erasing functest.log when project_name = functest. Change-Id: Icae898abb8b51c89b79bb1124adfadab8b0b3b99 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Manage criteria in TestCaseCédric Ollivier2-11/+62
It converts all criteria values to the corresponding percent in functest/ci/testcases.yaml. Result is expected to be equal or greater than criteria. If both are 0, result is considered as false. It is compatible with the old behavior but warns to update. It will allow a safer remove. It also fixes a bug in test_tempest to allow merging [1] and tier_handler.py which required that type criteria was str. [1] https://gerrit.opnfv.org/gerrit/#/c/27949/ Change-Id: Ib6edcfa3103b7d51b0bdc83119f1cea2a8be9fbc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Switch TestCase attribute criteria to resultCédric Ollivier3-17/+17
It mainly avoids mixing input and output. Criteria is now an input set in functest/ci/testcases.yaml and then must be passed as __init__() args (which will be proposed in an additional change). Then it also renames the related TestCase method to check_result(). Change-Id: Ifc3c8e3ea6cde7e3edf7174bed4bf2bf0894e8e3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-14Remove deprecated feature modulesCédric Ollivier1-5/+19
All features running bash programs are now simply defined in testcases.yaml. All deprecated modules and unit tests are removed. Change-Id: I7047b6f7a1e43cb8ed5ba2d569d5dcecae68fb86 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-12Refactor the Feature frameworkCédric Ollivier1-75/+51
run() returns the expected status code (see following JIRA tickets). repo, pre() and post() are removed as they were quite useless. A dedicated class is proposed for bash programs. Unit tests have been added to fully cover this module. All features have been modified to conform with these modifications. It also removes the decorators which skipped several unit tests. JIRA: FUNCTEST-778 JIRA: FUNCTEST-779 JIRA: FUNCTEST-780 JIRA: FUNCTEST-781 Change-Id: Ifb1e4c4f68260a4e20d895f67f07f369ca959374 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-11Modify TestCase constructor attributesCédric Ollivier1-5/+6
Every feature/testcase now allows receiving the data defined in testcases.yaml as args (name is renamed to case_name). From the time being, only project and case names are handled. Next pending patches will add criteria, cmd and repo to this list. It keeps the default values for case names except for features which will be aggregated into Feature. Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>