* fix(cloudwatch): evaluate composite alarms with CloudWatch's reasons and refusals
Composite alarms recorded "AlarmRule evaluated to <state>" with no
StateReasonData, were evaluated only when created, accepted a rule
naming an alarm that does not exist, and let DeleteAlarms remove an
alarm a composite alarm still names. Published CloudWatch captures
show each one differently.
- A change of state records the StateReason CloudWatch writes: "<arn>
was created and its alarm rule evaluates to OK", "<arn> was updated
and its new alarm rule evaluates to ALARM", or "<child arn>
transitioned to ALARM at Monday 14 September, 2026 06:29:58 UTC".
- StateReasonData lists triggeringAlarms: the children whose state
agrees with the new one, most recently changed first. After a child's
change only the children that changed since the composite alarm last
did are listed; the alarm history orders those changes.
- PutCompositeAlarm evaluates an alarm it updates, and its parents
follow the change.
- A rule naming a missing alarm is refused with "Could not save the
composite alarm as alarms [<arn>] in the alarm rule do not exist".
- DeleteAlarms deletes nothing when it names an alarm a composite alarm
references ("Cannot delete <name> as there are composite alarm(s)
depending on it.", or "a,b ... depending on them."), or more than one
composite alarm ("Cannot delete [2] Composite Alarms as only one
composite alarm delete is allowed in single request").
The new service, Query, JSON and SDK tests fail on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudformation): cover a composite alarm over its stack's metric alarm
A stack whose composite alarm names the stack's own metric alarm is
created child first and deleted parent first, so neither the new
refusal of unknown children nor the refusal to delete a referenced
alarm fails it. A stack whose rule names a missing alarm rolls back
with CloudWatch's message; that test fails on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): evaluate composite alarms only when a child changes state
Review follow-ups to the composite alarm evaluation change.
- A child's PutMetricAlarm update, or a SetAlarmState to the state it
already has, no longer re-evaluates its parents. CloudWatch documents
that a composite alarm set with SetAlarmState "returns to its actual
state only once any of its children alarms change state"; such a
parent used to flip back with a reason naming an old transition.
- Application Auto Scaling deletes a policy's alarms one at a time, so
when a composite alarm names one of them only that one stays.
- A changed child that no longer resolves leaves its parent as it is
instead of failing the request.
- The docs say that an update closing a cycle is not evaluated, where
CloudWatch evaluates it.
- Tests: the wire and SDK tests ignore missing data so the alarm
evaluator cannot reset the states they set, one pins the reason when
two children change together, and the self-reference and cross-region
assertions, which pinned texts CloudWatch does not use, are gone.
The new manual-state and Application Auto Scaling tests fail without
this change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): evaluate composite alarms above a cycle
A composite alarm on a cycle stayed pending, which blocked every
composite alarm above it: one whose other child changed state was never
evaluated. Alarms on the cycle are still not evaluated, but they no
longer hold up the ones above them.
Also from the second review: the docs say only a metric alarm child's
update is not a change of state, and that alarms above a cycle are
evaluated; a test covers a rule stored before missing children were
refused, whose child is created later; a test docstring links the
SetAlarmState reference.
The test for an alarm above a cycle fails without this change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* chore(cloudwatch): log a composite evaluation that stops with alarms pending
The third review found one way the evaluation can still stop with
alarms pending: an alarm named like another alarm's ARN makes the cycle
check follow the wrong rule. The debug line removed in the previous
commit is back, so that case is visible again; the name lookup itself
predates this branch. The docs say an alarm above a cycle is evaluated
when one of its children changes state.
No behaviour change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): count composite StateReasonData in code points
triggeringAlarms stopped adding children once the serialized JSON
passed 4000 UTF-16 units, while the StateReasonData length check
counts Unicode code points, as Smithy's length constraint counts
Unicode scalar values. An emoji is two units but one code point, so
children whose entries still fit were dropped. The cap now counts code
points, shares its constant with SetAlarmState's length check, and the
docs say so.
The new test names fifteen children with emoji and a newest one with a
short name, so that twelve entries come to exactly 4000 code points. It
lists 7 of them before this change and all 12 after; an exclusive cap
would list 11.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudwatch): keep the composite alarm SDK test on Java 17 APIs
CloudWatchCompositeAlarmTest called List.getFirst(), which Java 21
added. compatibility-tests/sdk-test-java compiles for Java 17, and CI
builds it in maven:3.9-eclipse-temurin-17, so its test-compile failed
and took the sdk-test-java and ec2-containers jobs with it. The three
calls use get(0) now.
A test-compile of sdk-test-java with --release 17 fails on those three
lines before this change and passes after it. No other file of the
branch is outside the root module, which builds for Java 25.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
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