mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
* fix(s3): emit x-amz-transition-default-minimum-object-size on lifecycle GET/PUT (#441) terraform-provider-aws v6.x added a stability wait that compares TransitionDefaultMinimumObjectSize between PUT input and GET output. The AWS SDK v2 reads that field only from the x-amz-transition-default-minimum-object-size response header, never from the XML body. Floci stored lifecycle XML verbatim and never set the header, so the SDK parsed it as null/empty, never matched the provider default (all_storage_classes_128K), and the wait timed out after 3 minutes. Persist the value on the Bucket model, read it from the PUT request header (defaulting to all_storage_classes_128K), and emit it on both PUT and GET responses. DELETE clears it for symmetry. Coverage: - REST Assured tests for default/custom/round-trip/delete-clears. - AWS Java SDK v2 round-trip in S3LifecycleSdkIntegrationTest, the level the existing #492 body-only fix did not exercise. Issue #441 was auto-closed by #492 without a real fix; reopens the underlying defect. * test(s3): move SDK lifecycle round-trip to compatibility-tests - Move S3LifecycleSdkIntegrationTest to compatibility-tests/sdk-test-java as S3LifecycleTest, adapted to use TestFixtures.s3Client() and AssertJ to match the existing compat suite. - Drop the test-scope software.amazon.awssdk:s3 dependency from the main pom.xml; the in-tree JUnit tests do not need an SDK client. - Addresses review feedback on PR #615.
This commit is contained in:
5 files changed
+238
-6
No files matched your search
@@ -121,6 +121,91 @@ class S3LifecycleIntegrationTest {
|
||||
.statusCode(204);
|
||||
}
|
||||
|
||||
// ── x-amz-transition-default-minimum-object-size (issue #441) ────────────
|
||||
// The terraform-provider-aws v6.x stability wait reads this header from
|
||||
// the GET response, not the XML body. Without it, the wait times out.
|
||||
|
||||
private static final String DEFAULT_SIZE = "all_storage_classes_128K";
|
||||
private static final String CUSTOM_SIZE = "varies_by_storage_class";
|
||||
private static final String SIZE_HEADER = "x-amz-transition-default-minimum-object-size";
|
||||
|
||||
@Test
|
||||
@Order(81)
|
||||
void putWithoutHeaderEchoesDefault() {
|
||||
given()
|
||||
.contentType("application/xml")
|
||||
.body(FILTER_PREFIX_EMPTY_XML)
|
||||
.when()
|
||||
.put("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(DEFAULT_SIZE));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(82)
|
||||
void getReturnsDefaultHeaderWhenPutOmittedIt() {
|
||||
given()
|
||||
.when()
|
||||
.get("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(DEFAULT_SIZE));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(83)
|
||||
void putWithCustomHeaderEchoesIt() {
|
||||
given()
|
||||
.contentType("application/xml")
|
||||
.header(SIZE_HEADER, CUSTOM_SIZE)
|
||||
.body(FILTER_PREFIX_EMPTY_XML)
|
||||
.when()
|
||||
.put("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(CUSTOM_SIZE));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(84)
|
||||
void getReturnsCustomHeaderRoundTrip() {
|
||||
given()
|
||||
.when()
|
||||
.get("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(CUSTOM_SIZE));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(85)
|
||||
void deleteThenPutWithoutHeaderClearsToDefault() {
|
||||
// Wipe any stored header value via DELETE.
|
||||
given()
|
||||
.when()
|
||||
.delete("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(204);
|
||||
|
||||
// Subsequent PUT without the header must default, not retain CUSTOM_SIZE.
|
||||
given()
|
||||
.contentType("application/xml")
|
||||
.body(FILTER_PREFIX_EMPTY_XML)
|
||||
.when()
|
||||
.put("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(DEFAULT_SIZE));
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get("/" + BUCKET + "?lifecycle")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.header(SIZE_HEADER, equalTo(DEFAULT_SIZE));
|
||||
}
|
||||
|
||||
// ── No config yet: GET returns 404 ────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user