aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/core
AgeCommit message (Collapse)AuthorFilesLines
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>
2017-04-04Add unit tests for featureCédric Ollivier1-0/+108
They partially cover feature but already highlight bugs. Several tests are skipped to allow merging. Their decorators could be removed as soon as feature is fixed. I think bad-continuation is false positive so it's disabled (pep8 and flake8 return ok). JIRA: FUNCTEST-779 Change-Id: I89b9e2ec0388eea2471d941b2c653deca7fbddf6 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-04Add case_name as constructor argCédric Ollivier2-7/+11
It allows managing multiple TestCase names with only one TestCase module. It is mainly required by odl which implements: - odl, - odl_netvirt, - fds. It also renames case to case_name in Features to conform with TestCases. JIRA: FUNCTEST-762 Change-Id: Ie254f754a0ea3077a8afda1c470528d38c79478f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-28Fully fix pylint warnings in test_testcaseCédric Ollivier1-0/+7
It partially takes into account missing-docstring. It is disabled for public methods as they are unit tests. It has been rated at 10.00/10. Change-Id: I70e6729b9228d58cc67a18da29b925dad22cf5bd Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-28Rename test_testcase_base to test_testcaseCédric Ollivier1-0/+0
It follows "Rename testcase_base to testcase" [1] [1] https://gerrit.opnfv.org/gerrit/#/c/31879/ Change-Id: I54bb62a37bdab842f433790688128a459b0ac78c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-27Rename testcase_base to testcaseCédric Ollivier1-10/+10
It simply removes the useless suffix. Change-Id: Ib9a682b57d8f33518359d817a593bb3786577390 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-27Switch TestcaseBase to TestCaseCédric Ollivier1-10/+10
It partially reverts "Rename TestCasesBase into TestcaseBase" [1] and removes the useless suffix too. [1] https://gerrit.opnfv.org/gerrit/#/c/25391/ Change-Id: Iddf2ec8d6c1dafe6e4c6713c2e69969613317471 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-26Fix pylint warnings in test_testcase_baseCédric Ollivier1-5/+6
It takes into account the following warnings: - wrong-import-order - no-value-for-parameter The 'no-value-for-parameter' warnings are false positive. The added default values are useless but avoid them. Change-Id: I50d0af178d9da668a3c72e75f5af467d36ca0e6a Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-20[vnf_base] improve exceptionboucherv1-13/+9
Return on part of previous changes in commit: 30257 https://gerrit.opnfv.org/gerrit/#/c/30257/ Change-Id: I11b33ee2a6f9d4cbcf1449006b47be508fce655e Signed-off-by: boucherv <valentin.boucher@orange.com>
2017-03-10Remove raise exceptionsMorgan Richomme1-8/+13
until exceptions are better managed in abstraction Currently it triggers an exit from the jenkins job and prevent other tests to be run Change-Id: Id3b18c1d6d3b786fc78456b3ad51963d2cbb2cc1 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-02-14Merge changes from topic 'revert_write_to_file'Jose Lausuch1-5/+3
* changes: Add can_dump_request_to_file decorator Revert "write test results to a local file"
2017-02-14Fix again unix permissionsCédric Ollivier1-0/+0
It has been induced by [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/26695/ Change-Id: I4bec6bdc30c5901c19bdc4ca43b89f60bd50a6aa Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-02-13Revert "write test results to a local file"Cédric Ollivier1-5/+3
This reverts commit ee21af78fbfc93e888acda121f08d2b216dd0159. Change-Id: If7c8d3b645073574862eb67225b1e11b0dd7a021 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-01-19Leverage logging config and refactor the loggerhelenyao1-2/+0
JIRA: FUNCTEST-690 The detailed benefits are listed in the JIRA description. 1. Refactored the functest_logger to make use of configuration file 2. Avoided configuring the logging every time a logger is initialized 3. Applied separate logging configuration fo unit test by removing saving log to file Change-Id: I6e27eaba727ae6d704f0301f15359dc3ea7b2f97 Signed-off-by: helenyao <yaohelan@huawei.com>
2017-01-19Merge "write test results to a local file"Morgan Richomme1-3/+6
2017-01-18Merge "Add VnfOnBoarding Abstraction"Jose Lausuch1-0/+52