mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(sqs): drop uppercase "Tags" read from CreateQueue JSON handler (#752)
* fix(sqs): drop uppercase "Tags" read from CreateQueue JSON handler AWS SQS JSON 1.0 schema uses lowercase "tags" for CreateQueue (uppercase "Tags" is reserved for TagQueue). Real AWS treats unknown JSON fields as ignored, so a hand-crafted client sending uppercase "Tags" would lose its tags on AWS — but floci silently persisted them, diverging from AWS behavior and masking client bugs at migration time. Drop the defensive uppercase merge and add JSON-protocol integration tests for both the canonical lowercase path (tags persist) and the uppercase-as-unknown-field path (tags ignored). * test(sqs): wrap CreateQueue-with-tags tests in try/finally for cleanup Wrap CreateQueue + ListQueueTags + DeleteQueue test bodies so the cleanup DeleteQueue runs in a finally block. A failed assertion previously left an orphan queue, which could mask flake under re-runs since CreateQueue is idempotent and won't re-apply tags to an existing queue.
This commit is contained in:
1 parent
15c9f58aae
commit
7a036fdf59
2 files changed
+90
-18
No files matched your search
@@ -272,28 +272,103 @@ class SqsIntegrationTest {
|
||||
.body(containsString(taggedQueueName))
|
||||
.extract().xmlPath().getString("CreateQueueResponse.CreateQueueResult.QueueUrl");
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "ListQueueTags")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
try {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "ListQueueTags")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("k1"))
|
||||
.body(containsString("v1"))
|
||||
.body(containsString("k2"))
|
||||
.body(containsString("v2"));
|
||||
} finally {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "DeleteQueue")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void createQueue_jsonProtocol_withLowercaseTags_tagsReturnedByListQueueTags() {
|
||||
// SQS JSON 1.0 schema uses lowercase "tags" for CreateQueue (cf. uppercase "Tags" for TagQueue).
|
||||
String taggedQueueName = "tagged-queue-json-integration-test";
|
||||
|
||||
String taggedQueueUrl = given()
|
||||
.contentType("application/x-amz-json-1.0")
|
||||
.header("X-Amz-Target", "AmazonSQS.CreateQueue")
|
||||
.body("{\"QueueName\": \"" + taggedQueueName + "\", \"tags\": {\"k1\": \"v1\", \"k2\": \"v2\"}}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("k1"))
|
||||
.body(containsString("v1"))
|
||||
.body(containsString("k2"))
|
||||
.body(containsString("v2"));
|
||||
.extract().jsonPath().getString("QueueUrl");
|
||||
|
||||
// cleanup
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "DeleteQueue")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
try {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "ListQueueTags")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("k1"))
|
||||
.body(containsString("v1"))
|
||||
.body(containsString("k2"))
|
||||
.body(containsString("v2"));
|
||||
} finally {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "DeleteQueue")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void createQueue_jsonProtocol_withUppercaseTags_tagsAreIgnored() {
|
||||
// SQS JSON 1.0 only defines lowercase "tags" for CreateQueue; uppercase "Tags" belongs to
|
||||
// TagQueue and must be treated as an unknown field here, matching real AWS.
|
||||
String taggedQueueName = "ignored-uppercase-tags-queue";
|
||||
|
||||
String taggedQueueUrl = given()
|
||||
.contentType("application/x-amz-json-1.0")
|
||||
.header("X-Amz-Target", "AmazonSQS.CreateQueue")
|
||||
.body("{\"QueueName\": \"" + taggedQueueName + "\", \"Tags\": {\"k1\": \"v1\"}}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
.statusCode(200)
|
||||
.extract().jsonPath().getString("QueueUrl");
|
||||
|
||||
try {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "ListQueueTags")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(not(containsString("<Tag>")))
|
||||
.body(not(containsString("k1")))
|
||||
.body(not(containsString("v1")));
|
||||
} finally {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "DeleteQueue")
|
||||
.formParam("QueueUrl", taggedQueueUrl)
|
||||
.when()
|
||||
.post("/");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user