summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge "download method shouldn't download all object"Jenkins2016-03-021-0/+16
|\
| * download method shouldn't download all objectHu Bing2016-03-011-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in python-swiftclient/swiftclient/service.py, there is a method def download(self, container=None, objects=None, options=None): if container is specified but objects not, it download all objects in specified container. if both container and objects are specified, it download all specified objects in the container. when it comes to the case that, objects argument is specified, but it turned out to be empty array [ ], the download method download all the objects under specified container. this may be not reasonable. for example, the objects was not empty when it came from command line, but it's filtered, maybe by --prefix argument. at last, it turned out to be empty array. when calling download method with objects arguments being empty array, we should download nothing instead of all the objects under the specified container. Change-Id: I81aab935533a50b40679c8b3575f298c285233a8 Closes-bug: #1549881
* | Merge "Drop testtools from test-requirements.txt"Jenkins2016-03-018-121/+114
|\ \
| * | Drop testtools from test-requirements.txtTim Burke2016-02-128-121/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Fix wrong args for get_container with full listing"Jenkins2016-02-291-0/+22
|\ \ \
| * | | Fix wrong args for get_container with full listingAlistair Coles2016-02-221-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In client get_container(), when full_listing is true, the calls back to get_container() pass service_token as a positional arg which maps its value to the full_listing arg. It should use a keyword. Change-Id: Iac2af45df124ff33fcb7fbaf1ba959ef06c96378 Closes-Bug: #1496093
* | | | Merge "Force header keys/values to bytes/unicode before coercing to unicode"Jenkins2016-02-271-2/+5
|\ \ \ \
| * | | | Force header keys/values to bytes/unicode before coercing to unicodeTim Burke2016-02-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, parse_header_string was only called with data coming out of requests, which would be either bytes or unicode. Now that we're sending it request headers as well (see related change), we need to be more defensive. If the value given is neither bytes nor unicode, convert it to a native string. This will allow developers using the client API to continue sending header dicts like {'X-Delete-After': 2} ...as in Swift's test/probe/test_object_expirer.py Change-Id: Ie57a93274507b184af5cad4260f244359a585f09 Related-Change: I43dd7254f7281d4db59b286aa2145643c64e1705
* | | | | Fix test for redacting sensitive data in client.http_log()Joel Wright2016-02-261-9/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test should have included utf8 encoded unicode data to test that encoded unicode data stored in headers was parsed correctly. Also fixes the docstring for swiftclient.safe_value() Change-Id: Id0def0b3af7a364f1257cc22f67b71c0cc5d8479
* | | | Follow-up to patch 282363Tim Burke2016-02-251-1/+1
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | * Improve some formatting * Be more explicit about how much will be revealed when * Rename redact_sensitive_tokens to redact_sensitive_headers, as it affects more than tokens. Change-Id: I02b375d914e9f0a210d038ecb31188d09a8ffce3
* | | Do not reveal auth token in swiftclient log messages by defaultJoel Wright2016-02-221-2/+74
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the swiftclient logs sensitive info in headers when logging HTTP requests. This patch hides sensitive info in headers such as 'X-Auth-Token' in a similar way to swift itself (we add a 'reveal_sensitive_prefix' configuration to the client). With this patch, tokens are truncated by removing the specified number of characters, after which '...' is appended to the logged token to indicate that it has been redacted. Co-Authored-By: Li Cheng <shcli@cn.ibm.com> Co-Authored-By: Zack M. Davis <zdavis@swiftstack.com> Change-Id: I43dd7254f7281d4db59b286aa2145643c64e1705 Closes-bug: #1516692
* | Merge "_RetryBody doesn't need to take explicit etag/content-length"Jenkins2016-02-181-0/+52
|\ \
| * | _RetryBody doesn't need to take explicit etag/content-lengthTim Burke2016-01-111-0/+52
| | | | | | | | | | | | | | | | | | | | | Also, don't try to do int(None) for chunk-encoded responses (like DLOs that are longer than a single container listing). Change-Id: Ibacd75d5ee46135d62388786903c895fda8ed3ba
* | | Merge "Display proper name when failing to create segments container"Jenkins2016-02-171-0/+48
|\ \ \ | |_|/ |/| |
| * | Display proper name when failing to create segments containerTim Burke2016-02-101-0/+48
| | | | | | | | | | | | | | | | | | Previously, we displayed the base container's name. Change-Id: I70f1949a44ba61158e31178e4536f229c37aab47
* | | Merge "Add test for --debug taking precedence over --info"Jenkins2016-02-111-1/+19
|\ \ \
| * | | Add test for --debug taking precedence over --infoAlistair Coles2016-02-111-1/+19
| | | | | | | | | | | | | | | | Change-Id: Ibf0903817852edb36389028383a35e0d65f88a26
* | | | Merge "Fix debug and info option parsing"Jenkins2016-02-111-0/+15
|\ \ \ \ | |/ / /
| * | | Fix debug and info option parsingChristian Schwede2015-12-301-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The debug and info options need to be set before a subcommand method is called, otherwise they are simply ignored. This is kind of irritating - other options (for example -U, -A, -K) are usable after a positional command. This patch fixes this, and commands like these are no longer ignoring --debug or --info: swift stat --debug swift list container --info Co-Authored-By: Alistair Coles <alistair.coles@hpe.com> Change-Id: Ib19b05deef7a015881f1eed4a3946025e16bf922
* | | | Merge "Support --os-identity-api-version option"Jenkins2016-02-111-9/+95
|\ \ \ \ | |_|/ / |/| | |
| * | | Support --os-identity-api-version optionAlistair Coles2016-02-051-9/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the auth-version to be specified using --os-identity-api-version or OS_IDENTITY_API_VERSION for compatibility with other openstack client command line options. The auth version used will be selected as follows: - if either --auth-version or --os-identity-api-version is set, use that value - otherwise use the value of ST_AUTH_VERSION, if set - otherwise use the value of OS_AUTH_VERSION, if set - otherwise (new behaviour) use the value of OS_IDENTITY_API_VERSION, if set - otherwise default to 1.0 Note that before this change the auth version might have defaulted to 1.0 despite OS_IDENTITY_API_VERSION being set, but with this change OS_IDENTITY_API_VERSION is preferred. Change-Id: Ifba4c4e43560ede3013337b8cdbc77dc2de6e8ff Closes-Bug: #1541273
* | | | Merge "more tests for pseudo/dir"Jenkins2016-02-101-7/+24
|\ \ \ \
| * | | | more tests for pseudo/dirClay Gerrard2016-02-091-7/+24
| | | | | | | | | | | | | | | | | | | | Change-Id: Idab172aefd8e69ca8e4d623918eba1bc1da91a42
* | | | | Merge "Fix segmented upload to pseudo-dir via <container>"Jenkins2016-02-102-2/+38
|\ \ \ \ \ | |/ / / /
| * | | | Fix segmented upload to pseudo-dir via <container>James Nzomo2016-02-042-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix ensures creation and use of the correct default segment container when pseudo-folder paths are passed via <container> arg. Change-Id: I90356b041dc9dfbd55eb341271975621759476b9 Closes-Bug: 1532981 Related-Bug: 1478210
* | | | | Merge "Accept token and tenant_id for authenticating against KS"Jenkins2016-02-102-5/+10
|\ \ \ \ \
| * | | | | Accept token and tenant_id for authenticating against KSPratik Mallya2016-01-182-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow swiftclient to authenticate against keystone using tenant name/id and token only. Without this patch, the password is required, which may not always be available. Authentication against keystone is required to get the service catalog, which includes the endpoints for swift. Change-Id: I4477af445474c5fa97ff864c4942f1330b59e5d6 Closes-Bug: #1476002
* | | | | | Merge "Fix intermittent fail of test_delete_bulk_account"Jenkins2016-02-041-16/+25
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | |
| * | | | | Fix intermittent fail of test_delete_bulk_accountAlistair Coles2016-02-011-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test asserts calls made in specific order, but they are made from threads so may be in different order. Change-Id: I857ad3b909c3b635927fb1a39682d66d20c6fd59
* | | | | | Merge "Fix intermittent fail of test_delete_account"Jenkins2016-02-011-8/+10
|\ \ \ \ \ \
| * | | | | | Fix intermittent fail of test_delete_accountAlistair Coles2016-02-011-8/+10
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test asserts calls made in specific order, but they are made from threads so may be in different order. Change-Id: I1b6e7303fe0e6fb2afc7da3462b891feab90bc17 Closes-Bug: #1539536
* | | | | | Merge "Don't trust X-Object-Meta-Mtime"Jenkins2016-02-011-0/+91
|\ \ \ \ \ \
| * | | | | | Don't trust X-Object-Meta-MtimeTim Burke2016-01-291-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Still use it if we can, but stop throwing ValueErrors if it's garbage. Change-Id: I2cf25b535ad62cfacb7561954a92a4a73d91000a
* | | | | | | Merge "Tighten up to unittests to expect rounding"Jenkins2016-02-011-7/+7
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | |
| * | | | | | Tighten up to unittests to expect roundingClay Gerrard2016-01-291-7/+7
| |/ / / / / | | | | | | | | | | | | | | | | | | Change-Id: Ic453fd990ebbf17e0eeabc39b126d2bc14234e23
* | | | | | Merge "Prevent test runs from cluttering current directory"Jenkins2016-01-291-35/+52
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Prevent test runs from cluttering current directoryTim Burke2016-01-191-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the following empty directories would be created: * container * container/pseudo * pseudo Change-Id: I002e2da8d28a873728e0b5c2d33f94f21132d058
* | | | | | mock time in unit testOndřej Nový2016-01-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's crashing now (sometimes): _StringException: Traceback (most recent call last): File "/build/python-swiftclient-2.6.0/tests/unit/test_service.py", line 1085, in test_upload_object_job_stream self.assertAlmostEqual(mtime, expected_mtime, delta=0.5) File "/usr/lib/python3/dist-packages/unittest2/case.py", line 883, in assertAlmostEqual raise self.failureException(msg) AssertionError: 1453224313.0 != 1453224312.4944572 within 0.5 delta Change-Id: Ib2eeb13cd07febcb7c8b4e1435b885c4339093e4
* | | | | | Merge "Error with uploading large object includes unicode path"Jenkins2016-01-281-0/+68
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | |
| * | | | | Error with uploading large object includes unicode pathJude Job2016-01-181-0/+68
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch include a test case to test unicode path. Change-Id: I7697679f0034ce65b068791d7d5145286d992bd1 Closes-Bug: #1532096
* | | | | Merge "Convert http response(byte string) to string in python3."Jenkins2016-01-221-0/+21
|\ \ \ \ \
| * | | | | Convert http response(byte string) to string in python3.Charles Hsu2015-09-061-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid a TypeError exception in python3. Change-Id: I4039e3f2a88b5f681288b5ca8dd5c63c13b7764f Closes-bug: #1457012
* | | | | | Merge "Use bulk-delete middleware when available"Jenkins2016-01-223-7/+232
|\ \ \ \ \ \
| * | | | | | Use bulk-delete middleware when availableTim Burke2016-01-123-7/+232
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When issuing `delete` commands that would require three or more individual deletes, check whether the cluster supports bulk deletes and use that if it's available. Additionally, a new option is added to the `delete` command: * --prefix <prefix> Delete all objects that start with <prefix>. This is similar to the --prefix option for the `list` command. Example: $ swift delete c --prefix obj_prefix/ ...will delete from container "c" all objects whose name begins with "obj_prefix/", such as "obj_prefix/foo" and "obj_prefix/bar". Change-Id: I6b9504848d6ef562cf4f570bbcd17db4e3da8264
* | | | | | Get rid of FakeConn cruftTim Burke2016-01-181-18/+0
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Presumably, this was left over from before the httplib -> requests transition? Change-Id: I7f505514070bf9d8fefda77203bee78f0a5dd71d
* | | | | Merge "Retry file uploads via SwiftService"Jenkins2016-01-122-18/+70
|\ \ \ \ \
| * | | | | Retry file uploads via SwiftServiceTim Burke2016-01-112-18/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we introduced LengthWrapper, we neglected to make it resettable. As a result, upload failures result in errors like: put_object(...) failure and no ability to reset contents for reupload. Now, LengthWrappers will be resettable if their _readable has seek/tell. Related-Change: I6c8bc1366dfb591a26d934a30cd21c9e6b9a04ce Change-Id: I21f43f06e8c78b24d1fc081efedf2687942e042f
* | | | | | Merge "Fix upload to pseudo-dir passed by <container> arg"Jenkins2016-01-111-1/+19
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | |
| * | | | | Fix upload to pseudo-dir passed by <container> argJames Nzomo2016-01-041-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix makes it possible to upload objects to pseudo-folders by passing the upload paths via <container> arg regardless of whether the container or folder path exist or not. Change-Id: I575e58aa12adcf71cdaa70d025a0ea5c63f46903 Closes-Bug: #1478210 Partial-Bug: #1432734 Related-Bug: #1432734
* | | | | | Retry download of object bodyStuart McLaren2016-01-082-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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