Files
floci/compatibility-tests/sdk-test-java
Kurt McAlpineandkurtmc a7be2dd299 feat(neptune): support the Terraform aws_neptune_cluster read-back contract (#3017)
* feat(neptune): support the Terraform aws_neptune_cluster read-back contract

The Terraform AWS provider's aws_neptune_cluster resource reads back every
DBCluster field after create and update, and treats a mismatch on a ForceNew
attribute as a replacement. Against Floci the resource could not converge:
StorageEncrypted was hardcoded to true against the provider's default of
false, AvailabilityZones was emitted as a singular element that SDK parsers
drop, BackupRetentionPeriod and the other settings were never stored, and
tag calls on a Neptune ARN never reached the Neptune store.

CreateDBCluster and ModifyDBCluster now store the settings a request carries
(NeptuneClusterSettings, modelled on DocDbClusterSettings) and
DescribeDBClusters reads them back with the AWS defaults otherwise:
AvailabilityZones, BackupRetentionPeriod, PreferredBackupWindow,
PreferredMaintenanceWindow, DBSubnetGroup, DBClusterParameterGroup,
VpcSecurityGroups, StorageEncrypted, KmsKeyId, StorageType,
DeletionProtection, CopyTagsToSnapshot, EnabledCloudwatchLogsExports,
ReplicationSourceIdentifier, ServerlessV2ScalingConfiguration,
AssociatedRoles and ClusterCreateTime. StorageEncrypted defaults to false
as on AWS.

Also:
- A requested Port is honoured when it is free inside the proxy range, so
  Terraform's default port of 8182 matches the first cluster.
- DeleteDBCluster refuses a cluster with DeletionProtection enabled with
  InvalidParameterCombination, as on AWS.
- DBClusterMembers uses the DBClusterMember element the Neptune API model
  declares; the previous member element was dropped by SDK parsers.
- New actions: AddRoleToDBCluster, RemoveRoleFromDBCluster,
  DescribeGlobalClusters (empty list), ListTagsForResource,
  AddTagsToResource and RemoveTagsFromResource. Tags are accepted on
  CreateDBCluster and CreateDBInstance, and the rds credential scope routes
  a Neptune ARN ResourceName to the Neptune handler.

Verified against hashicorp/aws 6.62.0 with terraform apply, a clean
re-plan, an update covering retention, protection, log exports, security
groups, iam_roles and tags, a destroy blocked by deletion protection, and a
destroy after disabling it.

* test(compat): cover aws_neptune_cluster in the Terraform and Java SDK suites

Adds a dedicated Terraform fixture and bats test that applies an
aws_neptune_cluster, checks the read-back through terraform output and the
AWS CLI, checks tags through ListTagsForResource, and asserts a clean
re-plan. Extends the Java SDK NeptuneTest with tags, IAM roles, modify
settings, deletion protection and cluster members, so a real SDK parser
covers the new DBCluster fields.

* fix(neptune): infer the rds service for the DBCluster role actions

Unsigned Query requests resolve their service from the action name, and
AddRoleToDBCluster and RemoveRoleFromDBCluster were missing from the RDS
action set, so they fell through to the SQS default instead of reaching
the Neptune handler.

* feat(neptune): read back the settings Terraform's aws_neptune_cluster_instance manages

DescribeDBInstances omitted AutoMinorVersionUpgrade, PromotionTier,
PubliclyAccessible, the parameter and subnet groups and the windows,
ModifyDBInstance ignored them, StorageEncrypted was hardcoded to true,
and every cluster member was reported as the writer, so the provider
issued a ModifyDBInstance on every apply.

NeptuneInstanceSettings, modelled on NeptuneClusterSettings, stores what
a request carries and DescribeDBInstances reads it back with the AWS
defaults otherwise; StorageEncrypted, KmsKeyId and StorageType are the
cluster's. The first member of a cluster is its writer and deleting it
promotes the next. Covered by unit, integration and Java SDK tests and a
Terraform compat fixture with a writer and a reader instance.

---------

Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
2026-09-04 09:45:29 -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