404edeb7fa68730fd95682cb96e0f39ee51051d0
Commit Graph

6025 Commits

Author SHA1 Message Date
Zuul
7662cde704 Merge "Add oldest failed async pending tracker" 2024年11月05日 08:22:10 +00:00
Alistair Coles
639251d4c5 slo: add more functional tests for copying
Add functional tests for copying from an SLO using PUT requests with
an x-copy-from header.
Add functional tests for copying from an SLO using part-number parameter.
Change-Id: Ic40c4b104b11de9ab09485e82543521b37ea1daa
2024年11月04日 11:21:07 +00:00
Chinemerem
0a5348eb48 Add oldest failed async pending tracker
In the past we have had some async pendings that repeatedly fail for months at a time. This patch adds an OldestAsyncPendingTracker class which manages the tracking of the oldest async pending updates for each account-container pair. This class maintains timestamps for pending updates associated with account-container pairs. It evicts the newest pairs when the max_entries is reached. It supports retrieving the N oldest pending updates or calculating the age of the oldest pending update.
Change-Id: I6d9667d555836cfceda52708a57a1d29ebd1a80b
2024年11月01日 15:49:53 -07:00
Zuul
5ee1e72c0b Merge "object-expirer: add round_robin_cache_size option" 2024年11月01日 16:59:05 +00:00
Zuul
6221e5d8c1 Merge "test-expirer: call tracking & exception stubs" 2024年11月01日 16:59:02 +00:00
Clay Gerrard
df22032d79 object-expirer: add round_robin_cache_size option
Drive-Bys:
 * DRY out redundent configuration examples in expiring objects overview
 documentation.
 * Add missing delay_reaping man page docs.
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Change-Id: I8879dbd13527233c878dff764ec411ce9619ee39
2024年11月01日 09:54:54 +00:00
Clay Gerrard
31ef443715 test-expirer: call tracking & exception stubs
This change enhances the FakeInteralClient to make it easier to use the
existing stubs to test error handling behaviors and make assertions
about the behaviors.
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Change-Id: Ib652a752ba91dbc791eef2a1d6940bcb0d16e36a
2024年11月01日 09:37:01 +00:00
Tim Burke
c3f1ed3df1 CI: Move a bunch of func test jobs from py38 to py312
Change-Id: I8c65c7829fbe167e0c79239d577c38e90b93b5cf
2024年10月31日 11:05:15 -07:00
Tim Burke
b2386b9947 s3api: Stop upper-casing request-method for signatures
The AWS behaviour is weird: if I have my client signer always use
the casing that will be sent on the wire, I reliably get back 405s,
but if my client signer always converts to upper-case despite
sending lower-case on the wire, it's roughly a coin toss for whether
I get back a 405 or a 403 (with the string-to-sign indicating that
the server was expecting lower-case). This is true for both v2 and
v4 signatures, both in headers and in query params.
Logically, though, it seems like using what's on the wire *ought* to
be the way to go, and AWS's consistency in that case lends some
credibility.
Unfortunately, that breaks an existing functional test unless awscrt
is installed, as boto3 (or botocore? somebody) will upper-case the
request method by default, but trusts awscrt to handle things if
available. So skip the part of the test that uses a lower-cased
request method if we can't import awscrt.
Change-Id: Ia6cacc51b2744986e703469f9e5215209194de8a
2024年10月25日 20:28:02 +00:00
Clay Gerrard
7a6dc095b4 functest: do not use account2 unless needed
Change-Id: I224e8706f1ee72b718e35a25ea417a1cf3a35938
2024年10月21日 15:35:24 -05:00
Anish Kachinthaya
4f69ab3c5d fix x-open-expired 404 on HEAD?part-number reqs
Fixes a bug with the x-open-expired feature where our magic header
does not get copied when refetching all manifests that causes
404 on HEAD requests with part-number=N query parameter since
the object-server returns an empty response body and the
proxy needs to refetch. The fix also applies to segment GET
requests if the segments have expired.
Change-Id: If0382d433f73cc0333bb4d0319fe1487b7783e4c
2024年10月18日 18:33:09 +00:00
Zuul
a427d2754f Merge "trivial: Default value for EUCLEAN" 2024年10月14日 10:16:40 +00:00
Zuul
a2e8cf08d5 Merge "FakeSwift: capture unexpected calls" 2024年10月12日 04:47:47 +00:00
Alistair Coles
056b2afbd7 FakeSwift: capture unexpected calls
Previously FakeSwift would raise a KeyError for a call that had no
matching registered response *before* capturing the call. This
prevents tests reliably asserting that only expected calls have been
made. In particular, if the code being tested handles the KeyError
gracefully then it was possible to write quite reasonable test
assertions that passed despite unexpected calls being made.
Tests in test/unit/container/test_reconciler.py seem to rely on this
behaviour, so this patch adds a capture_unexpected_calls option for
FakeSwift which defauts to True. This allows the reconciler tests to
opt out of the new stricter call capturing.
Change-Id: Idc6b6b5a2b665538e861700f5d0996fc39368f5b
2024年10月11日 14:31:36 +01:00
Tim Burke
d0b190f64a trivial: Default value for EUCLEAN
Apparently errno.EUCLEAN is not available on OS X, which can complicate
running unit tests.
Change-Id: Iaa3d7756949b4a67d4afe8a53b242ed9f41e9374
2024年10月11日 14:21:30 +01:00
Jianjian Huo
7980b6a0d3 Object-expirer: continue to process next container on listing errors
When Expirer is iterating task containers and doing listings, it's
possible one of the container nodes hosting the task container may
become overloaded (or have a really low backend ratelimit set).
Object-expirer should expect UnexpectedResponse and continue to try
and list the task objects in the next container.
And if the task container doesn't exist, expirer should not try to
delete the non-existent containers, before continue to work on
the next container.
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Change-Id: Id1966fa22725a02471e2d7c5a42fb243b1cfcf6a
2024年10月04日 13:47:55 -07:00
Zuul
02b17e43f6 Merge "Make object-expirer respect internal_client_conf_path" 2024年10月03日 11:22:21 +00:00
Chinemerem
ee80f99aec Make object-expirer respect internal_client_conf_path
Previously the object-expirer would not respect an internal_client_conf_path option if its config was loaded from a "legacy" config filepath (e.g. **/object-expirer.conf). Legacy object-expirer config expected config sections for an internal-client to be included in the same file. However, "modern" object-expirer config files (e.g. **/object-server.conf) expect internal-client config to be loaded from a separate file specified by internal_client_conf_path and defaulting to 'internal_client_conf_path'.
"Legacy" expirer config is still used in production clusters but it is useful to use a shared internal-client config. This patch therefore makes the internal_client_conf_path option always be respected regardless of the path of the object-expirer conf file. If 'internal_client_conf_path' is not specified, "modern" config will continue to use the default '/etc/swift/internal-client.conf', but "legacy" config will default to the path of the expirer conf file (i.e. the same as the previous behavior).
Related-Change: Ib21568f9b9d8547da87a99d65ae73a550e9c3230
Change-Id: I24ec702cd2ed074ca9df084cefc896418cece394
2024年10月02日 08:57:33 -07:00
Zuul
4807999749 Merge "func tests: fix etag-quoter insertion in pipeline" 2024年09月26日 21:20:21 +00:00
Zuul
b0138f3a7b Merge "trivial: remove print from functional tests" 2024年09月26日 19:33:55 +00:00
Alistair Coles
6e4ecfc5dc proxy: fix is_useful_response for py2
py2 http responses don't have a 'headers' attribute, so don't try to
use it.
Unfortunately the unit test infrastructure's FakeConn class does
have a 'headers' attribute (whose value doesn't match the result of
calling its 'getheaders()' method!), so this bug was not caught by
tests in the Related-Change.
Related-Change: I96f28ab0b2b5f9374c399e8905ee240e7b093f8b
Change-Id: I2cd820280b8c69cafc5730183903c9d379d8dde5
2024年09月26日 16:01:36 +01:00
Alistair Coles
86081b7822 func tests: fix etag-quoter insertion in pipeline
Previously the in-process functional test setup attempted to insert
etag-quoter in the proxy pipeline by replacing the substring 'cache
listing_formats' with 'cache etag-quoter listing_formats'. However,
the pipeline had already been modified to have 'cache domain-remap
listing_formats', so the etag-quoter replacement failed silently.
This patch modifies the etag-quoter replacement to match just
'cache'. Some helper functions are also introduced to make the
pipeline modification more uniform and to consistently verify the
intended modifications have been achieved, or otherwise raise an
exception.
Change-Id: I640837a4da985bcbe48f9ae5eeb56385b11034eb
2024年09月26日 13:31:30 +01:00
Alistair Coles
81547cb67d trivial: remove print from functional tests
A print statement, presumably for debugging, crept in with the
Related-Change.
Change-Id: I0cccb960b51446a3aa58be95c8c9d06cc6b6eada
Related-Change: I69974cc8a39731c980b54137b799a36b2e63a44a
2024年09月26日 13:31:30 +01:00
Alistair Coles
60c0ab2ea0 Quiten boto logging in func tests
Some s3api functional tests were setting boto logging level to DEBUG,
which results in a very large amount of logging output from the test
runner, including large request bodies. This makes it extremely hard
to inspect test output.
This patch makes the quiet_boto_logging context manager revert the
logger level to its original value rather than indiscriminately
leaving it set to DEBUG.
Change-Id: I1dd9603adf9a19e89da5a461d3c6810a3432ae46
2024年09月20日 15:59:04 +01:00
Alistair Coles
ffdf962598 object-expirer: fix unused _make_internal_client arg
The RelatedChange introduced a _make_internal_client() method with an
unused argument 'is_legacy_conf'. This patch completes the original
intention i.e. for the selection of internal client config path to
also be moved to the new method and use the 'is_legacy_conf' arg.
Change-Id: I5075cb446a15edc7f47e83f6aa038c626bd1dd82
RelatedChange: Ia6e1e6a8b58a8476fa16a3c7d45e620c6d7f88e4
2024年09月11日 10:13:23 +01:00
Zuul
8efb333872 Merge "diskfile: Treat EUCLEAN like ENODATA" 2024年09月10日 10:23:03 +00:00
Zuul
98eb28d510 Merge "utils: paths with empty components are invalid" 2024年09月10日 03:03:09 +00:00
Zuul
5726778ab6 Merge "functest: add checks for quota count API" 2024年09月09日 22:45:00 +00:00
Zuul
146bfeb643 Merge "proxy-logging: Clean up some timing assertions" 2024年09月09日 13:39:36 +00:00
Chris Smart
112423f59c functest: add checks for quota count API
The account quota middleware was missing tests for the new quota count
API and it was also only testing the legacy API for quota bytes.
This adds the new APIs quota bytes and quota count to the functional
tests.
Change-Id: I6ebb19c90dfb1cfbe0535ed3860f2319e5153c05
2024年09月09日 16:39:24 +10:00
Tim Burke
015cbaac86 utils: paths with empty components are invalid
Note that you can still have a "//" in the path with rest_with_last, though.
Change-Id: I171afcd67b162634189b752ff92a4f43484bc12a
2024年09月06日 14:51:44 -07:00
Tim Burke
7be25604db proxy-logging: Clean up some timing assertions
Related-Change: I526bbcc59c9eb5923c3784d5d06bc38998cb48db
Change-Id: I820339934f895557ebcde4bb32168b0cfc494948
2024年09月06日 14:51:23 -07:00
Daanish Khan
4eefae2482 account_quota: migrate quota_bytes and quota_count to the sysmeta namespace
Account quota metadata such as quota_bytes and quota_count are stored in
the `meta` namespace which users have access to. However, this should be
only available to reseller admins.
This patch adds support for writing the quota metadata to `sysmeta`
namespace, so that it is not accessible by users. The account policy
quota is already using `sysmeta` and has the namespace
`X-Account-Quota-*`, so we are following this pattern.
If present, `X-Account-Quota-Bytes` is always preferred. However, in
order to maintain backwards compatibility, `X-Account-Meta-Quota-Bytes`
will still be honoured if it exists and `X-Account-Quota-Bytes` is not
present.
This also adds some new "legacy" tests to validate backwards
compatibility.
Co-authored-by: Azmain Adib <adib1905@gmail.com>
Co-authored-by: Daanish Khan <daanish1337@gmail.com>
Co-authored-by: Mohammed Al-Jawaheri <mjawaheri02@gmail.com>
Co-authored-by: Nada El-Mestkawy <nadamaged05@gmail.com>
Co-authored-by: Tra Bui <trabui.0517@gmail.com>
Co-authored-by: Chris Smart <distroguy@gmail.com>
Change-Id: Icf7b26023ab5b84136ceaa103fa2797534320f1a
2024年09月06日 14:29:01 -07:00
Tim Burke
cd0fe25da1 account_quotas: Fix X-Remove-Account-Quota-Bytes-Policy-<name>
Previously, this would reduce the account's quota to zero, which seems
like the opposite of what the operator intended.
Now, remove the quota, similar to sending an empty quota header.
Change-Id: Ic28752d835e0b970f2baa4e68cbfcde4f500b3d4
2024年09月06日 14:29:01 -07:00
Tim Burke
cd288b183d tests: Functionally test account quotas
Change-Id: Ied0ff6bea7e054fad3fe9579c85d9ae5c9c0b255
2024年09月06日 14:29:01 -07:00
Zuul
e9557f3d4b Merge "Fix proxy logging api version" 2024年09月04日 21:00:21 +00:00
Zuul
dd19613cc2 Merge "s3api: Clean up some errors" 2024年09月04日 18:11:48 +00:00
Zuul
aa04c3eb9c Merge "Ignore 404s from handoffs when choosing response code" 2024年09月04日 18:11:46 +00:00
Tim Burke
7bf2797799 s3api: Clean up some errors
- SHA256 mismatches should trip XAmzContentSHA256Mismatch errors,
 not BadDigest. This should include ClientComputedContentSHA256 and
 S3ComputedContentSHA256 elements.
- BadDigest responses should include ExpectedDigest elements.
- Fix a typo in InvalidDigest error message.
- Requests with a v4 authorization header require a sha256 header,
 rejecting with InvalidRequest on failure (and pretty darn early!).
- Requests with a v4 authorization header perform a
 looks-like-a-valid-sha256 check, rejecting with InvalidArgument
 on failure.
- Invalid SHA256 should take precedence over invalid MD5.
- v2-signed requests can still raise XAmzContentSHA256Mismatch errors
 (though they *don't* do the looks-like-a-valid-sha256 check).
- If provided, SHA256 should be used in calculating canonical request
 for v4 pre-signed URLs.
Change-Id: I06c2a16126886bab8807d704294b9809844be086
2024年09月03日 17:26:41 -07:00
Zuul
ec8166be33 Merge "tests: Attempt to use configured tmp in xprofile tests" 2024年08月28日 23:43:28 +00:00
Tim Burke
5e07963548 diskfile: Treat EUCLEAN like ENODATA
Found a new way filesystems can break in prod:
 object-auditor: ERROR Trying to audit .../7a7c4af06d2616f23eda274e2ad9c948:
 Traceback (most recent call last):
 File ".../swift/obj/diskfile.py", line 2630, in open
 files = os.listdir(self._datadir)
 OSError: [Errno 117] Structure needs cleaning: .../7a7c4af06d2616f23eda274e2ad9c948
 During handling of the above exception, another exception occurred:
 Traceback (most recent call last):
 File ".../swift/obj/auditor.py", line 238, in failsafe_object_audit
 self.object_audit(location)
 File ".../swift/obj/auditor.py", line 261, in object_audit
 with df.open(modernize=True):
 File ".../swift/obj/diskfile.py", line 2657, in open
 "Error listing directory %s: %s" % (self._datadir, err))
 swift.common.exceptions.DiskFileError:
 Error listing directory .../7a7c4af06d2616f23eda274e2ad9c948:
 [Errno 117] Structure needs cleaning: '.../7a7c4af06d2616f23eda274e2ad9c948'
Change-Id: If6731a6b6b16fbc4eebb61254ed10b53e1767a0f
2024年08月28日 15:58:03 -07:00
Matthew Oliver
becb3ffc1a tests: Attempt to use configured tmp in xprofile tests
My home server has more strict controls on /tmp as it run selinux etc.
When running unittests and the default log_filename_prefix deep under
/tmp gets permission denied. It would be better to override this setting
in the tests with a good known tmp location
Change-Id: I6c95ca3a0045a8f268802c6abb633bdfb0e56b73
2024年08月28日 12:26:49 -07:00
Yan Xiao
26de169ad3 Fix proxy logging api version
Change-Id: If5793d1b18cf8f35b8f98206f029f6cc6ca0cf1e
2024年08月26日 09:58:27 -04:00
Alistair Coles
d0f6a0ce56 Ignore 404s from handoffs when choosing response code
Previously, when handling an object POST, if the proxy got a 202 and
two connection timeouts from the 3 primary backend object servers, it
then went to two handoffs which return 404. The proxy would consider
this to be a quorum of 404s and return the client a 404 response. This
is alarming for the client.
With this patch, the proxy will only treat a 404 response from a
handoff as authoritative if it has an x-backend-timestamp header
(i.e. there's a tombstone on the handoff). POST responses never have
an x-backend-timestamp header so in the scenario described above the
proxy will return a 503.
The Related-Change previously made a similar fix such that 404s from
handoffs are already non-authoritative for object GETs and HEADs
unless they have an x-backend-timestamp header.
Related-Change: Ia832e9bab13167948f01bc50aa8a61974ce189fb
Cloeses-Bug: #2077743
Change-Id: I96f28ab0b2b5f9374c399e8905ee240e7b093f8b
2024年08月23日 16:14:34 +01:00
Alistair Coles
92eebe24c6 Improve test coverage for proxy object DELETE and POST
Add unit tests for the proxy object controller to cover object DELETE
and POST scenarios.
Change-Id: I625a4cf03ee9d4a270d60fa2dc9795b36bb36bf1
2024年08月23日 16:14:34 +01:00
Alistair Coles
d830703a32 Setup proxy object GET and HEAD tests correctly
Some unit tests for the proxy object GET and HEAD path were setup with
insufficient mock responses. The mock connection would raise
StopIteration exceptions once the mock responses were exhausted, which
the object controller would handle as if they were error responses,
potentially distorting the test scenario.
This patch makes the set_http_connect context manager check for
unexpected requests and raise an AssertionError if any are found.
Change-Id: I47774396d9d0a78ebceea6c628c9412b3ad67a11
2024年08月22日 12:11:47 +01:00
Matthew Oliver
e6b73612d1 FakeStatsdClient: Stop issuing DNS calls for host.
Running unittests on my home server, even though is a beast, would be
painfully slow. Running them on my laptop ran much faster. I tried
everything and couldn't figure it out.
Chris, co-author, dug in and after we ran out of options he fired up his
packet capture and realised most tests were issuing DNS queries for
`host.`. On my home server, it runs ipv6 dual stack, so these calls
would need to timeout before a test can continue.
On finding this `host.` Ben, another co-author, dug into the code and
found the only reference we have to `host` is in FakeStatsdClient.
Sure enough as I dug a little further it turns out our FakeStatsdClient
used to override a StatsdClient function `_determine_sock_family(self,
host, port)` to stop actually creating a real socket.
However, at some point the StatsdClient was refactored and that method
was renamed and changed. Which leads to a DNS lookup every time we
create a debug_logger as it brings up the socket.
As you can imagine, this happens alot!
This patch overrides the new function that handles to socket creation
`_set_sock_family_and_target(self, host, port)`. Which eliminates the
DNS call all together.
Co-Authored-By: Ben Formosa <bformosa@nvidia.com>
Co-Authored-By: Chris Smart <csmart@nvidia.com>
Change-Id: Ie393075f79447627714692e3f01bb53e967a71e8
2024年08月13日 17:04:40 +10:00
Zuul
1d5e65ce6a Merge "Move utils/logs.py related tests out of test_utils" 2024年08月12日 19:10:36 +00:00
Shreeya Deshpande
f5a8851dae Move utils/logs.py related tests out of test_utils
Change-Id: Ie73988edf6be0e38d9004bee04ff46c906a759ff
2024年08月08日 15:35:00 -04:00
Alistair Coles
6a5a681227 tests: don't mutate and re-use Response headers
Some tests in test_account_quotas.py registered a response with
FakeSwift during setUp and then subsequently mutated the response's
headers dict. Worse, some tests then mutate the headers again and
re-use the same response.
This relies on the FakeSwift implementation not copying the original
headers when the response is registered, which may not remain the case
(as the author discovered with the Related-Change). It's also an
unnecessary shortcut.
Change-Id: I3217c17936d0c11b03de4a4a172bb2fb0a2be734
Related-Change: I84604a7ea049850ad4d0f0cea2096ab8a98dfb4a
2024年08月07日 18:44:06 +01:00