mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(sqs): omit Messages field from empty ReceiveMessage JSON response (#780)
* fix(sqs): omit Messages field from empty ReceiveMessage JSON response Real AWS SQS omits the Messages field entirely when a ReceiveMessage call returns no messages. With AWSConfigs.InitializeCollections=false (the modern AWS SDK default) the SDK leaves the response collection as null in that case, which several parity tests assert. Floci was emitting "Messages": [] instead, so the SDK deserialized it to a non-null empty list. This broke the StartMessageMoveTask family of tests (which drain a freshly-created queue and assert null) and ~12 other tests in the .NET conformance sweep. Refs #768. * test(pipes): handle empty AWS CLI output in stopped-pipe assertion After the SQS ReceiveMessage fix, an empty queue response is `{}` instead of `{"Messages": []}`. The AWS CLI may emit an empty string in that case, which makes `jq` fail and leaves msgs as empty, breaking the assertion. Default $out to `{}` so the .Messages // [] fallback applies cleanly.
This commit is contained in:
1 parent
483a060bff
commit
7516acb5f9
3 files changed
+39
-1
No files matched your search
@@ -174,6 +174,38 @@ class SqsJsonProtocolTest {
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
void receiveMessageOnEmptyQueueOmitsMessagesField() {
|
||||
// AWS omits the Messages field entirely when no messages are available.
|
||||
// The .NET SDK with InitializeCollections=false then leaves the
|
||||
// response collection as null. Floci previously returned "Messages": []
|
||||
// which broke parity tests asserting null.
|
||||
String emptyQueueName = QUEUE_NAME + "-empty";
|
||||
String createBody = "{\"QueueName\":\"" + emptyQueueName + "\"}";
|
||||
String emptyQueueUrl = given()
|
||||
.contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "AmazonSQS.CreateQueue")
|
||||
.body(createBody)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().jsonPath().getString("QueueUrl");
|
||||
|
||||
String body = "{\"QueueUrl\":\"" + emptyQueueUrl + "\",\"MaxNumberOfMessages\":1}";
|
||||
|
||||
given()
|
||||
.contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "AmazonSQS.ReceiveMessage")
|
||||
.body(body)
|
||||
.when()
|
||||
.post("/" + ACCOUNT_ID + "/" + emptyQueueName)
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("$", not(hasKey("Messages")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(8)
|
||||
void deleteQueueViaQueueUrlPath() {
|
||||
String body = "{\"QueueUrl\":\"" + queueUrl + "\"}";
|
||||
|
||||
|
||||
Reference in new issue
Block a user