Files
floci/compatibility-tests/sdk-test-java
Olamide Kosile 974d357f88 fix(compat): retry RedshiftTest's SDK calls past a brief connection-refused hiccup (#3216)
* fix(compat): retry RedshiftTest's SDK calls past a brief connection-refused hiccup

github.com/floci-io/floci/issues/2789: testCreateCluster/testDeleteCluster
intermittently fail native/sdk-test-java CI with Connection refused on PRs
that never touch Redshift or networking. The AWS SDK's own 4 built-in
attempts total under a second of backoff, and the failure persists past
CI's "wait for floci to be ready" step reporting success - consistent
with a brief port-publish/network-alias hiccup between the test runner
and floci containers that self-resolves almost immediately, just not
within a second.

Wraps each SDK call in a 30-second retry loop that only catches
SdkClientException (connectivity failures), so a genuine service-level
error (e.g. ClusterAlreadyExists) still surfaces immediately instead of
being retried into a timeout. Mirrors the retry pattern RedshiftOperationsTest
already uses successfully for its JDBC connection in the same module.

Verified against a local floci instance: testCreateCluster and
testDeleteCluster pass. Could not reproduce the actual CI-only race
locally (same as the issue reporter, who diagnosed it from CI logs only).

* fix(compat): narrow RedshiftTest's retry to the diagnosed connection-refused failure

pgermosen (review): catching the whole SdkClientException hierarchy also
retries failures that can happen after floci already processed the
request, e.g. a response reset mid-stream on createCluster/deleteCluster.
Retrying those resubmits and gets back a real ClusterAlreadyExists/
ClusterNotFound instead of the connection-refused flake this PR targets,
masking the original failure behind an unrelated one.

Narrows the catch to only retry when a ConnectException (the pre-handshake
"Connection refused" this was diagnosed from) is in the cause chain;
any other SdkClientException now propagates immediately.
2026-09-09 15:32:48 -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