507 Commits

Author SHA1 Message Date
Zuul
ba01f93ad9 Merge "func tests: work with etag-quoter on by default" 2020-06-05 20:52:30 +00:00
Thiago da Silva
20c6bdb71c Enable s3api and staticweb tests across all func tests
This patch removed the separate s3api, staticweb functional tests
gate jobs and added them across all other functional test jobs.

Change-Id: Ie1c606132a054defc2b3cc14a66031090e7b8449
2020-06-01 19:16:48 -07:00
Tim Burke
99947150dd func tests: work with etag-quoter on by default
Also, run the in-process encryption func tests like that.

Change-Id: I984ab8d1304d23b89589973950b10dda4aea0db3
2020-06-01 18:38:23 -05:00
Zuul
8f1a40eaae Merge "swift-dsvm: Enable s3api" 2020-05-28 00:27:36 +00:00
Zuul
5d9c373618 Merge "versioning: Have versioning symlinks make pre-auth requests to reserved container" 2020-05-27 00:15:58 +00:00
Zuul
7b6546b076 Merge "fix s3api functional tests" 2020-05-26 20:36:06 +00:00
Tim Burke
a8e03f42e0 versioning: Have versioning symlinks make pre-auth requests to reserved container
Previously, the lack of container ACLs on the reserved container would
mean that attempting to grant access to the user-visible container would
not work; the user could not access the backing object.

Now, have symlinks with the allow-reserved-names sysmeta set be
pre-authed. Note that the user still has to be authorized to read the
symlink, and if the backing object was *itself* a symlink, that will be
authed separately.

Change-Id: Ifd744044421ef2ca917ce9502b155a6514ce8ecf
Closes-Bug: #1880013
2020-05-26 10:09:56 -05:00
Clay Gerrard
63e02fa9fa Test for Versioned Object If-Match
Regular objects can do conditional requests, versioned objects should be
able to as well.

Change-Id: If69dbf2a4c876fa4b830f6d8652f22f39ceaf549
2020-05-26 13:49:15 +00:00
Tim Burke
bb9b0326fd swift-dsvm: Enable s3api
Depends-On: https://review.opendev.org/#/c/571021/
Change-Id: I3ac3288cd61b745ce7dbf2bded8eade026d0418f
2020-05-22 16:04:52 -07:00
Thiago da Silva
f4bc951508 fix s3api functional tests
Connection was hard coded to use saio config

Change-Id: I9c11162de89fa3aa2a78aea093b187d0309860f5
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2020-05-15 22:38:04 -07:00
Zuul
a792255e79 Merge "swift-dsvm: Enable more middlewares" 2020-05-06 19:37:13 +00:00
Tim Burke
9581254e66 swift-dsvm: Enable more middlewares
Change-Id: I3cbbcd2ea9ced0923bee4a6b0783e4cf5e82e95b
2020-04-23 13:46:16 -07:00
Tim Burke
72a6177520 func tests: Allow test_etag_quoter to be run multiple times
Change-Id: Ifb1d091e58b9331b027edf981f6af5c015b56936
2020-04-20 21:19:45 -07:00
Zuul
a495f1e327 Merge "pep8: Turn on E305" 2020-04-10 11:55:07 +00:00
Zuul
2b7e80217d Merge "Allow clients to send quoted ETags for static links" 2020-04-10 00:18:59 +00:00
Tim Burke
668242c422 pep8: Turn on E305
Change-Id: Ia968ec7375ab346a2155769a46e74ce694a57fc2
2020-04-03 21:22:38 +02:00
Andreas Jaeger
96b56519bf Update hacking for Python3
The repo is Python using both Python 2 and 3 now, so update hacking to
version 2.0 which supports Python 2 and 3. Note that latest hacking
release 3.0 only supports version 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I9bd913ee1b32ba1566c420973723296766d1812f
2020-04-03 21:21:07 +02:00
Tim Burke
dc424f593d Allow clients to send quoted ETags for static links
Change-Id: I29c62d28311fd0c2bc6394e03153689523a5959d
2020-03-20 20:16:12 -05:00
Clay Gerrard
f2ffd90059 Apply limit to list versioned containers
Change-Id: I28e062273d673c4f07cd3c5da088aa790b77a599
Closes-Bug: #1863841
2020-03-03 11:27:21 -08:00
Zuul
24fcb380a8 Merge "Return correct etag for raw manifest" 2020-01-31 18:53:27 +00:00
Thiago da Silva
b8c16de023 Return correct etag for raw manifest
When client sends a '?multipart-manifest=get&format=raw' request
middleware will change the manifest returned from object server.
This patch makes sure the response etag is updated to reflect
changes to manifest content

Change-Id: I0ac6dd0808fb041ba7663f4a472a06ee3f1d9a71
2020-01-31 12:04:12 +11:00
Zuul
3010d31804 Merge "s3api: Implement object versioning API" 2020-01-29 03:52:57 +00:00
karen chan
6097660f0c s3api: Implement object versioning API
Translate AWS S3 Object Versioning API requests to native Swift Object
Versioning API, speficially:

 * bucket versioning status
 * bucket versioned objects listing params
 * object GETorHEAD & DELETE versionId
 * multi_delete versionId

Change-Id: I8296681b61996e073b3ba12ad46f99042dc15c37
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
2020-01-28 14:00:08 -08:00
Romain LE DISEZ
27fd97cef9 Middleware that allows a user to have quoted Etags
Users have complained for a while that Swift's ETags don't match the
expected RFC formats. We've resisted fixing this for just as long,
worrying that the fix would break innumerable clients that expect the
value to be a hex-encoded MD5 digest and *nothing else*.

But, users keep asking for it, and some consumers (including some CDNs)
break if we *don't* have quoted etags -- so, let's make it an option.

With this middleware, Swift users can set metadata per-account or even
per-container to explicitly request RFC compliant etags or not. Swift
operators also get an option to change the default behavior
cluster-wide; it defaults to the old, non-compliant format.

See also:
  - https://tools.ietf.org/html/rfc2616#section-3.11
  - https://tools.ietf.org/html/rfc7232#section-2.3

Closes-Bug: 1099087
Closes-Bug: 1424614
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Change-Id: I380c6e34949d857158e11eb428b3eda9975d855d
2020-01-27 12:53:35 -08:00
Zuul
742835a6ec Merge "New Object Versioning mode" 2020-01-27 09:16:22 +00:00
Zuul
82b667706d Merge "Store normalized x-delete-at on PUT/POST" 2020-01-26 19:41:57 +00:00
Clay Gerrard
2759d5d51c New Object Versioning mode
This patch adds a new object versioning mode. This new mode provides
a new set of APIs for users to interact with older versions of an
object. It also changes the naming scheme of older versions and adds
a version-id to each object.

This new mode is not backwards compatible or interchangeable with the
other two modes (i.e., stack and history), especially due to the changes
in the namimg scheme of older versions. This new mode will also serve
as a foundation for adding S3 versioning compatibility in the s3api
middleware.

Note that this does not (yet) support using a versioned container as
a source in container-sync. Container sync should be enhanced to sync
previous versions of objects.

Change-Id: Ic7d39ba425ca324eeb4543a2ce8d03428e2225a1
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Thiago da Silva <thiagodasilva@gmail.com>
2020-01-24 17:39:56 -08:00
Zuul
d3916312d3 Merge "More multi-char-delimiter func test coverage" 2020-01-22 22:50:04 +00:00
Clay Gerrard
2be4716bc9 More multi-char-delimiter func test coverage
Change-Id: I4cad872ef97313ec19a8e4ef042696565a56d4c5
2020-01-22 12:37:21 -08:00
Tim Burke
7bba3ad04d Store normalized x-delete-at on PUT/POST
Change-Id: I81e5d49623e884def8b5f6cbbf82f9b0d667d64a
Closes-Bug: 1860149
2020-01-18 02:52:31 +00:00
Sean McGinnis
5b26b749b5
Drop use of unittest2
unittest2 was needed for Python version <= 2.6, so it hasn't been needed
for quite some time. See unittest2 note one:

https://docs.python.org/2.7/library/unittest.html

This drops unittest2 in favor of the standard unittest module.

Change-Id: I2e787cfbf1709b7f9c889230a10c03689e032957
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-12 03:13:41 -06:00
Tim Burke
d270596b67 Consistently use io.BytesIO
Change-Id: Ic41b37ac75b5596a8307c4962be86f2a4b0d9731
2019-10-15 15:09:46 +02:00
Tim Burke
50255de0e3 func tests: Add more UTF8 tests for versioning
Change-Id: I7ac111bd8b57bd21c37f4c567a20e2c12957b2ff
2019-09-25 02:47:39 +00:00
Thiago da Silva
6271d88f9e Add func test for changing versionining modes
Users are able to change versioning in a container
from X-Versions-Location to X-History-Location, which affects
how DELETEs are handled. We have some unit tests that check this
behavior, but no functional tests.

This patch adds a functional test that helps us understand and
document how changing modes affects the handling of DELETE
requests.

Change-Id: I5dbe5bdca17e624963cb3a3daba3b240cbb4bec4
2019-09-24 17:16:48 +00:00
Zuul
1c29bd678c Merge "Allow non-default domain to be used in func tests" 2019-09-20 01:00:02 +00:00
Zuul
dd1eacb7c5 Merge "Skip test when object versioning is not enabled" 2019-09-19 00:23:49 +00:00
Zuul
28f292f290 Merge "versioned_writes: checks for SLO object before copy" 2019-09-18 21:10:55 +00:00
Thiago da Silva
9698b1bb95 Skip test when object versioning is not enabled
Change-Id: I671a6e4a3d1011dbbc2267b44134cfaf3380fb22
2019-09-17 16:52:55 +02:00
Nguyen Quoc Viet
b4288b4aa6 versioned_writes: checks for SLO object before copy
Previously, versioned_writes middleware copy an already existing
object using PUT. However, SLO requires the additional query
to properly update the object size when listing.

Propose fix: In _put_versioned_obj - which is called when on
creating version obj and also on restoring obj,
if 'X-Object-Sysmeta-Slo-Size' header is present it will
add needed headers for container to update obj size

Added a new functional test case with size assertion for slo

Change-Id: I47e0663e67daea8f1cf4eaf3c47e7c8429fd81bc
Closes-Bug: #1840322
2019-09-15 20:30:56 +07:00
Tim Burke
1ded0d6c87 Allow arbitrary UTF-8 strings as delimiters in listings
AWS seems to support this, so let's allow s3api to do it, too.

Previously, S3 clients trying to use multi-character delimiters would
get 500s back, because s3api didn't know how to handle the 412s that the
container server would send.

As long as we're adding support for container listings, may as well do
it for accounts, too.

Change-Id: I62032ddd50a3493b8b99a40fb48d840ac763d0e7
Co-Authored-By: Thiago da Silva <thiagodasilva@gmail.com>
Closes-Bug: #1797305
2019-09-12 10:44:00 -07:00
Zuul
2cee9f750f Merge "py3: Finish porting func tests" 2019-08-22 08:13:41 +00:00
Zuul
fefa888c4b Merge "Allow "static symlinks"" 2019-08-20 06:20:15 +00:00
Tim Burke
74db367060 py3: Finish porting func tests
We were (indirectly) importing swiftclient (and therefore requests and
urllib3) before doing our eventlet monkey-patching. This would lead
boto3 (which digs an SSLContext out of urllib3) to trip RecursionErrors
on py3 similar to

   >>> from ssl import SSLContext, PROTOCOL_SSLv23
   >>> import eventlet
   >>> eventlet.monkey_patch(socket=True)
   >>> SSLContext(PROTOCOL_SSLv23).options |= 0
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     [Previous line repeated 330 more times]
   RecursionError: maximum recursion depth exceeded while calling a Python object

Change-Id: I4bb59edd87336597791416c4f2a096efe0e72fe3
2019-08-16 20:34:16 -07:00
Zuul
9b4b57a880 Merge "py3: port SLO func tests" 2019-08-17 03:19:22 +00:00
Zuul
202a5d34eb Merge "dlo: Respond 200 on multi-range GETs" 2019-08-17 01:38:19 +00:00
Tim Burke
a21c0be70c dlo: Respond 200 on multi-range GETs
We already had a unit test for this, but it was inadvertently retesting
what test_get_suffix_range_many_segments tested.

Change-Id: I43eee7029ca884268c3f2ad74300b94b299fd8d2
Closes-Bug: #1831790
2019-08-16 16:35:34 -07:00
Tim Burke
7f42309a33 py3: Cover account/container func tests
Change-Id: I9a754f1eb06debbe16800a05fc8e969af2f89043
2019-08-16 10:51:55 -07:00
Tim Burke
1abc9c4f9d Allow "static symlinks"
... by embedding something like `If-Match: <etag>` semantics in the
symlink.

When creating a symlink, users may now specify an optional
X-Symlink-Target-Etag header. If present, the etag of the final object
returned to the client will be checked; if it does not match the
X-Symlink-Target-Etag header, a 409 Conflict error will be returned to
the client.

Note that, unlike "dynamic symlink" behavior, the target object must
exist with the matching Etag for the "static symlink" to be created.

Since we're validating the Etag anyway, we also set the content-type of
the symlink to match if the client didn't otherwise specifiy and send
the etag & content-length along to the container listing as well.

Bonus goodness:

- Tighten assertions on Content-Location
- Get rid of swift.source-sniffing by making versioned_writes
  symlink-aware ('cause I'm going to want to make it symlink-aware
  later anyway)
- Allow middlewares left of symlink to set their own
  Container-Update-Override-Etag when creating a symlink
- Set dynamic symlink content type if client doesn't supply something

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I179ea6180d31146bb947061c69b1807c59529ac8
2019-08-16 11:22:36 -05:00
Zuul
2a54619609 Merge "py3: port dlo func tests" 2019-08-16 13:48:41 +00:00
Zuul
8083255e34 Merge "py3: mostly port s3 func tests" 2019-08-15 01:10:29 +00:00