aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/utils/test_functest_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2023-03-13test_openstack_version14 -> test_openstack_version15Cédric Ollivier1-6/+6
Change-Id: Ia5eca43e3fc1d02eb187dd5ac0b37953d0d2fb82 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2023-03-13Detect OpenStack ZedCédric Ollivier1-0/+16
Change-Id: I3b0c9e030f2d31a6151d9ba44f2a06a627b3d913 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-11-15Update linters and fix all new issuesCédric Ollivier1-7/+9
It mostly add encoding in open calls and leverage f-strings. Change-Id: Ifead18fc724a452c1067dcf91dc577032edc9c59 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-08-18Update to Alpine 3.14Cédric Ollivier1-16/+17
It also fixes lots of new pylint warnings. Change-Id: I3376aee5649596c53bc2941ad4d8e0674a2967fe Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-05-17Detect OpenStack ussuriCédric Ollivier1-0/+16
Change-Id: I645913aba06fc87a89fbb5a1a7c090777ca1be7f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-09-29Detect OpenStack TrainCédric Ollivier1-0/+8
It takes into account latest max nova microversions [1] [1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html Change-Id: Icb9838b09ad22f6e87e9d8fb3c47525bdc1e3307 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-07-27Switch to Python 3.7 and Alpine 3.10Cédric Ollivier1-2/+2
It also allows building docs as doc8 is broken due to latest OpenStack's upper-constraints. pylint is updated to 2.3.1 (lastest py3.7 version) It disables perm as umask is currently false on lf-virtual1. Change-Id: If09d4796d48b7d0591e7926621d3bbf5ca1b6c24 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-05-25Set utf-8 in decode and encode callsCédric Ollivier1-4/+4
It eases backporting in iruya and hunter as a few logs can't be decoded as ascii [1]. [1] https://build.opnfv.org/ci/job/functest-opnfv-functest-vnf-iruya-juju_epc-run/56/console Change-Id: I52a6f9a25130cbf62e8ce3b9972064ab73177665 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-05-13Update to Python3Cédric Ollivier1-55/+25
Functest containers leverage on Python3 instead of python2. https://mail.python.org/pipermail/python-dev/2018-March/152348.html It also updates robotframework librairies to latest release and Vmtp to master ([1] is needed) It patches cloudify rest client to support python3. Vmtp is currently disabled because it currently supports python2 only. [1] https://github.com/openstack/vmtp/commit/a5d062881d91bf4f547d92c6e289bea30feb5d6e#diff-b4ef698db8ca845e5845c4618278f29a Change-Id: I39964a212ec2d4dbf53c9ea7c63f02e0b6a05b48 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-04-20Add Stein in Nova API microversionsCédric Ollivier1-0/+8
Change-Id: I42e854122fde9495cb3472ccc78900eccb20670d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-10-15Ease configuring extra specs via env varsDelia Popescu1-0/+3
Ease configuring flavor extra specs, as well as image extra specs. Set environment variables for image_properties and flavor extra_specs for ovs|fdio scenario from the start. Image extra_properties and flavor extra_specs will continue to get updates from functest config file but so will from IMAGE_PROPERTIES and FLAVOR_EXTRA_SPECS env variables. Change-Id: Ie1c69e66d2e2e158915d214402fe44d9991c56d3 Signed-off-by: Delia Popescu <delia.popescu@enea.com>
2018-10-14Fix image properties parsingCédric Ollivier1-0/+41
It removes useless spaces and now conforms with oslo.conf dict. New helpers and unit tests are available. Change-Id: I20335c5e5c3840cc872e158c6072d97a3f2cb98c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-09-14Update get_openstack_version()Cédric Ollivier1-2/+2
It takes Rocky maximum version into account. Change-Id: I55469de4a63f1f824222660130a20d7fd8fa42c3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-07-21Add helpers to detect OpenStack versionsCédric Ollivier1-1/+121
It leverages on Nova API Microversions [1]. [1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html Change-Id: I60abf9089036e56fcbcd6c2b734666ea20875ceb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-06-30Inherit rally from VmReady1Cédric Ollivier1-66/+0
It also fixes clean(). Change-Id: I42d1305d5cdb5a717cfa7fce26798ac7102310f7 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-05-05Implement get_external_network via shadeCédric Ollivier1-0/+66
It fixes the current issues as EXTERNAL_NETWORK is mainly unset by all Installers [1]. [1] https://build.opnfv.org/ci/view/functest/job/functest-fuel-armband-baremetal-arm-daily-fraser/31/console Change-Id: I8ee62623701c15b9ff962d0a0e07a77934ff03ac Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-03-11Fix many pylint warningsCédric Ollivier1-8/+10
Only pylint warnings in vnf modules has to be fixed now. Change-Id: Ie71230072a51bb72ec0b1d4fef2652494d29948e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-26Remove obsolete Functest utilsCédric Ollivier1-85/+2
Only 3 functions are kept as part of our framework: - execute_command_raise() - execute_command() - get_parameter_from_yaml() Change-Id: I966a1d6122391dae85aa3c77813ad2f1698ceb45 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-16Get properly env vars or their default valuesCédric Ollivier1-1/+1
It defines env.get() as an unique way to get Functest env vars or their default values. It can be considered as a wrapper above os.environ. It enforces backward compatibility via CONST which mustn't be used for that purpose. It should be noted that it also stops using CONST for getting OpenStack env vars. Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-09Move get_dict_by_test() into run_tests.pyCédric Ollivier1-28/+0
It also removes functest_utils.get_criteria_by_test() Change-Id: I3f265642acd053755e32f8e92f1086b93517c247 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-26Fix pylint errors in several utils modulesCédric Ollivier1-6/+6
All utils which are moving to xtesting are now fixed. It remains OpenStack and Functest utils (+ the related unit tests) which doesn't move to the new package. Change-Id: If13c627c8444c62d5c6bf9c8057d6413aa0e56c7 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-21Disable all missing-docstring warnings in unit testsCédric Ollivier1-0/+2
Change-Id: I22b7bbdab5f000b4ade6c2ba3a4029c146887cbd Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-21Move push_results_to_db to TestCaseCédric Ollivier1-100/+3
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-20Remove logger_test_resultsCédric Ollivier1-32/+0
It was only called in Feature which the result is already printed (see __str__()). It also eases moving Feature to xtesting as it breaks the link to functest_utils. Change-Id: Ib72d651dc7d89598704ff4d52d8b1ecb2bdade5b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-08-29Remove get_installer_typeLinda Wang1-17/+0
JIRA: FUNCTEST-763 Change-Id: Ib05f699063393eb6eaa9f559854aca50b77aead3 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-28Obtain scenario by CONST instead of get functionLinda Wang1-23/+3
JIRA: FUNCTEST-763 Change-Id: Ic9fa3243b50a09de8a5e531fed8298997367dd84 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-17Obtain pod_name by CONST instead of get functionLinda Wang1-23/+3
JIRA: FUNCTEST-763 Change-Id: Id334745a1eac8b933d77f9cb36a506a02366d760 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-15Obtain build_tag by CONST instead of get functionLinda Wang1-32/+10
JIRA: FUNCTEST-763 Change-Id: I86b0b515a3d51df20a35c2aeb461a95d0c5797fd Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-06-20Remove all references to /home/opnfv/repos/functestCédric Ollivier1-13/+1
It also removes relative (and incomplete) references which could be defined in modules instead of this global configuration. Change-Id: Ie20dc3547e49b6224aa8100cd380d37b87ece5a9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-19Stop getting git data from functest dirCédric Ollivier1-22/+0
Functest is no longer a git clone. Change-Id: Ieaceacaa820e9a7a3c64e8c1fbd2a8a9321f234d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-19Remove module references __file__Cédric Ollivier1-2/+3
It allows functest to be run directly from a zip file [1]. [1] https://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag Change-Id: I596a71e8cf2bed6dd79655bd5beeb047876a188c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-01Use CONST to retrieve db_url rather than getter functionLinda Wang1-43/+27
1. Remove get_db_url() 2. If TEST_DB_URL declared in env, update test_db_url in config_functest.yaml file during env preparation 3. No matter TEST_DB_URL declared in env or not, Result_DB = CONST.__getattribute__("results_test_db_url") JIRA: FUNCTEST-763 Change-Id: I20da7ef98bbcc56731e0ff7061b05c1dde6cbfc3 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-05-23Stop printing in console when testing functest_utils.pyCédric Ollivier1-6/+4
Change-Id: I6fa0f6f449270199cc4d5b2c88e171091bf92773 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-19Set default value for CONFIG_FUNCTEST_YAMLCédric Ollivier1-1/+2
It calculates via the full path of env.py. Change-Id: Ief958833f5116cdb116d0153d85a0ae03063ec5c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-19Merge "Modify how to disable logging in unit test."Jose Lausuch1-2/+1
2017-05-18Modify how to disable logging in unit test.Cédric Ollivier1-2/+1
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-18Remove check_success_ratejose.lausuch1-16/+0
After the introduction of is_successful method in TestCase class, this is not needed anymore. Change-Id: I70f6f9e10495601cd5443467347b97efe27b81a3 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-05-17Update self.result value to INTjose.lausuch1-2/+2
So far, the test cases are storing a string "PASS" "FAIL" in the self.result variable. The way the new framework works is with INT Values. Change-Id: I45e8693327740faadd8254b21569adfb2cefa6c8 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-05-17Add Python3 support to the ODL testcaseCédric Ollivier1-16/+18
It also adds this support to its dependencies. Change-Id: I0534f0c7b0e15a9ee89f522f314cf5200874454c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Manage criteria in TestCaseCédric Ollivier1-5/+4
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 Ollivier1-4/+5
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-11Modify TestCase constructor attributesCédric Ollivier1-1/+2
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-03-20bug fix: version not retrieved on weekly jobsMorgan Richomme1-19/+0
a first fix had been done but the version was retrieved 2 times with the regex this patch removes the second regex and re-use get_version the associated unit tests has been removed because even if the build_tag is badly formated, it will not prevent the results to be pushed with version = unknown JIRA: FUNCTEST-765 Change-Id: I2cbe8ba1dd7278c3f3510a47c667c433f65e00f8 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-03-17Bug Fix: retrieve version from build tag in weekly jobsMorgan Richomme1-1/+12
- fix regex issue - add unit test to cover weekly and dummy build tags - remove useless logs JIRA: FUNCTEST-765 Change-Id: I7a8d40b4662f4557cd080669da46fb1c32d2ad6d Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-03-15env variable support for test DB urlMorgan Richomme1-1/+11
So far DB url was retrieved from configuration file If you want to use the CI chain (jenkins, testapi, test DB, functest, ..) then you have a problem calling functest will systematically point to the configuration from the repo Supporting env variable allow to avoid post processing in the configuration file and as a consequence offer the possibility to create a local DB to host local results Change-Id: Ie64b8b265827d7f5724c7066a8c173de8cf012e2 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-02-06Change log level when pod, scenario or build_tag cannot be retrievedMorgan Richomme1-16/+18
when using Functest out of CI, such env variables may not be set This shall not result in Error messages JIRA: FUNCTEST-716 Change-Id: I86d2023145480dfa9c8d593ea274acbd9e431ef7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-01-19Leverage logging config and refactor the loggerhelenyao1-1/+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-04Patch logging.FileHandlerCédric Ollivier1-0/+1
It avoids creating a dummy functest.log for unit testing. Change-Id: Ib163d5d58284822b1904444fb60b08e92ee0ab9b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-01-02Added unit tests for utils/functest_utils.py.ashishk19941-0/+599
JIRA: FUNCTEST-683 Change-Id: I181d98847b2ca94ce84a670239b8a958bfae44cd Signed-off-by: ashishk1994 <ashishk.iiit@gmail.com>