* feat(cloudformation): provision AWS::EC2::PrefixList An AWS::EC2::PrefixList was stubbed: Ref returned "<LogicalId>-<8 hex>", Fn::GetAtt the literal "<LogicalId>.<Attribute>", and EC2 held no list, so a route given its Ref pointed at nothing. Ec2NetworkCfnProvisioner now creates the customer-managed list through Ec2Service. Ref is its pl- id, and Fn::GetAtt serves PrefixListId, Arn, OwnerId and Version, the attributes the registry schema declares. The schema has no create-only property, and create-only-properties.json now says so. Without the entry, the engine's name heuristic took PrefixListName for create-only, so a rename was planned as a replacement of the list and of the routes and rules that reference it. An update changes the list in place: its name, capacity, entries and tags. Adding or removing entries makes a new version and a rename does not, as the EC2 API reference says. EC2 refuses a request that removes and adds the same CIDR, which is how a description changes (Terraform's aws_ec2_managed_prefix_list records the error), so such an entry is added back by a second ModifyManagedPrefixList call. The first call carries everything EC2 could refuse, and the capacity the second needs is checked before the first, so a change EC2 refuses leaves the list as it was. A rollback puts the prior name, capacity, entries and tags back, and Version follows the list. Two updates fail before anything changes: another AddressFamily, which no EC2 call can change on an existing list, and a new MaxEntries together with changed Entries, which the CloudFormation and EC2 references both say cannot change at once. MaxEntries is required to create a list, as the CloudFormation reference says (aws/aws-cdk#35360 reports the deploy failing without it); an update that leaves it out keeps the capacity. Entries and Tags are brought to the template when it, or the previous one, declares them, so entries or tags no template declared stay. Tags go through CreateTags after the create, as on the other types in the provisioner, so EC2 checks them; a tag it refuses fails the create and removes the new list. A list gone out of band, or a stub an older Floci left, is replaced by a new one, and a stack delete tolerates only InvalidPrefixListID.NotFound. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(cloudformation): cover AWS::EC2::PrefixList through boto3 A stack's prefix list is created, resized, given new entries and deleted through the CloudFormation and EC2 clients of the pinned boto3: Ref and Fn::GetAtt name the list EC2 describes, a resize keeps the version, new entries make version 2 of the same list, dropping Tags removes them, and the list is gone after the stack delete. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * refactor(cloudformation): share optionalInt through ProvisionContext Ec2NetworkCfnProvisioner and ElbV2CfnProvisioner each carried the same private optionalInt. An absent, null or AWS::NoValue property stays unset; a value written into the template, a literal blank included, has to be an integer; anything else fails with ValidationError "Value of property <name> must be an integer." It is now ProvisionContext.resolveOptionalInt, beside resolveOptional, and all seven callers use it: the prefix list's MaxEntries, the target group's Port and four health check settings, and the gateway listener's Port. The two copies differed only in Integer.parseInt against Integer.valueOf and in building the error through a helper, so neither provisioner changes behaviour. ProvisionContextTest covers the method directly. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
sdk-test-python
Compatibility tests for Floci using boto3 (1.37.1).
Services Covered
| Group | Description |
|---|---|
ssm |
Parameter Store — put, get, label, history, path, tags |
sqs |
Queues, send/receive/delete, DLQ, visibility |
sns |
Topics, subscriptions, publish, SQS delivery |
s3 |
Buckets, objects, tagging, copy, batch delete |
s3-cors |
CORS configuration |
s3-notifications |
S3 → SQS event notifications |
dynamodb |
Tables, CRUD, batch, TTL, tags |
lambda |
Create/invoke/update/delete functions |
iam |
Users, roles, policies, access keys |
sts |
GetCallerIdentity, AssumeRole, GetSessionToken |
secretsmanager |
Create/get/put/list/delete secrets, versioning, tags |
kms |
Keys, aliases, encrypt/decrypt, data keys, sign/verify |
kinesis |
Streams, shards, PutRecord/GetRecords |
cloudwatch-metrics |
PutMetricData, ListMetrics, GetMetricStatistics, alarms |
cloudformation-naming |
Auto physical name generation, explicit name precedence, cross-reference |
cognito |
User pools, clients, AdminCreateUser, InitiateAuth, GetUser |
elbv2 |
Listener certificates resolved against IAM and ACM |
Requirements
- Python 3.9+
- pip
Running
pip install -r requirements.txt
# All groups
pytest tests/ --junit-xml=test-results/junit.xml
# Specific tests
pytest tests/test_s3.py
# Via just (from compatibility-tests/)
just test-python
Legacy DynamoDB client
legacy/test_dynamodb_20111205.py exercises the 2011-12-05 API with Boto 2,
including paginated queries and batch cleanup of tables created by Boto 3.
Public Boto 2.49.0 needs Python 3.9: it uses retired collections and import
interfaces. Run this suite in a separate environment; the ordinary Python
3.12 suite retains its existing dependencies.
python3.9 -m venv .venv-legacy
.venv-legacy/bin/pip install -r requirements-legacy.txt
FLOCI_ENDPOINT=http://localhost:4566 .venv-legacy/bin/python -m pytest legacy/
tests/test_ec2_subnet_ipv6.py checks that expanded IPv6 subnet CIDRs are
stored and returned in canonical form through Boto 3.
Legacy Query GET
legacy/test_elb_query_get.py checks that public Boto 2 Query GET reads and
deletes Classic load balancers created through Boto 3 POST, including the
missing-resource error. Boto 2.49.0 requires a separate Python 3.9 environment:
python3.9 -m venv .venv-legacy
.venv-legacy/bin/pip install boto==2.49.0 boto3 pytest cryptography
FLOCI_ENDPOINT=http://localhost:4566 .venv-legacy/bin/python -m pytest legacy/test_elb_query_get.py
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_ENDPOINT |
http://localhost:4566 |
Floci emulator endpoint |
AWS credentials are always test / test / us-east-1.
Opt-in metric filter replay against AWS
tests/metric_filter_replay.py is a standalone script, not a test: pytest does
not collect it, and tests/test_metric_filter_replay.py checks its logic offline
with the network blocked. It does not change conftest.py, and FLOCI_TARGET=aws
does not select real AWS.
From the repository root, with the declared requirements installed:
python -m pytest compatibility-tests/sdk-test-python/tests/test_metric_filter_replay.py
# Against a local Floci
python compatibility-tests/sdk-test-python/tests/metric_filter_replay.py \
--endpoint http://127.0.0.1:4566 --region eu-west-1 \
--timeout 30 --stable-seconds 2 --poll-interval 1
Real AWS mode requires all three safety arguments. It creates billable CloudWatch metrics and a tagged log group, and metric series cannot be deleted; they remain until AWS ages them out.
python compatibility-tests/sdk-test-python/tests/metric_filter_replay.py \
--aws --profile YOUR_DISPOSABLE_TEST_PROFILE --region eu-west-1 \
--ack-live-writes I_ACCEPT_AWS_WRITES
Only commercial AWS regions are accepted, the clients pin the official regional
endpoints, and the group is deleted in finally only after its ownership tag is
verified. A cleanup failure exits nonzero and prints the group name. Credentials,
account ids, profile names and raw service errors are never printed.
The expected values come from tests/fixtures/metric-filter-publishing-aws.json,
a byte-identical copy of the root fixture
src/test/resources/cloudwatchlogs/metric-filter-publishing-aws.json; the root
CloudWatchLogsMetricFilterFixturePackagingTest fails when either SDK module copy
drifts. The replay ingests each scenario into its own backdated minute, runs the
quiet-default scenario last with no later ingestion, and accepts a result only
after every expected series, absent series and the idle minute after the quiet one
have stayed stable for a full window (AWS defaults: 240 second deadline, 30 second
window). Output is JSON lines of observations, not a regenerated fixture.
Docker
docker build -t floci-sdk-python .
docker run --rm --network host floci-sdk-python
# Custom endpoint (macOS/Windows)
docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-python