Files
floci/compatibility-tests/sdk-test-awscli
Jackson Price 3cb1643d30 fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias (#5744)
* fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias

Point the alias AutoPublishAlias generates at the Version attribute of
the generated AWS::Lambda::Version, as SAM does, instead of $LATEST,
and name that version as SAM names it: <Function>Version plus the
first ten hex digits of the SHA-1 of the function's code, with
template parameters resolved as a Ref or as ${Name} in an Fn::Sub,
merged with its Environment and MemorySize, as sorted compact JSON
escaped the way Python's json.dumps escapes it. Under
AutoPublishAliasAllProperties the hash covers every property floci
gives the function. A string AutoPublishCodeSha256 takes the hash's
place with its first ten characters. As in SAM, the version is
retained (DeletionPolicy: Retain) unless the function says otherwise,
and version properties of the wrong type are refused.

With the alias on the published version, a template change to the
code names a new version resource, which publishes, and the alias
moves to it, while changes made to $LATEST outside the stack no longer
reach the alias. The $LATEST pin worked around #1987 and #1988: a cold
invoke of a published version timed out, and a warm $LATEST container
served version-qualified invokes. Both are fixed on main.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): hash an applied SnapStart into the SAM version id

SAM adds a function's SnapStart to the hash behind the AutoPublishAlias
version's logical id when its ApplyOn is anything but None, so turning
SnapStart on names a new version, which publishes and gets its
snapshot. Without it a SnapStart function got a different id than SAM
gives it, and changing SnapStart published nothing. Under
AutoPublishAliasAllProperties SnapStart is hashed like the other
properties.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): resolve SAM destination types with parameterValue

destinationType repeated the parameter lookup parameterValue already
does for the version hash: the stack's value, else the Default. Use the
one helper. A non-string Default still names no destination type.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): describe the SAM version hash in SAM terms

Reword the comments and test names around the AutoPublishAlias version
id to state what SAM and CloudFormation do, rather than how another
project or language implements it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): hash a null SnapStart ApplyOn and state what it changes

SAM leaves SnapStart out of the version hash only when ApplyOn is
missing or "None"; a null ApplyOn is hashed. The check read a null as
"None".

floci does not pass SnapStart to the function, so turning it on
changes the version's logical id but publishes no new version, and
no snapshot is taken. 44eae301d said it publishes; the docs and the
comment now say what happens.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say which characters the SAM version hash escapes

Characters outside printable ASCII are hex escapes except where JSON
has a short escape, such as a newline's, and SnapStart is hashed only
when it sets an ApplyOn other than None.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): leave the optional SAM version properties to their own change

Take AutoPublishCodeSha256, AutoPublishAliasAllProperties and
VersionDeletionPolicy, with their validation, docs and tests, out of
the AutoPublishAlias fix so they can follow as their own change. The
transform no longer reads them, as on main: each is ignored, never
refused, and none changes the version's logical id or its
DeletionPolicy. The CapacityProviderConfig default goes with
VersionDeletionPolicy.

The fix keeps the alias on Fn::GetAtt of the version's Version, the
hashed version id over the code, Environment, MemorySize and an
applied SnapStart, and the version's default DeletionPolicy: Retain.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-16 07:07:51 -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