71 Commits

Author SHA1 Message Date
Robert Francis
99b89aea10 Symlink implementation.
Add a symbolic link ("symlink") object support to Swift. This
object will reference another object. GET and HEAD
requests for a symlink object will operate on the referenced object.
DELETE and PUT requests for a symlink object will operate on the
symlink object, not the referenced object, and will delete or
overwrite it, respectively.
POST requests are *not* forwarded to the referenced object and should
be sent directly. POST requests sent to a symlink object will
result in a 307 Error.

Historical information on symlink design can be found here:
https://github.com/openstack/swift-specs/blob/master/specs/in_progress/symlinks.rst.
https://etherpad.openstack.org/p/swift_symlinks

Co-Authored-By: Thiago da Silva <thiago@redhat.com>
Co-Authored-By: Janie Richling <jrichli@us.ibm.com>
Co-Authored-By: Kazuhiro MIYAHARA <miyahara.kazuhiro@lab.ntt.co.jp>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>

Change-Id: I838ed71bacb3e33916db8dd42c7880d5bb9f8e18
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2017-12-13 21:26:12 +00:00
Kota Tsuyuzaki
1962b18c0c Remove unnecessary commented lines
Change-Id: Ifb7e697851e4e6979fe22176c7a7ca74699c75a6
2017-11-14 11:42:11 +09:00
Tim Burke
77a8a4455d Let clients request heartbeats during SLO PUTs
An SLO PUT requires that we HEAD every referenced object; as a result, it
can be a very time-intensive operation. This makes it difficult as a
client to differentiate between a proxy-server that's still doing work and
one that's crashed but left the socket open.

Now, clients can opt-in to receiving heartbeats during long-running PUTs
by including the query parameter

    heartbeat=on

With heartbeating turned on, the proxy will start its response immediately
with 202 Accepted then send a single whitespace character periodically
until the request completes. At that point, a final summary chunk will be
sent which includes a "Response Status" key indicating success or failure
and (if successful) an "Etag" key indicating the Etag of the resulting SLO.

This mechanism is very similar to the way bulk extractions and deletions
work, and even the way SLO behaves for ?multipart-manifest=delete requests.

Note that this is opt-in: this prevents us from sending the 202 response
to existing clients that may mis-interpret it as an immediate indication
of success.

Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Related-Bug: 1718811
Change-Id: I65cee5f629c87364e188aa05a06d563c3849c8f3
2017-11-03 09:42:48 +00:00
Jens Harbott
b4f08b6090 Fix functest for IPv6 endpoints
Currently the functional tests fail if the storage_url contains a quoted
IPv6 address because we try to split on ':'.

But actually we don't need to split hostname and port only in order to
combine it back together lateron. Use the standard urlparse() function
instead and work with the 'netloc' part of the URL which keeps hostname
and port together.

Change-Id: I64589e5f2d6fb3cebc6768dc9e4de6264c09cbeb
Partial-Bug: 1656329
2017-09-27 09:15:53 +00:00
Jenkins
c9acb0a717 Merge "functests: Only convert headers that should be ints to be ints" 2017-08-18 07:54:17 +00:00
Tim Burke
d8c7d21cfc Add functests for disallowed COPYs into a versioned container
While we're at it, have copy and copy_account raise ResponseErrors
on failure, similar to cluster_info, update_metadata, containers, info,
files, delete, initialize, read, sync_metadata, write, and post.

Related-Change: Ia8b92251718d10b1eb44a456f28d3d2569a30003
Change-Id: I9ef42d922a6b7dbf253f2f8f5df83965d8f47e0f
2017-08-08 18:25:14 +00:00
Tim Burke
708fdec831 functests: Only convert headers that should be ints to be ints
Change-Id: I675d05d65b9c3c3ef18684c175d227f662b38f67
Closes-Bug: #1641216
2017-07-20 00:30:40 +00:00
Kota Tsuyuzaki
652276fea6 Support last modified on listing containers
For now, last modified timestamp is supported only on
object listing. (i.e. GET container)

For example:

GET container with json format results in like as:

[{"hash": "d41d8cd98f00b204e9800998ecf8427e", "last_modified":
"2015-06-10T04:58:23.460230", "bytes": 0, "name": "object",
"content_type": "application/octet-stream"}]

However, container listing (i.e. GET account) shows just a dict
consists of ("name", "bytes", "name") for each container.

For example:

GET accounts with json format result in like as:

[{"count": 0, "bytes": 0, "name": "container"}]

This patch is for supporting last_modified key in the container
listing results as well as object listing like as:

[{"count": 0, "bytes": 0, "name": "container", "last_modified":
"2015-06-10T04:58:23.460230"}]

This patch is changing just output for listing. The original
timestamp to show the last modified is already in container table
of account.db as a "put_timestamp" column.

Note that this patch *DOESN'T* change the put_timestamp semantics.
i.e. the last_modified timestamp will be changed only at both PUT
container and POST container.
(PUT object doesn't affect the timestamp)

Note that the tuple format of returning value from
swift.account.backend.AccountBroker.list_containers is now
(name, object_count, bytes_used, put_timestamp, 0)

* put_timestamp is added *

Original discussion was in working session at Vancouver Summit.
Etherpads are around here:

https://etherpad.openstack.org/p/liberty-swift-contributors-meetup
https://etherpad.openstack.org/p/liberty-container-listing-update

DocImpact

Change-Id: Iba0503916f1481a20c59ae9136436f40183e4c5b
2017-01-12 18:03:10 +00:00
Alistair Coles
9f30c5d31e Make tempurl functional tests clean up account keys
Addresses a TODO in test/functional/test_account.py where
an account metadata test was having to clean up tempurl keys
in the account metadata that were left by another test in
a different module. This cleanup is necessary because tests
in test_account.py fail if there is any pre-existing
account metadata.

This patch:

* makes the tempurl tests clean up their keys from account
  metadata.

* makes the test_account.py:TestAccount class remove any
  pre-existing metadata before attempting any tests and
  replacing that metadata when all the tests in that class
  have completed. This is more robust than the existing code
  which only removes any tempurl keys that might be in the
  account - now you could have x-account-meta-foo = bar in
  the test account and test_account.py will still pass.

* consolidates some common setup code currently repeated for
  many of the functional test classes into into a BaseEnv class.

Change-Id: I874a9e23dfcdd1caa934945b46089f11b9f6de65
2016-12-20 10:45:59 -08:00
Kota Tsuyuzaki
03b5e76d09 Improve functional tests and test client
This patch includes a couple of small functional test improvement.

A. Change swift_test_client.File.sync_metadata to follow Swift object
metadata semantics:

swift_test_client.File.sync_metadata is designed to post object user
metadata to an object. However, prior to this patch, the
swift_test_client.File instance keeps the existing object metadata as
its member attribute and if sync_metadata is called, it sends both
existing metadata and incomming metadata from caller. It looks to result
in the odd state as if Swift keeps the existing metadata when POST
object requested.

To tell the correct Swift object metadata semantics, when POST object
requested, the existing metadata in the stored object should be gone
even if no metadata is overwritten.

i.e.
if POST object with 'X-Object-Meta-Key: Val' to a stored object with
'X-Object-Meta-foo: bar', it will result in an object with
'X-Object-Meta-Key' (note that X-Object-Meta-Foo will be deleted)

The prior behavior sometimes make us confused in the reviw [1] so that,
this patch fixes it to send only incomming metadata if it's set.

B. Check the response status code more strictly for ObjectVersioning case

This patch fixes test_versioning_check_acl on both TestObjectVersioning and
TestObjectVersioningHistoryMode to assert the response status code
explisitly instead of asserting just "ResponseError". (e.g. 403 when trying
to delete object from other account)

1: https://review.openstack.org/#/c/360933/1/test/functional/tests.py@4142

Change-Id: Ia3e5b40f17dc0f881b695aa4be39c98b91e2bb06
2016-09-28 21:07:07 -07:00
Kota Tsuyuzaki
0c8c764547 Add functional tests for new versioned_write mode
This patch is follow up for [1] and [2] to add new functional
tests for versioned_writes middlware 'history' mode.
(i.e. using X-History-Location header to a container).

The new test class, TestObjectHistoryModeVersioning, will use obvious
setting the mode via new X-History-Location header, since the change [2],
the setting X-Versions-Mode header added since [1] for incomming request has
been deprecated. Hence, since [2], the syntax for stack mode is back to
be same with older Swift than [1] so that the only thing we need now is
just adding a test suite for the new X-History-location.

It means the API has been changing like:
---------------
For stack mode:
---------------
Older than [1]:
X-Versions-Location

[1]~[2]:
X-Vesions-Location (and X-Versions-Mode: 'stack' for obvious)

Newer than [2]:
X-Vesions-Location

-----------------
For history mode:
-----------------
Older than [1]:
(Not supported)

[1]~[2]:
X-Vesions-Location and X-Versions-Mode: 'history'

Newer than [2]:
X-History-Location

Note that this functional tests work on newer swift than [2].

And then, this patch also sets allow_versioned_writes=True
for in-process testing (the container server allow_versions
option was already set, so this is just enabling in the middleware
too). That means that in-process functional tests (such as run by
the tox envs func-in-process-*) because history mode requires the
middleware allow_versioned_writes option to be explicity set to True.

1: https://review.openstack.org/#/c/214922/
2: https://review.openstack.org/#/c/373537/

Co-Authored-By: Alistair Coles <alistair.coles@hpe.com>

Related-Change: I555dc17fefd0aa9ade681aa156da24e018ebe74b
Related-Change: Icfd0f481d4e40dd5375c737190aea7ee8dbc3bf9
Change-Id: Ifebc1c3ce558b1df9e576a58a4100f2219dfc7e7
2016-09-25 19:45:38 -07:00
Jenkins
9d29ca1c76 Merge "Last-Modified header support on HEAD/GET container" 2016-08-11 14:44:12 +00:00
Tim Burke
fb5fcb189e Fix encryption-delimiter interaction
Previously, if a container listing produced `subdir` elements
the decrypter would raise a KeyError.

Additionally, update the functests so this sort of thing would
have been caught at the gate.

Closes-Bug: 1609904
Change-Id: Idc1907d19f90af7a086f45f8faecee9fbc3c69c2
2016-08-04 17:55:26 +00:00
Alistair Coles
928c4790eb Refactor tests and add tests
Relocates some test infrastructure in preparation for
use with encryption tests, in particular moves the test
server setup code from test/unit/proxy/test_server.py
to a new helpers.py so that it can be re-used, and adds
ability to specify additional config options for the
test servers (used in encryption tests).

Adds unit test coverage for extract_swift_bytes and functional
test coverage for container listings. Adds a check on the content
and metadata of reconciled objects in probe tests.

Change-Id: I9bfbf4e47cb0eb370e7a74d18c78d67b6b9d6645
2016-06-15 16:36:25 +01:00
Kota Tsuyuzaki
fcb6e4cd3a Last-Modified header support on HEAD/GET container
This patch enables to show a x-put-timestamp as
a last-modified header in container-server.

Note that the last-modified header will be changed only when a
request for container (PUT container or POST container) comes into
Swift. i.e. some requests for objects (e.g. PUT object, POST object)
will never affect the last-modified value but only when using
python-swiftclient like as "swift upload", the last-modified will
be close to the upload time because python-swiftclient will make
a PUT container request for "swift upload" each time.

Change-Id: I9971bf90d24eee8921f67c02b7e2c80fd8995623
2016-06-07 12:02:03 +01:00
Alistair Coles
ceaaedbe40 Make functional tests tolerate pre-existing versioned container
test/functional/tests.py:TestAccount.testAccountHead relies
on the account having a known number of containers. The test
setup attempts to delete all existing containers but this fails
a container has versions (and so is not emptied, and cannot be
deleted). The tests then fails because the expected number of
containers does not match the actual.

'bin/resetswift' before running tests will obviously clear all
state but is not always convenient.

This change removes any x-versions-location header before deleting
containers during test setUp.

Steps to recreate the pre-condition for failure on master:
(based on original work by clayg)

swift post target -r '.r:*, .rlistings'
swift post source -H 'x-versions-location: target'
for i in {1..4}; do
  echo "junk${i}" > junk
  swift upload source junk
done

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I3efb6c20dc1fb3e979087e8a93d04ba7e346b5b6
2016-01-19 13:12:49 +00:00
Alistair Coles
169a7c7f9e Fix func test --until-failure and --no-discover options
This patch changes functional test classes to subclass
unittest2.TestCase rather than unittest.TestCase.
This fixes errors when attempting to use

tox -e func -- -n <test_path_including_test_method>

and

tox -e func -- --until-failure

Also migrate from using nose.SkipTest to unittest2.SkipTest

Change-Id: I903033f5e01833550b2f2b945894edca4233c4a2
Closes-Bug: 1526725
Co-Authored-By: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2015-12-16 15:28:25 +00:00
Alistair Coles
6c43bdc82b Test for content-type params in multi-range response
Updates the functional test to verify the fix applied by
change Iff7274aa631a92cd7332212ed8b4378c27da4a1f

Change-Id: Iae63ac027e4f4acfe46a36dc1325888b1f834ea4
2015-11-26 14:57:16 +00:00
Zack M. Davis
1b8b08039a remove remaining simplejson uses, prefer standard library import
a1c32702, 736cf54a, and 38787d0f remove uses of `simplejson` from
various parts of Swift in favor of the standard libary `json`
module (introduced in Python 2.6). This commit performs the remaining
`simplejson` to `json` replacements, removes two comments highlighting
quirks of simplejson with respect to Unicode, and removes the references
to it in setup documentation and requirements.txt.

There were a lot of places where we were importing json from
swift.common.utils, which is less intuitive than a direct `import json`,
so that replacement is made as well.

(And in two more tiny drive-bys, we add some pretty-indenting to an XML
fragment and use `super` rather than naming a base class explicitly.)

Change-Id: I769e88dda7f76ce15cf7ce930dc1874d24f9498a
2015-11-16 12:34:24 -08:00
Victor Stinner
c0af385173 py3: Replace urllib imports with six.moves.urllib
The urllib, urllib2 and urlparse modules of Python 2 were reorganized
into a new urllib namespace on Python 3. Replace urllib, urllib2 and
urlparse imports with six.moves.urllib to make the modified code
compatible with Python 2 and Python 3.

The initial patch was generated by the urllib operation of the sixer
tool on: bin/* swift/ test/.

Change-Id: I61a8c7fb7972eabc7da8dad3b3d34bceee5c5d93
2015-10-08 15:24:13 +02:00
Alistair Coles
58a10a5fff Add test that a tempurl POST cannot set a DLO manifest header
Follow up to [1] to add tests for tempurl POSTs not being allowed
to set a DLO manifest header.

[1] I11e68830009d3f6bff44ae4011a41b67139146f6

Change-Id: I7c0ad5a936f71e56c599b8495a586913d3334422
Related-Bug: 1453948
2015-08-26 16:30:23 +01:00
Thiago da Silva
035a411660 versioned writes middleware
Rewrite object versioning as middleware to simplify the PUT method
in the object controller.

The functionality remains basically the
same with the only major difference being the ability to now
version slo manifest files. dlo manifests are still not
supported as part of this patch.

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>

DocImpact
Change-Id: Ie899290b3312e201979eafefb253d1a60b65b837
Signed-off-by: Thiago da Silva <thiago@redhat.com>
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2015-08-07 14:11:32 -04:00
Victor Stinner
a0db56dcde Fix pep8 E265 warning of hacking 0.10
Fix the warning E265 "block comment should start with '# '" added in pep
1.5.

Change-Id: Ib57282e958be9c7cddffc7bca34fbbf1d4c460fd
2015-07-30 09:33:18 +02:00
Victor Stinner
e24d7c36fa Use six to fix imports on Python 3
Get configparser, queue, http_client modules from six.moves.

Patch generated by the six_moves operation of the sixer tool:
https://pypi.python.org/pypi/sixer

Change-Id: I666241ab50101b8cc6f992dd80134ce27327bd7d
2015-07-24 11:48:28 +02:00
Jenkins
260e976e50 Merge "Get StringIO and cStringIO from six.moves" 2015-07-24 06:52:36 +00:00
Jenkins
2107fe89c7 Merge "Select policy when running functional test" 2015-07-17 00:26:44 +00:00
Victor Stinner
6e70f3fa32 Get StringIO and cStringIO from six.moves
* replace "from cStringIO import StringIO"
  with "from six.moves import cStringIO as StringIO"
* replace "from StringIO import StringIO"
  with "from six import StringIO"
* replace "import cStringIO" and "cStringIO.StringIO()"
  with "from six import moves" and "moves.cStringIO()"
* replace "import StringIO" and "StringIO.StringIO()"
  with "import six" and "six.StringIO()"

This patch was generated by the stringio operation of the sixer tool:
https://pypi.python.org/pypi/sixer

Change-Id: Iacba77fec3045f96773d1090c0bd48613729a561
2015-07-15 16:56:33 +02:00
Jenkins
b2e79357bb Merge "Replace dict.iteritems() with dict.items()" 2015-07-09 18:36:05 +00:00
Jenkins
1f753953fb Merge "Increase httplib._MAXHEADERS" 2015-06-26 16:28:39 +00:00
Christian Schwede
edfca861b6 Increase httplib._MAXHEADERS
Python 2.7.9+ and 3.2.6+ limits the number of maximum headers in httplib to 100
[1,2,3]. This setting is too low for Swift.

By default the maximum number of allowed headers depends on the number of max
allowed metadata settings plus a default value of 32 for regular http headers.
If for some reason this is not enough (custom middleware for example) it can be
increased with the extra_header_count constraint.

[1] https://bugs.python.org/issue16037
[2] https://hg.python.org/cpython/raw-file/15c95b7d81dc/Misc/NEWS
[3] https://hg.python.org/cpython/raw-file/v3.2.6/Misc/NEWS

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Co-Authored-By: Matthew Oliver <matt@oliver.net.au>
Co-Authored-By: Thomas Herve <therve@redhat.com>

Change-Id: I388fd697ec88476024b0e9f1ae75ba35ff765282
2015-06-26 14:35:40 +00:00
Victor Stinner
e70b66586e Replace dict.iteritems() with dict.items()
The iteritems() of Python 2 dictionaries has been renamed to items() on
Python 3. According to a discussion on the openstack-dev mailing list,
the overhead of creating a temporary list using dict.items() on Python 2
is very low because most dictionaries are small:

http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Patch generated by the following command:

    sed -i 's,iteritems,items,g' \
      $(find swift -name "*.py") \
      $(find test -name "*.py")

Change-Id: I6070bb6c684be76e8e77222a7d280ec6edd43496
2015-06-24 09:39:55 +02:00
Victor Stinner
e5c962a28c Replace xrange() with six.moves.range()
Patch generated by the xrange operation of the sixer tool:
https://pypi.python.org/pypi/sixer

Manual changes:

* Fix indentation for pep8 checks
* Fix TestGreenthreadSafeIterator.test_access_is_serialized of
  test.unit.common.test_utils:
  replace range(1, 11) with list(range(1, 11))
* Fix UnsafeXrange docstring, revert change

Change-Id: Icb7e26135c5e57b5302b8bfe066b33cafe69fe4d
2015-06-23 07:29:15 +00:00
Kota Tsuyuzaki
025c4c4339 Remove confusable query string on post as copy
Current post as copy routine (i.e. POST object with post_as_copy option
turned on) on Object Controller uses "multipart-manifest" query string
which is feeded to env['copy_hook'] to decide which data (the manifest or
object pointed by the manifest) should be copied.

However, the way using the query string will confuse operators looking at
logging system (or analyzing the log) because whole POST object requests
have 'multipart-manifest=get' like as:

POST /v1/AUTH_test/d4c816b24d38489082f5118599a67920/manifest-abcde%3Fmultipart-manifest%3Dget

We cannot know whether the query string was added by hand
(from user) or not. In addition, the query isn't needed by the
backend conversation between proxy-server and object-server.
(Just needed by "copy_hook" on the proxy controller!)

To remove the confusable query string and to keep the log to be clean,
this patch introduces new environment variable "swift.post_as_copy"
and changes proxy controller and the copy_hook to use the new env.

This item was originally discussed at
https://review.openstack.org/#/c/177132/

Co-Authored-By: Alistair Coles <alistair.coles@hp.com>

Change-Id: I0cd37520eea1825a10ebd27ccdc7e9162647233e
2015-05-13 13:09:07 -07:00
Emmanuel Cazenave
1faad248f8 X-Auth-Token should be a bytestring.
Change-Id: I2aa941d74883e17e9548b0144a4a2e2db33aba95
Closes-Bug: 1451773
2015-05-07 14:28:35 +00:00
Thiago da Silva
7bdb8266d4 Select policy when running functional test
Add ability to select a storage policy when running
the functional tests by defining the environment variable
SWIFT_TEST_POLICY.

This patch was first introduced by Janie Richling in
feature/ec: https://review.openstack.org/#/c/166097

Co-Authored-By: Janie Richling <jrichli@us.ibm.com>
Co-Authored-By: Christian Schwede <christian.schwede@enovance.com>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>
Co-Authored-By: Alistair Coles <alistair.coles@hp.com>

Change-Id: Id96354546088df137def0ae7fd434baf64ed0c51
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2015-04-06 16:35:58 +00:00
Jenkins
d6467d3385 Merge "Add multiple reseller prefixes and composite tokens" 2015-02-24 16:12:01 +00:00
Donagh McCabe
89397c5b67 Add multiple reseller prefixes and composite tokens
This change is in support of Composite Tokens and Service Accounts
(see http://specs.openstack.org/openstack/swift-specs/specs/in_progress/
service_token.html)

During coding, minor changes were made compared to the original
specification. See https://review.openstack.org/138771 for these changes.

DocImpact

Change-Id: I6072b4efb3a479a8e0cc2d9c11ffda5764b55e30
2015-02-23 15:57:20 +00:00
Richard Hawkins
023e29fa1e Add functional tests for container TempURLs
Change-Id: I7f54594df1522d72dd1d13556be0b9d33e811b30
2015-02-14 10:05:19 -06:00
Prashanth Pai
a0977ab8ca dlo: Update doc about manifest containing data
Current behavior:
* If data/body is present in manifest file PUT request, the data/body gets
  saved onto disk, just like for a normal object.
* Generally, this data in manifest file is never served on a GET response.
  However, when the manifest object path itself is part of prefix, GET
  response would contain data present in manifest file as well.
* The query param multipart-manifest=get meant to retrieve SLO manifest
  also works in case of DLO manifest. Hence a COPY request with the
  multipart-manifest=get query param would actually copy DLO manifest.

How things should have been:
* The DLO manifest object is supposed to have no content and only have
  X-Object-Manifest metadata header.
* Query param multipart-manifest=get is SLO specific and shouldn't have
  any role in DLO.

This change intends to only document current behaviour and not change it,
assuming there are users who have previously saved some content in DLO
manifest file and/or have been using multipart-manifest=get to fetch
and/or COPY the DLO manifest file with it's content.

Change-Id: I0f6e175ad7752169ecf94df949336e0665928df7
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2015-01-16 10:24:14 +05:30
Constantine Peresypkin
43ac76373a account to account copy implementation
Adds ability to copy objects between different accounts (on server side)

Adds new header to `PUT` request:
`X-Copy-From-Account: <account name>`
Account name corresponds to the last part of storage URL.

Adds new header to `COPY` request:
`Destination-Account: <account name>`
Account name corresponds to the last part of storage URL.

If your storage URL is: http://server:8080/v1/AUTH_test
Then the account name is `AUTH_test`

These headers should be used alongside `X-Copy-From` and `Destination` headers
The legacy headers should specify `<container name>/<object name>` path as usual.

DocImpact

Change-Id: I0285fe6a47df9e699ac20ae4a83b0bf23829e1e6
2014-08-13 15:43:22 +03:00
Yuan Zhou
c11ac01252 Add functional tests for Storage Policy
* additional container tests
 * refactor test cross policy copy
 * make functional tests cleanup better

In-process functional tests only define a single ring and will skip some of
the multi-storage policy tests, but have been updated to reload_policies with
the patched swift.conf.

DocImpact
Implements: blueprint storage-policies
Change-Id: If17bc7b9737558d3b9a54eeb6ff3e6b51463f002
2014-06-18 20:57:09 -07:00
Brian Cline
b4c5a13664 Uses None instead of mutables for function param defaults
As seen on #1174809, changes use of mutable types as default
arguments and defaults them within the method. Otherwise, those
defaults can be unexpectedly persisted with the function between
invocations and erupt into mass hysteria on the streets.

There was indeed a test (TestSimpleClient.test_get_with_retries)
that was erroneously relying on this behavior. Since previous tests
had populated their own instantiations with a token, this test only
passed because the modified headers dict from previous tests was
being overridden. As expected, with the mutable defaults fix in
SimpleClient, this test begain to fail since it never specified any
token, yet it has always passed anyway. This change also now provides
the expected token.

Change-Id: If95f11d259008517dab511e88acfe9731e5a99b5
Related-Bug: #1174809
2014-05-10 11:15:56 +00:00
Peter Portante
4dd2670fb0 Load constraints from cluster info dictionary
Use constrainst from the new "swift-constraints" section of test.conf,
fall back to those found in the response to the /info API call,
ultimately falling back to the constraints module's effective
constraints.

Change-Id: Iea01c9c4b5148faa10004a240df411cbe7336a6a
2014-04-14 19:05:25 -04:00
Peter Portante
f63b37572d Update callback with proper bytes transferred
The first set of bytes transferred was being dropped.

Change-Id: I8e055190d04af1718c5e88bf5e8c44fde6794c74
2014-04-01 22:59:22 -04:00
Samuel Merritt
28c0da29b0 Functional tests for tempurl
Change-Id: I578be387fe6119a86a8abc544b3cbe210ddca3c1
2014-03-07 08:55:54 -08:00
Samuel Merritt
09ef06fd99 Convert all old-style classes to new-style
This cleanup has been slowly happening for a while; let's finish it.

Change-Id: I1561e3540d524834e0cc5bc725ab80936eae1f0e
2014-03-03 17:28:48 -08:00
Jenkins
8426edced5 Merge "Some functional tests for object versioning" 2014-01-30 04:44:37 +00:00
Jenkins
7f456ef35f Merge "change the last-modified header value with valid one" 2013-12-20 00:57:36 +00:00
Samuel Merritt
a720b4d757 Some functional tests for object versioning
Also fix some exception-handling stuff in functional tests; at some
point, ResponseError() started needing two more parameters, but the
functional tests (not swift_test_client, just tests.py) still had a
couple spots that were not passing in the new params. Now they're
optional again, and if you omit them, then the stringification of the
ResponseError is just a little less useful than it could be.

Change-Id: I38968c4b590fc04b97b85c5f974c8648291a6689
2013-12-19 12:49:30 -08:00
Kiyoung Jung
d69e013519 change the last-modified header value with valid one
the Last-Modified header in Response didn't have a suitable
value - an integer part of object's timestamp.
This leads that the the if-[un]modified-since header with the
value from last-modified is always earlier than timestamp
and results the content is always newer than value of these
conditional headers.
Patched code returns math.ceil() of object's timestamp
in Last-Modified header so the later conditional header works
correctly

Closes-Bug: #1248818
Change-Id: I1ece7d008551bf989da74d23f0ed6307c45c5436
2013-12-19 09:31:17 +00:00