483 Commits

Author SHA1 Message Date
Jenkins
2a62dd88ff Merge "Document missing functional test config option" 2015-07-02 02:39:43 +00:00
Jenkins
795476e013 Merge "Run functional tests using keystone auth options" 2015-07-02 00:14:41 +00:00
Jenkins
f5fa154f6d Merge "Add passenv to tox.ini to make functests run with tempauth" 2015-07-02 00:14:38 +00:00
Jenkins
29e5c5656e Merge "Add connection release test" 2015-07-02 00:04:52 +00:00
Jenkins
0df888ea55 Merge "Remove all DLO segments on upload of replacement" 2015-07-02 00:04:50 +00:00
Tim Burke
70afe207cf Bump hacking in test-requirements
The gate-swiftclient-dsvm-functional job takes updates from
openstack/requirements and tries to run functional tests against them.
However, the global requirements recently added environment markers
(like "futures>=3.0;python_version=='2.7' or python_version=='2.6'")
which require pbr>=1.2. pbr was getting capped at 1.0 by hacking<0.9, so
bump it to get newer pbr.

Change-Id: I10af36602d23db78c2863d84c0012835b310bbdd
2015-07-01 11:11:53 -07:00
Clint Byrum
7c716997a8 Fix docstring typo for SwiftService.upload
The option from argparse in shell is 'header' and that is what is used
in the code.

Change-Id: I5c889192ef7c46c299dc0ec7cbc7c4d027dae6d5
2015-06-18 09:04:33 -07:00
Andreas Jaeger
e48f487335 Fix inconsistent usage of "Positional argument"
All help texts uses "Positional argument" with the exception of tempurl.
Update tempurl to use this as well so that the formatting tools work
fine and can show this nicely on
http://docs.openstack.org/cli-reference/content/swiftclient_commands.html#swiftclient_subcommand_tempurl
like it's done for other options.

Change-Id: Ib5502c23b236986bea5a4d4a63a46fca411a8494
Closes-Bug: #1463081
2015-06-08 20:20:21 +02:00
Christian Schwede
7f2ee7322b Add connection release test
This patch adds a small test to ensure a connection
is released after all chunks have been consumed.

It's a follow up to commit 8756591b and added to ensure
there will be no regression in the future (this test
fails also with that patch not applied).

Change-Id: I6a6fcd26879eb2070f418c8770a395ff6c30aa51
2015-06-05 07:17:31 +00:00
Alistair Coles
f0aad4c364 Run functional tests using keystone auth options
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
2015-06-04 12:54:43 +00:00
Jenkins
ec3e2ab3a0 Merge "Allow reading from object body on download" 2015-06-04 12:08:07 +00:00
Alistair Coles
259b434ae2 Add passenv to tox.ini to make functests run with tempauth
Since tox version 2.0.0 env vars are not passed to the test
env, which means that the SWIFT_TEST_CONFIG_FILE var is not
passed in to tox -e func env. That means that both times
tox -e func runs it is using keystone auth, and never using
tempauth.

Related-Bug: 1455102

Co-Authored-By: Christian Schwede <cschwede@redhat.com>

Change-Id: I23dcdbcde0bf8adc9429eb2d294a2c778005d136
2015-06-03 17:45:14 +01:00
Alistair Coles
f0cc3be2ac Make default get_auth timeout be None
Setting timeout to a default of False in get_auth()
results in a requests timeout of 0.0 in keystoneclient,
which causes a connection failure.

This bug will cause func tests to not run when using
keystoneauth.

Added unit tests to verify correct default timeout is set
in get_auth().

Drive-by: remove what seems like a stale TODO comment

Change-Id: I17c781ce160a682b1768d315422ade0cdd2df198
2015-06-03 12:03:30 +01:00
Alistair Coles
71a1835193 Document missing functional test config option
Adds doc for account_username option to sample test.conf.
This option was added in [1].

[1] change id Ic484e9a0c186c9283c4012c6a2fa77b96b8edf8a

Change-Id: Ic86b274e9d954822da521360981f796d61efaad9
2015-06-02 11:13:38 +01:00
Jenkins
49483a3b11 Merge "Compare each chunk of large objects when downloading" 2015-06-01 17:18:21 +00:00
Jenkins
bcca25a2c8 Merge "Stop decoding object content" 2015-05-29 08:13:16 +00:00
Tim Burke
ff0b3b02f0 Compare each chunk of large objects when downloading
This allows the use of --skip-identical when downloading SLOs and DLOs,
while still only requiring one request for normal objects.

Change-Id: I237ec5a8cc4d1119b6d3f166db81a977a50a4e4e
Related-Bug: #1379252
2015-05-27 17:40:24 -04:00
Jenkins
c15e81af9b Merge "be more explicit in the --version CLI option" 2015-05-26 20:09:04 +00:00
Tim Burke
7d5c85ad10 Stop decoding object content
Previously, we had urllib3 (via requests) automatically decode all
responses with a Content-Encoding of deflate or gzip. This included
object downloads, which would in turn cause etag or content-length
mismatch errors. (See bug 1338464)

This was apparently added in response to a third-party proxy sitting
between the client and server which, having observed that the client
would accept gzip-encoded content while the server sent an unencoded
response, would perform the compression. (See bug 1282861)

Now, we'll no longer let requests send any default headers, nor do any
decoding.

Change-Id: I6cc30a5c12e37de06d7322533a3c36ad15397cc8
Closes-Bug: 1338464
Related-Bug: 1282861
2015-05-22 13:24:46 -07:00
Tim Burke
317df7e527 Remove simplejson dependency
In addition to removing an unnecessary dependency, this closes another
hole that was allowing raw bytes to appear in user-facing messages.

Change-Id: Ia0b76426a38e5a5c368c4c7e7ba2aef286758aca
2015-05-20 18:14:53 -07:00
Jenkins
52b849217f Merge "Add tests for uploads deleting DLO segments" 2015-05-21 00:47:28 +00:00
Jenkins
53432b5739 Merge "Add test for timeout being passed to keystone client" 2015-05-21 00:44:51 +00:00
John Dickinson
888bf6f1a0 be more explicit in the --version CLI option
Change-Id: I14f33c7ea90ab1fe58aa67f1ff70e527c88cd141
2015-05-13 16:46:14 -07:00
Jenkins
1aebb7ccc5 Merge "Use a socket timeout in get_auth" 2015-05-04 19:28:15 +00:00
Jenkins
766cf73247 Merge "Compare each chunk of large objects when uploading" 2015-04-30 18:48:59 +00:00
Alistair Coles
a39e18ff5a Add test for timeout being passed to keystone client
Extends existing unit test for timeout being passed to get_auth
to cover v2.0 auth when keystone client should get the timeout
kwarg.

Related-Bug: 1447847
Change-Id: Ie9cfc86fa2156b94b45d290ac12e3f71b20d6c4f
2015-04-28 16:58:23 +01:00
Pete Zaitcev
e2f41a6635 Use a socket timeout in get_auth
A previous change added socket timeouts, but they weren't plumbed
through to the get_auth code path. Make sure we're passing them along
everywhere.

Original-Author: Monty Taylor <mordred@inaugust.com>
Change-Id: I398241898248e66d1f8c436c8ed2ec7a0e9387f6
Closes-bug: 1447847
2015-04-26 01:37:15 -06:00
Jenkins
ea6d2bf74d Merge "Add socket-level read timeout parameter" 2015-04-24 01:18:49 +00:00
Jenkins
3105cdc4f8 Merge "Include unsupported url scheme with ClientException" 2015-03-31 22:18:44 +00:00
Monty Taylor
f5a473edfc Add socket-level read timeout parameter
The underlying requests library supports a timeout input parameter. The
other python-*client libraries support passing it in, so while working
on shade, it seemed like a great idea to be able to pass in timeout to
swiftclient too. For reference, there's a change in shade:
I095c1240693abf024bda2315dd77f4400b24a45b that shows interaction with
the other libs, and a tentative patch that would consume this one.

Change-Id: I699ebb1e092aa010af678de7ba15712da6ed5315
2015-03-30 17:01:02 -04:00
Stuart McLaren
b6457e0f95 Allow reading from object body on download
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
2015-03-24 10:45:33 +00:00
Tim Burke
a4fb70ece1 Compare each chunk of large objects when uploading
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
2015-03-23 18:35:45 -07:00
Tim Burke
d931ec1381 Remove all DLO segments on upload of replacement
Previously, only the first container-listing's worth of segments was
deleted, which would leave behind orphaned segments when the object was
very large with small segments or the server's container_listing_limit
was small.

In addition, process DLO and SLO deletions on the segment thread pool,
rather than the object thread pool.

Change-Id: I1587375261a6237fa55a9cb96bda8dae918cc795
Related-Bug: #1418007
2015-03-23 12:11:47 -07:00
Tim Burke
c9f79e641c Mention --segment-size option after 413 response
Previously, it would only output something like

  ClientException: Object PUT failed <url> 413 Request Entity Too Large
  Your request is too large.

... which is misleading as it implies that Swift simply can't handle
large objects.

Change-Id: Icec9e76b2671490c3a2249ec08992950107c6828
2.4.0
2015-03-05 15:37:18 -08:00
Jenkins
8e94ca6394 Merge "Unindent a chunk of st_list" 2015-03-05 21:19:06 +00:00
Daniel Wakefield
13780f37c3 Add improvements to MD5 validation.
With MD5Sum checking being added, a concern was brought up that It was
a change with no possibility of reverting to the old behaviour.
This change adds the flag '--ignore-checksum' to the upload subcommand
allowing the checks to be turned off.

Changed occurrences of the magic string for a null md5 to use a descriptive
constant instead.

Updated Error messages generated when validation fails. They should now be more descriptive
and not output a literal newline sequence.

Change-Id: Id1756cbb6700bb7e38f0ee0e75bc535e37f777ed
2015-03-04 14:01:55 +00:00
Pete Zaitcev
35bcad638c Unindent a chunk of st_list
The chunk looks like nicely containable, but it pushes against the
right edge of the screen annoyingly. This patch _only_ prettifies,
without any observable changes.

Change-Id: I96fcb5848e3e5e0e8a8ebbe398b1d4a0bea5fa24
2015-02-26 15:46:13 -07:00
Alistair Coles
dcf2124d41 Add tests for uploads deleting DLO segments
This patch adds unit tests to verify that
uploads overwriting an existing DLO manifest
will delete any segments pointed to by the
manifest, unless --leave-segments is specified.

Also test the --leave-segments option with an
existing SLO manifest.

Related-Bug: 1418007

Change-Id: I54e8eb138976269bb36392a811089c33c1ace4d3
2015-02-25 16:52:23 +00:00
Jenkins
925c01ebfb Merge "Release connection after consuming the content" 2015-02-25 13:54:14 +00:00
Jenkins
771383145b Merge "Fix crash when stat'ing objects with non-ascii names" 2015-02-25 13:10:56 +00:00
Ian Cordasco
8756591b0a Release connection after consuming the content
When using stream=True, we need to make sure we release a connection
back to the connection pool to avoid warnings clogging up the logs. We
can do this by releasing the connection once we've read all the content
from the response. In situations where stream=False, requests already
does this for us.

Related-bug: 1424732
Closes-bug: 1341777
Change-Id: Id1c72ad86135a49d4b985992d788736b65f7dbda
2015-02-25 11:00:56 +00:00
Jenkins
731707f06d Merge "Fix crash with -l, -d /, and pseudo folders" 2015-02-25 05:39:23 +00:00
Jenkins
19a298bdaa Merge "Verify MD5 of uploaded objects." 2015-02-24 08:22:18 +00:00
Alistair Coles
47f089fbca Include unsupported url scheme with ClientException
This was an attempt to reveal some more info about failing
jenkins jobs such as here [1] where glance_store is
receiving a swiftclient exception because of 'unsupported
scheme in url'. It seems worth merging the more helpful
exception message.

[1] http://logs.openstack.org/91/155291/7/check/gate-tempest-dsvm-neutron-src-python-swiftclient/4adac1e/

Change-Id: I0f3411efd42d045b07d6d1000f59a06865d8034b
2015-02-23 19:10:32 +00:00
Daniel Wakefield
f0300e3714 Verify MD5 of uploaded objects.
Changed existing code to calculate the MD5 of the object
during the upload stream. Checks this MD5 against the etag
returned in the response.
An exception is raised if they do not match.

Closes-Bug: 1379263

Change-Id: I6c8bc1366dfb591a26d934a30cd21c9e6b9a04ce
2015-02-19 11:21:32 +00:00
Pete Zaitcev
fec5d068a0 Fix crash with -l, -d /, and pseudo folders
Using -l, -d /, or a pseduo folder by itself works fine, but if you
combine all of them, this happens:

[zaitcev@guren s]$ swift list -d / testcont
amazon_lili.jpg
pseudodir/
rin_shibuya_pixiv.jpg
swift-c134855-5a.diff
[zaitcev@guren s]$ swift list -d / -l testcont
      151954 2014-06-20 17:13:52 amazon_lili.jpg
Traceback (most recent call last):
  File "/q/zaitcev/hail/python-swiftclient-tip/bin/swift", line 24, in <module>
    sys.exit(main())
  File "/q/zaitcev/hail/python-swiftclient-tip/swiftclient/shell.py", line 1301, in main
    globals()['st_%s' % args[0]](parser, argv[1:], output)
  File "/q/zaitcev/hail/python-swiftclient-tip/swiftclient/shell.py", line 414, in st_list
    total_bytes += item_bytes
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

The patch is a straightforward fix that assigns expected variables.

Change-Id: If24dcc2491e8b8982455107d2aca30c0491a398a
Closes-Bug: 1399678
2015-02-18 19:46:41 -07:00
Sean Dague
8aff0bda9c add functional tox target
move the contents of the functional test hook into tox for
consistency.

Change-Id: I730f1bb530215ba7c30bf32a1c3bbc16edd5c217
Required-By: https://review.openstack.org/#/c/156676
2015-02-17 15:00:00 -08:00
Joel Wright
cac21e3cff Fix crash when stat'ing objects with non-ascii names
This patch fixes a crash and stack trace in stat when an object
name contains non-ascii characters.

Change-Id: Ib6dc686771e593243de56cafc100b17e51d9d9d5
Closes-Bug: 1411665
2015-02-17 14:52:35 +00:00
Jenkins
45cce75e50 Merge "Add help message for "<subcommand> --help"" 2015-02-10 23:51:28 +00:00
Hirokazu Sakata
eb85f8c1a4 Add help message for "<subcommand> --help"
This patch fixed help message for "<subcommand> --help" in
general help message. Previous help message was only
"this help message". It has not described for subcommand.

Change-Id: I2fe6413baf98ba3881425ee6bed29c618e29fff8
Closes-Bug: 1420253
2015-02-10 20:52:17 +09:00