summaryrefslogtreecommitdiff
path: root/tempest/tests/lib/common/utils
Commit message (Collapse)AuthorAgeFilesLines
* Retry on ServerFault in call_and_ignore_notfound_exc()Dan Smith2020-09-301-0/+11
| | | | | | | | This makes us tolerate up to three ServerFault errors while trying to do things like clean up resources during tearDown(). Change-Id: I3b2dac90fd6c71d66506d33aa5e35bb362d9bf87 Related-Bug: #1897907
* Use unittest.mock instead of third party mockSean McGinnis2020-05-172-2/+2
| | | | | | | | Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: If1de2f48da1fd6ed3f96c98b8dce9eace4f8095d Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Mark raw strings as suchStephen Finucane2018-07-061-1/+1
| | | | | | | This is raising warnings now and will be an error in future versions of Python 3. Change-Id: I8827cb36ef2ef85e8f245a2a181fb23ee75bfd16
* Fix tests for call_until_true function.Federico Ressi2018-06-061-45/+127
| | | | | | | | | | | | | | Unit tests for call_until_true function has to check if passed function is actually called expected number of times under two main cases: - when given func returns true before timeout - when given func never returs true before timeout It has to be tested also that given paramterers are passed when calling given function. Change-Id: I43009e18987c73be2412db10dc605e4fc6661d97
* Add support of args and kwargs in call_until_truezhufl2017-11-141-3/+24
| | | | | | | | | | | | | | | Now call_until_true doesn't accept args and kwargs, so if want to call a callable with parameters, we have to do like this(test_network_v6.py): srv1_v6_addr_assigned = functools.partial( guest_has_address, sshv4_1, ips_from_api_1['6'][i]) self.assertTrue(test_utils.call_until_true(srv1_v6_addr_assigned, CONF.validation.ping_timeout, 1)) So this is to add support of args and kwargs in call_until_true, and to log the cost time when call_until_true returns True or False for debugging. Change-Id: Ib7a392f1a3999c2f2bd3cccaf2fd356cd7879950
* Fix AssertionError in test_rand_password_with_len_2Masayuki Igawa2017-11-021-1/+5
| | | | | | | | | | | | This commit fixes the AssertionError in test_rand_password_with_len_2. We were thinking an error could be happened but it's really rare. However, it was actually happened[1]. To make the test more stable, we shouldn't check its value but only length. It should be enough because we already checked values in the other test cases. [1] http://paste.openstack.org/show/625330/ Change-Id: I9a11a56e5eee9d1b01b61c04ea4bc75037c4458e
* Remove method get_ipv6_addr_by_EUI64zhangxuanyuan2017-10-111-39/+0
| | | | | | oslo_utils.netutils provides same method get_ipv6_addr_by_EUI64 Change-Id: Ibc615d652be4594748188170764adb5d9fd0473b
* Fix RemoteClient having bad default ssh_shell_prologueKris Stercxk2017-08-221-1/+1
| | | | | Change-Id: I0e73b8deedf4bf78481cdf09b863dc149a70e9be Closes-Bug: #1707478
* Add RemoteClient under tempest.libKen'ichi Ohmichi2017-03-092-0/+67
| | | | | | | | remote_client under tempest.common is used in many projects but the module is not defined as stable. This patch adds the essential part of the module into tempest.lib as stable interface. Change-Id: Idb2206c239f25bc8b8530275e84c834233b9544b
* Deprecate resources_prefix and change rand_name()Ken'ichi Ohmichi2017-03-021-6/+10
| | | | | | | | | | | | Many projects are using rand_name() which is outside of tempest.lib. The method specifies the prefix 'tempest', which is the default value of tempest.conf, to tempest.lib's rand_name(). The prefix is useful to identify these resources are created by Tempest. No projects change this configuration value, so this patch changes the default value of rand_name() to 'tempest' and makes resources_prefix option deprecated. Change-Id: I624e2eb3954b6171fbbe00a4ed757bfac04b3eaf
* py3: Miscellaneous fixesSirushti Murugesan2016-09-091-3/+3
| | | | | | | | | | | | | | | | | * Use base64 from oslo_serialization * Use six.BytesIO instead of StringIO * Use sys.maxsize instead of sys.maxint * Use sorted with a key argument to sort by * Use range instead of moves.xrange or xrange * Use floor division instead of float division * Use 'r+' to open a file than 'rw' * Use six.int2byte instead of chr * Stop using conn.strict in response_class() * Tests: Only compare length for bytes, not assertRegex These changes are tested here: I3a1dfde76009cbac1d419e0ff3f1d20c4a2e99c3 Change-Id: Iab9c23e497956e45c5d04a3d6513acf1b026aafb
* Move `call_until_true` to tempest/libJordan Pittier2016-09-021-0/+25
| | | | | | | | | This `call_until_true()` is handy and could be used in Tempest plugins. Let's move it to tempest/lib. Also add some unit tests. Change-Id: Ie379030baa336239e6027c8f3cdbeb74c561f66b
* Do not use $ in regexguo yunxian2016-07-291-3/+3
| | | | | | | | | $ has been deleted in password, so it also needs to be deleted in regex. Associated Change-Id: Iebb211165c4deee09d34e19b5557a3e086add05a review link: https://review.openstack.org/#/c/346800/ Change-Id: I4e3196c26d81cf359686537d02550434b0b0e559
* Introduce new helper: call_and_ignore_notfound_exc()Jordan Pittier2016-05-282-36/+78
| | | | | | | | | | | | | | | | | This new function calls a function passed as parameter and ignore the NotFound exception if it raised. This removes some code duplication. Also a new `test_utils` module is introduced to tempest.lib and the `find_test_caller` function is moved into that new module. Backward compatibility and deprecation path are ensured and documented. Note for the future: having a module called "misc" is not optimal because the name is not super descriptive. (it's a detail though, but worth mentioning imo). Change-Id: I5a4523c20c19957bfccf2aa95157baf106b3d364
* Swift object client: use urllib3 builtin support for chunked transferJordan Pittier2016-05-251-0/+7
| | | | | | | | Urllib3 has native support for chunked encoding, so let's use this instead of rolling our own. Less code to maintain, additional logging and timing (thanks to our common RestClient). Yeah \O/. Change-Id: I4a253a5cec0fc35009af25872239363625d417e3
* Merge "Added random Infiniband GUID address generator"Jenkins2016-05-021-0/+9
|\
| * Added random Infiniband GUID address generatorLenny Verkhovsky2016-05-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Infiniband[1] technology uses GUID[2] address as 'analog' of the MAC. Adding GUID support to tempest-lib allows adding tempest tests or/and external tempest plugin tests to test this technology. For instance ironic tempest plugin[3]. More details about Infiniband Technology can be downloaded here[4]. [1]https://wiki.archlinux.org/index.php/InfiniBand [2]https://wiki.archlinux.org/index.php/InfiniBand#GUID [3]https://github.com/openstack/ironic/tree/master/ironic_tempest_plugin [4]http://www.infinibandta.org/content/pages.php?pg=technology_download Change-Id: I6129a94b1ea65d989c5fb549319d71ccac76d0a4
* | Fix base unit test class locationMatthew Treinish2016-04-222-2/+2
|/ | | | | | | | | | | | | | | | The recent commit I45d73891f3c0829a2378a032dfc02e5ac0ee34b7 deduplicated the base test class methods from the tempest.lib reintegration. However the surviving base class was put in the wrong namespace. The base class is just that a base to build the individual test subclass off of. It's very confusing for that to not live in the base tests namespace. While the code in lib is supposed to be self contained there isn't a reason to do that here for the unit tests, especially because in this case the import heiarchy becomes more confusing with the base living in a submodule. This commit moves the base class to the base tempest.tests namespace where it really belongs. Change-Id: I079eeb1135eed3254e5e9dbebac8a52b979303c7
* Fix PendingDeprecationWarning for assert*ghanshyam2016-03-111-12/+12
| | | | | | | This commit fix all PendingDeprecationWarning for assert* function in unit tests. Change-Id: If474d9feb7eeb277b2cbd1d1160c955c7da29ef3
* Migrate tempest-lib code into new lib dirMatthew Treinish2016-02-233-0/+250
This commit migrates all of the code from tempest-lib as of it's current HEAD, 6ad0ce42c2791a28125d38b40e7dcddf32dbeed7. The only changes made to the tempest-lib code is to update the imports and other references to tempest_lib. Since in it's new home it should be tempest.lib. Partially implements bp tempest-lib-reintegration Change-Id: Iadc1b61953a86fa9de34e285a0bb083b1ba06fa8