* fix(ec2): tag an AMI with the tags RegisterImage is given RegisterImage never read TagSpecification, so an AMI registered with image tags came back from DescribeImages untagged: its tag filters matched nothing and DescribeTags listed nothing for it. A tag specification for another resource type was accepted as well, although AWS fails that request. RegisterImage now reads its image tag specifications and refuses any other resource type with InvalidParameterValue. It checks the tags as CreateTags does (no aws: prefix, the key and value lengths, at most 50 tags) before registering anything, so a refused request leaves no AMI behind. The tags are stored before the AMI is, so DescribeImages never lists it without them, and a key given twice keeps its last value, as Floci's CreateTags keeps it. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): copy an AMI's tags when CopyImage sets CopyImageTags CopyImage never read CopyImageTags, so a copy asked to carry its source's tags came out untagged, and DescribeImages could not find it by them. With CopyImageTags=true the copy now gets the caller's tags on the source, read in the source region, less the aws: system tags, which AWS does not copy either. Without it, or with false, no tags are copied, which is AWS's default. The source keeps its tags, and the copy's are stored in the destination region only. The tags are read under the source AMI's own id, so a catalog AMI's tags on that id are copied too, while tags put on one of its aliases are not. Floci keeps each account's tags apart, so another account's tags never reach the copy. CopyImage still neither checks nor applies TagSpecification, and the docs now say so. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(ec2): stub the CopyImage overload the handler calls Upstream's handler test for CopyImage tag specifications stubbed the five-argument copyImage. On this branch the handler passes CopyImageTags as well, so the stub never matched, the mock returned null and the test failed with a NullPointerException. It now stubs the six-argument call with CopyImageTags false, which is what a request without it sends. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * refactor(ec2): leave RegisterImage tag specifications to upstream's handling Upstream now reads RegisterImage's TagSpecification in the Query handler, refuses other resource types and checks the tags before the AMI is registered, so this branch's own path for the same thing is a duplicate. The seven-argument registerImage overload and the tag code in registerImageLocked are removed, and RegisterImage goes back to upstream's code. CopyImage stores the tags it copies straight after it registers the copy instead. The branch's RegisterImage tests go too: upstream's Ec2CreateTagSpecificationIntegrationTest and Ec2QueryHandlerTest cover the same behaviour. What the branch adds is CopyImageTags alone. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(ec2): pin a TagSpecification tag over a copied tag of the same key With CopyImageTags=true and an image TagSpecification on the same request, the copy carries both sets. When both name the same key, the TagSpecification value is the one the copy keeps, since the handler applies the specification after the service copies the source's tags. The docs row says so; this test holds it. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): refuse a CopyImage over the tag limit before creating the copy With CopyImageTags=true and an image TagSpecification, the copied and the specified tags were each checked against the 50-tag limit on their own. The service then created the AMI and its snapshots and stored the copied tags, and only the handler's CreateTags of the specification saw the combined set: past 50 it answered TagLimitExceeded while the copy it had just made stayed behind, so a retry under the same Name failed with InvalidAMIName.Duplicate. The handler now passes the requested image tags to the service, which checks the union of copied and requested keys before it registers anything. The upstream handler test stubs the new signature. The docs and the test of a key given both ways now say that the TagSpecification value winning is Floci's behaviour: the public CopyImage reference does not say how AWS settles that. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * refactor(ec2): keep one CopyImage service signature --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
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_REGION |
us-east-1 |
Region the TestFixtures clients sign for |
AWS credentials are always test / test. Setting AWS_REGION=cn-north-1 (with Floci started
with FLOCI_DEFAULT_REGION=cn-north-1) runs the suite in the China partition; the nightly
Partition Compatibility workflow does exactly that, and tolerates only the failures listed in
.github/ci/compat-partition-allowlist-cn-north-1.txt. Tests that build their own client with an
explicit region keep that region.
STS presigned identity checks
StsPresignedIdentityTest checks user and role identity over HTTP/1.1 and HTTP/2.
Valid identity requests run in both modes. Forged signatures and changed bodies are
sent only when signature checking is enabled. To check signature refusal, start Floci
with FLOCI_AUTH_VALIDATE_SIGNATURES=true and pass the same setting to this test:
FLOCI_AUTH_VALIDATE_SIGNATURES=true mvn test -Dtest=StsPresignedIdentityTest
The test setting must match the server setting; it does not configure the server. The enabled mode also checks missing and incorrect temporary-session tokens.
Metric filter publishing checks
CloudWatchLogsMetricFilterTest and CloudFormationLogsMetricFilterTest run
with the rest of the suite. Against a server on another port:
# From compatibility-tests/sdk-test-java
FLOCI_ENDPOINT=http://127.0.0.1:18084 ../../mvnw test \
-Dtest=CloudWatchLogsMetricFilterTest,CloudFormationLogsMetricFilterTest
The publishing tests read their expected values from
src/test/resources/cloudwatchlogs/metric-filter-publishing-aws.json, a
byte-identical copy of the root fixture recorded from AWS. MetricFilterFixturePackagingTest
checks the copy loads from the classpath, and the root
CloudWatchLogsMetricFilterFixturePackagingTest fails when either SDK module
copy drifts from the root file. The SDK selects the CloudWatch JSON protocol;
MetricFilterQueryAssertions signs the same reads as legacy form-encoded Query
requests, so GetMetricStatistics and GetMetricData on both wire formats are
asserted against every statistic the fixture records (Sum, SampleCount, Minimum,
Maximum). Reads poll for the sample, since the server publishes it shortly after
PutLogEvents returns. Passing
these tests shows Floci matches the recorded values; it is not live AWS
verification. For the opt-in replay against AWS see ../sdk-test-python/README.md.
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