Files
floci/compatibility-tests/sdk-test-java
floverfelt 846e78db12 feat(cloudwatch): Adds support for orderBy, pagination, limit in DescribeLogStreams response (#2362)
* feat(cloudwatch): support orderBy, descending, limit and nextToken in DescribeLogStreams

DescribeLogStreams previously ignored orderBy, descending, limit and
nextToken: it always returned every stream in the group sorted
ascending by name, so the common SDK idiom for locating the most
recently active stream (orderBy LastEventTime, descending, limit 1)
silently returned the alphabetically-first stream instead.

Sort by lastEventTimestamp when orderBy=LastEventTime (streams without
events sort oldest, name as tie-break), honor descending, and page with
the same integer-offset nextToken idiom DescribeSubscriptionFilters
uses (limit capped at 50, defaulting to 50). Reject the
LastEventTime + logStreamNamePrefix combination and unknown orderBy
values with InvalidParameterException, matching real AWS.

* test(compat): cover DescribeLogStreams ordering, limit and pagination via the Java SDK

Exercises the new orderBy/descending/limit/nextToken support over the
real wire protocol (AWS SDK for Java 2.52.0): orderBy LastEventTime
descending with limit 1 returns the most recently active stream, the
SDK paginator walks every stream exactly once and terminates, and
LastEventTime combined with logStreamNamePrefix is rejected with
InvalidParameterException as on real AWS.

* fix(cloudwatch): make DescribeLogStreams nextToken a stable cursor and reject malformed tokens

Review feedback on the integer-offset token: a non-numeric nextToken was
silently reset to zero, re-serving the first page and making custom
pagination loops duplicate results or stall; and a positional offset
applied to a freshly scanned collection skipped or repeated streams
whenever creates, deletes, or PutLogEvents reordering shifted positions
between page requests.

The token now encodes the sort key of the last returned stream
(base64 of order, direction, lastEventTimestamp, name) and resumption
takes the first stream strictly after that key in the effective
ordering, so mutations between pages cannot shift the resume point.
Malformed tokens and tokens replayed against a different
orderBy/descending combination throw InvalidParameterException.

* fix(cloudwatch): paginate DescribeLogStreams over a snapshot so reordered streams are never skipped

Review feedback on the sort-key cursor: when an unreturned stream
receives a newer event between descending LastEventTime pages, the next
request sorts it ahead of the saved cursor and skips it, so the
paginator terminates without ever returning the stream. No stateless
token can survive that reordering, so the token now references a
server-side snapshot of the sorted stream names taken when the first
page is served, plus a position in it.

Later pages walk the frozen ordering and re-read each stream live:
streams deleted since the snapshot are dropped and attributes are
current, so every stream that existed when pagination started is
returned exactly once regardless of interleaved creates, deletes or
PutLogEvents. Snapshots are TTL-evicted after 15 minutes; unknown,
expired or malformed tokens, and tokens replayed against a different
group, prefix or ordering, throw InvalidParameterException.
2026-08-18 09:28:19 -04:00
..

sdk-test-java

Compatibility tests for Floci using the AWS SDK for Java v2 (2.31.8).

Runs 352 tests across 17 test classes against a live Floci instance — no mocks.

Services Covered

Test class Description
SsmTest Parameter Store — put, get, path, tags
SqsTest Queues, send/receive/delete, DLQ, visibility
SnsTest Topics, subscriptions, publish, SQS delivery
S3Test Buckets, objects, tagging, copy, multipart, batch delete
DynamoDbTest Tables, CRUD, batch, TTL, tags, streams
DynamoDbScanConditionTests Scan filter and condition expressions
LambdaTest Create/invoke/update/delete functions
IamTest Users, roles, policies, access keys
StsTest GetCallerIdentity, AssumeRole, GetSessionToken
SecretsManagerTest Create/get/put/list/delete secrets, versioning, tags
KmsTest Keys, aliases, encrypt/decrypt, data keys, sign/verify
CloudWatchTest PutMetricData, ListMetrics, GetMetricStatistics, alarms
CloudFormationVirtualHostTests Virtual host style S3 access via CloudFormation
ApigwSfnJsonataCrudlTests API Gateway + Step Functions JSONata CRUDL integration
ApiGatewayV2WebSocketAndExtendedOpsTest API GW v2 WebSocket APIs, Update ops, Route/Integration Responses, Models, Tagging
Ec2Tests EC2 instances, VPCs, security groups, subnets
AppSyncTest GraphQL API CRUDL, data sources, resolvers, functions, types, API keys, tags, schema validation
EcsTests ECS clusters, task definitions, services

Adding a New Test

Create a standard JUnit 5 test class in src/test/java/com/floci/test/. Tests run against a live Floci instance using real AWS SDK clients.

Requirements

  • Java 17+
  • Maven

Running

# All tests
mvn test -q

# Specific test class
mvn test -Dtest=S3Test

# Via just (from compatibility-tests/)
just test-java

Configuration

Variable Default Description
FLOCI_ENDPOINT http://localhost:4566 Floci emulator endpoint

AWS credentials are always test / test / us-east-1.

Docker

docker build -t floci-sdk-java .
docker run --rm --network host floci-sdk-java

# Custom endpoint (macOS/Windows)
docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-java