Files
floci/compatibility-tests/sdk-test-awscli
12154297b5 feat(iam): support account aliases (#2103)
* feat(iam): support account aliases

Implement ListAccountAliases, CreateAccountAlias and DeleteAccountAlias.
An account holds at most one alias: creating a second returns
EntityAlreadyExists, and deleting requires the current alias by name so a
stale value cannot silently clear it.

FLOCI_SERVICES_IAM_ACCOUNT_ALIAS seeds an alias at startup for callers that
expect to read one without creating it first.

Closes #2101

* fix(iam): make account alias create and delete atomic

Concurrent CreateAccountAlias calls could all pass the emptiness check and
write, reporting success to every caller while keeping only one value. Unlike
a named resource, where racing creates carry the same name and either winner
is equivalent, racing alias creates carry different values, so a loser is told
their alias was set when another is stored.

Guard the check-then-write on both create and delete, and cover it with a
concurrency trial asserting exactly one winner. Also track the alias created
by the bats delete case in ACCOUNT_ALIAS so teardown clears it if the test
fails midway.

* fix(iam): match verified AWS account alias semantics and unbreak the test fixture

IamServiceTestHelper resolves the package-private IamService constructor
reflectively against a hardcoded parameter list, so the extra storage backend
broke it at run time with no compile-time signal. Every test using that fixture
errored, and one of them hangs on a socket read rather than failing, which is
what exhausted the CI job. Extend both lookups to the new arity.

Checking the error message against a live AWS account showed the operation
itself was modelled wrongly: CreateAccountAlias does not reject a second alias,
it replaces the current one. EntityAlreadyExists means the requested name is
taken, which for a single-account store is only the alias already held. Create
now replaces and rejects just that case, which also makes the message name the
alias the caller asked for. DeleteAccountAlias applies the same pattern
constraint as create, so a malformed value is a ValidationError.

Concurrent creates therefore all succeed with last-write-wins; the trial now
asserts the store settles on one of the requested values. Seeding logs when it
skips because an alias is already stored, which is otherwise invisible under
persistent storage.

* fix(test): repair iam.bats after the merge fused test bodies

Resolving the merge by keeping both sides concatenated the OIDC and account
alias cases as text, which left the create_oidc_provider helper nested inside an
alias test and dropped a closing brace, so bats could not parse the file and
produced no report at all. Rebuild it from main plus the alias cases, with the
alias tracked in setup and teardown.

* test(iam): pin account alias isolation, and document the two-dash rule

The alias is the only IAM entity keyed by a constant rather than a
caller-supplied name, so every account shares one storage key and the
separation rests entirely on AccountAwareStorageBackend prefixing. Every
integration test here signs as the same account, so that prefixing was never
exercised for aliases. The new case pins it: handing both services the store
unwrapped fails it.

The docs still described the pre-fix constraint. They now carry the
consecutive-hyphen rule and note that the ValidationError message, reproduced
from AWS verbatim, does not itself mention it.

---------

Co-authored-by: Michal Schreiber <michal.p.schreiber@gmail.com>
Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl>
2026-08-14 12:00:14 -04:00
..

sdk-test-awscli

Compatibility tests for Floci using the AWS CLI v2 (2.22.35).

Tests are plain bash scripts that call aws CLI commands with --endpoint-url pointed at the emulator.

Services Covered

Group Description
ssm Parameter Store — put, get, path, tags
sqs Queues, send/receive/delete, attributes
sns Topics, publish, attributes
s3 Buckets, objects, tagging, copy, delete
dynamodb Tables, put/get/update/query/delete items
iam Users, roles, create/get/delete
sts GetCallerIdentity
ses Identities, sending, quotas, notification attributes
secretsmanager Create/get/put/list/tag/delete secrets
kms Keys, aliases, encrypt/decrypt
cognito User pools, clients
s3-notifications S3 → SQS event notifications

Requirements

  • AWS CLI v2
  • bash
  • jq
  • bats-core (installed via just setup-awscli)

Running

# All groups (from compatibility-tests/)
just test-awscli

# Run bats directly
./lib/run-bats-with-junit.sh sdk-test-awscli/test/ sdk-test-awscli/test-results/junit.xml

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-awscli .
docker run --rm --network host floci-sdk-awscli

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