mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -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
@@ -175,6 +175,12 @@ public class SqsJsonHandler {
|
||||
visibilityTimeout, waitTimeSeconds, region);
|
||||
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
// Match AWS: omit the Messages field entirely when no messages are
|
||||
// available, so SDK clients with InitializeCollections=false see null
|
||||
// instead of an empty list.
|
||||
if (messages.isEmpty()) {
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
ArrayNode messagesArray = response.putArray("Messages");
|
||||
for (Message msg : messages) {
|
||||
ObjectNode msgNode = objectMapper.createObjectNode();
|
||||
|
||||
Reference in new issue
Block a user