Files
floci/compatibility-tests
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
..

floci-compatibility-tests

Compatibility test suite for Floci — a local AWS emulator.

Verifies that standard AWS tooling (SDKs, CDK, OpenTofu/Terraform) works correctly against the emulator without modification. Tests run against a live Floci instance and use real AWS SDK clients — no mocks.

Quick Start

# Install just (task runner)
# macOS: brew install just
# Linux: cargo install just

# Copy and configure environment
cp env.example .env

# Install dependencies
just setup

# Run all tests
just test-all

# Run specific SDK tests
just test-python
just test-typescript
just test-awscli

Test Runners

Module Language Test Framework Command
sdk-test-python Python 3 pytest just test-python
sdk-test-node TypeScript vitest just test-typescript
sdk-test-awscli Bash / AWS CLI bats-core just test-awscli
sdk-test-java Java 17 JUnit 5 just test-java
sdk-test-go Go 1.24 go test just test-go

IaC Compatibility

Module Tool Command
compat-cdk AWS CDK v2 ./run.sh
compat-opentofu OpenTofu ./run.sh
compat-terraform Terraform ./run.sh

Prerequisites

  • Floci running on http://localhost:4566 (or set FLOCI_ENDPOINT)
  • Docker — required for Lambda invocation tests
  • just — task runner for orchestration

Per-module requirements:

Module Requirements
sdk-test-python Python 3.9+, pip
sdk-test-node Node.js 20+, npm, vitest
sdk-test-awscli AWS CLI v2, bash, jq
sdk-test-java Java 17+, Maven
sdk-test-go Go 1.24+

Setup

# Setup all SDKs
just setup

# Setup individual SDKs
just setup-python      # pip install -r requirements.txt
just setup-typescript  # npm install
just setup-awscli      # Clone bats-core, bats-support, bats-assert

Running Tests

All SDKs

just test-all

Individual SDKs

# Python (pytest)
just test-python

# TypeScript (vitest)
just test-typescript

# AWS CLI (bats-core)
just test-awscli

Bats-based suites keep their normal console output and also write JUnit XML reports:

  • sdk-test-awscli/test-results/junit.xml
  • compat-cdk/test-results/junit.xml
  • compat-terraform/test-results/junit.xml
  • compat-opentofu/test-results/junit.xml

Configuration

All modules read from environment variables (see .env.example):

FLOCI_ENDPOINT=http://localhost:4566
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_DEFAULT_REGION=us-east-1

Running with Docker

Each module includes a Dockerfile for isolated execution:

# Python
docker build -t floci-sdk-python sdk-test-python/
docker run --rm --network host floci-sdk-python pytest

# TypeScript
docker build -t floci-sdk-node sdk-test-node/
docker run --rm --network host floci-sdk-node npm test

On macOS/Windows, use host.docker.internal instead of localhost:

docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-python pytest

Exit Codes

All test runners exit 0 on full pass and non-zero if any test fails — suitable for CI pipelines.