summaryrefslogtreecommitdiff
path: root/tests/functional/test_swiftclient.py
Commit message (Collapse)AuthorAgeFilesLines
* Rename "tests" directory to be "test" like in the swift repoTim Burke2019-11-061-557/+0
| | | | | | | | | | | | | In addition to being less confusing for devs, this lets us actually run tempauth tests in swiftclient dsvm jobs. The job definition (over in the swift repo) specifies test/sample.conf, which does not exist in this repo. As a result, those tests would skip with SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG Change-Id: I558dbf9a657d442e6e19468e543bbec855129eeb
* Fix up requests so we can send non-RFC-compliant headers on py3Tim Burke2019-07-251-0/+17
| | | | Change-Id: I3dac826c1f208569c5f40431f59a2045e5744415
* Isolate docs requirementsTim Burke2019-06-271-14/+28
| | | | | | | | | | | ...since modern sphinx won't install on py27. While we're at it, clean up some warnings and treat warnings as errors. Also, fix up how we parse test configs so we can run func tests. Related-Change: Id3c2ed87230c5918c18e2c01d086df8157f036b1 Change-Id: I3718f69610545b0dbcb0a2ab45b400da3a45682c
* Add delimiter to get_account().Timur Alperovich2018-11-301-0/+12
| | | | | | | Exposes the delimiter parameter, which the Swift API supports for container listings. Change-Id: Id8dfce01a9b64de9d1222aab9a4a682ce9e0f2b7
* Stop leaking quite so many connectionsTim Burke2018-11-091-0/+1
| | | | | | | | | | | | | | While investigating the failures when you move func tests to py3, I noticed a whole bunch of ResourceWarning: unclosed <socket.socket ...> noise. This should fix it. While we're at it, make get_capabilities less stupid. Change-Id: I3913e9334090b04a78143e0b70f621aad30fc642 Related-Change: I86d24104033b490a35178fc504d88c1e4a566628
* Remove some pointless codeTim Burke2018-06-221-6/+0
| | | | Change-Id: I3163834c330c5ea44c1096e83127588c88f0d761
* Merge "Make functests py3-compatible"Jenkins2017-01-241-15/+20
|\
| * Make functests py3-compatibleTim Burke2016-08-241-15/+20
| | | | | | | | Change-Id: I2b3bf17e874cf049eccab4c85ceac7da10d258ef
* | Use ConfigParser instead of SafeConfigParserPallavi2016-10-171-1/+1
| | | | | | | | | | | | | | | | | | The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions.So we can use ConfigParser directly instead. Change-Id: Ie0292271229ee77d1bc57dd897ebbbb3d3c059aa Closes-Bug: #1618666
* | Convert numeric and boolean header values to stringsTim Burke2016-08-251-1/+10
|/ | | | | | | | | | | | | | | Recently, requests got a bit more picky about what types of data it will accept as header values [1]. The reasons for this are generally sound; str()ing arbitrary objects just before pushing them out a socket may not do what the developer wanted/expected. However, there are a few standard types that developers may be sending that we should convert for them as a convenience. Now, we'll convert all int, float, and bool values to strings before sending them on to requests. Change-Id: I6c2f451009cb03cb78812f54e4ed8566076de821 Closes-Bug: 1614932
* Add copy object methodMarek Kaleta2016-08-231-0/+40
| | | | | | | | | | | Implement copy object method in swiftclient Connection, Service and CLI. Although COPY functionality can be accomplished with 'X-Copy-From' header in PUT request, using copy is more convenient especially when using copy for updating object metadata non-destructively. Closes-Bug: 1474939 Change-Id: I1338ac411f418f4adb3d06753d044a484a7f32a4
* Drop testtools from test-requirements.txtTim Burke2016-02-121-2/+2
| | | | | | | | | | | My understanding is that it was mainly being used so we could have sane testing on py26. With py26 support being dropped, we no longer need it. Also drop discover from test-requirements.txt, as we don't seem to actually use it. Change-Id: Iee04c42890596d3b483c1473169480a3ae19aac8 Related-Change: I37116731db11449d0c374a6a83a3a43789a19d5f
* Retry download of object bodyStuart McLaren2016-01-081-0/+52
| | | | | | | | | | | | | | | | | | | | | Currently the swift client retries establishing a connection to the server (by default up to 5 times). However, when downloading an object, once the connection has been established and the inital headers have been returned, no attempt is made to retry. So, for example, if 99MB of a 100MB object have been downloaded and the connection is then lost, the download will fail. This patch changes the behaviour to re-establish the connection and fetch the remaining bytes using the 'Range' header to offset. Data retry is not yet supported if the original request is for a subset of the object data (ie uses the 'Range' header), or if resp_chunk_size has not been set. The object's etag is checked using If-Match to make sure the object data hasn't changed since the start of the download. Change-Id: Iab47f10081ff39f6d344dbc2479cbc3bfd1c5b29
* Add functional test for object PUT with raw iteratorAlistair Coles2016-01-051-0/+15
| | | | | | | | Adds a functional test to verify change made in [1] [1] change id I19579ed7a0181ac3f488433e7c1839f7f7a040b8 Change-Id: I45dbf66edab645e6339e67906aee5faa4fb7efbd
* swiftclient content-type headerLisak, Peter2015-10-221-0/+34
| | | | | | | | | | | | According to help `swift upload -h` you can add a customized request header 'Content-Type'. But actually it is ignored (cleared and default is used) if subcommand is upload. Subcommand post works as expected in help. Bug fix: Use 'Content-Type' from the customized request headers also if uploading. Change-Id: If0d1354b6214b909527341078fe1769aa6587457
* Merge "Run functional tests using keystone auth options"Jenkins2015-07-021-4/+65
|\
| * Run functional tests using keystone auth optionsAlistair Coles2015-06-041-4/+65
| | | | | | | | | | | | | | | | | | | | | | | | Makes the existing functional tests run using three auth modes: tempauth (v1), keystone v2 and keystone v3. The latter uses an account in a non-default domain (which exists in devstack setup). This should help avoid regressions in handling different auth options. Change-Id: Ifee6a4fa418242892bf73eda5e2cad7b803b1bee
* | Merge "Allow reading from object body on download"Jenkins2015-06-041-3/+18
|\ \ | |/ |/|
| * Allow reading from object body on downloadStuart McLaren2015-03-241-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, get_object returns a generator. This allows access to the object's data in multiples of 'resp_chunk_size'. This patch adds a read function to also allow accessing the object data using read(size). This allows, for example, the consumer of an object (where no byte range has been specified) to read up to certain boundaries while streaming to a new Large Object with segments of a specified size. Reading and chunking can be safely mixed. Related-Bug: 1367925 Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com> Change-Id: I1cfb67f45afc7015fd896f1a89bebae048871769
* | Compare each chunk of large objects when uploadingTim Burke2015-03-231-3/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we compared the ETag from Swift against the MD5 of the entire large object. However, the ETag for large objects is generally the MD5 of the concatenation of the ETags for each segment, unless the object is a DLO whose segments span more than one page of a container listing. Rather than worry about ETags, just compare each chunk of the segmented file. This allows the use of --skip-identical when uploading SLOs and DLOs. Additionally, there are several test-related improvements: * The default arguments for OutputManager are now evaluated on construction, rather than on definition, so that TestOutputManager.test_instantiation will succeed when using nosetest as a test runner. (See also: bug 1251507) * An account_username option is now available in the functional tests config file for auth systems that do not follow the account:username format. * CaptureOutput no longer writes to the captured stream, and MockHttpTest now captures output. These were polluting test output unnecessarily. (See also: bug 1201376) Change-Id: Ic484e9a0c186c9283c4012c6a2fa77b96b8edf8a Closes-Bug: #1201376 Closes-Bug: #1379252 Related-Bug: #1251507
* Use skipTest from testtools instead of inherited ExceptionChristian Schwede2014-10-081-2/+1
| | | | | | | | | | SkipTest is raised if there is no func_test section in the Swift test config file. However, the currently raised Exception will result in a failed test, not in a test marked as skipped. Since we already use testtools we can use the included skipTest easily. Change-Id: I1bbb1f9dbe31fb0698d774550708d1196b266625
* Merge "Remove testtools.main() call from tests"Jenkins2014-05-241-5/+0
|\
| * Remove testtools.main() call from testsChristian Schwede2014-05-201-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no testtools.main() at all (this was a unittest.main() before). Let's remove this unused and non-working code. The following code can be used if someone needs to start tests manually: python -m unittest <test_file.py> Change-Id: Id5162ac73825584df6c23dbe68786ff3355fc6ae
* | Fix Python3 bugs2.1.0Christian Schwede2014-05-211-1/+1
|/ | | | | | | | | | | | | | | | | | | | This patch fixes three issues that were found running functional tests with Python 3: 1. python-requests sets 'application/x-www-form-urlencoded' as content-type if the input is not a string object and no content-type is given. 2. Encoding of the headers is now only done if required. This prevents comparisons between unencoded headers and encoded prefixes and avoids unnecessary forloop-iterations. One unittest was extended to ensure it works for unencoded and encoded headers with or without the prefix. 3. Functional tests recently switched to using byte data for testing, thus the comparison needs to be a byte object as well. Change-Id: I035f8b4b9c9ccdc79820b907770a48f86d0343b4
* Make the function tests Python3-import friendlyAlex Gaynor2014-05-071-6/+7
| | | | Change-Id: Ic73fc2a6f6712505eda71fa2e2e91ac680ced9a3
* Add functional tests for python-swiftclientChristian Schwede2014-05-051-0/+289
Coverage for swiftclient.client is 71% with these tests. Unit tests have been moved into another subdirectory to separate them from functional tests. Change-Id: Ib8c4d78f7169cee893f82906f6388a5b06c45602