mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
6db78b8ef4eadffa31b897fd7df9e4e6efc56dbe
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9c00c8c70e |
test(compat): cover Lambda Web Functions in the Python SDK suite (#6983)
* test(compat): cover Lambda Web Functions in the Python SDK suite * test(compat): run the Lambda Web Python suite in any region and clean up a partial setup |
||
|
|
5b24703815 |
fix(ec2): normalize subnet IPv6 CIDRs and expose zone network borders (#6387)
Normalize subnet IPv6 responses and expose regional availability-zone network borders. Keep the read-only regional test at a unique execution order. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> |
||
|
|
a103b938d2 |
fix(query): route signed GET requests through the Query dispatcher (#6007)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
0a37ea830b |
fix(dynamodb): support legacy table discovery and batch cleanup (#5986)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
233253334d |
fix(elbv2): reject a listener certificate the account does not have (#5474)
A listener stored whatever certificate ARN it was given. CreateListener, ModifyListener and AddListenerCertificates each model CertificateNotFound, and all three took an ARN naming nothing and answered 200, so a listener could be left serving a certificate that was never uploaded. Only the other direction worked: ELBv2 reports its references to IAM, so DeleteServerCertificate already refused with DeleteConflict while a listener held one. The error is the one AWS publishes on those three operations and no others: botocore gives CertificateNotFoundException the code CertificateNotFound, 400, senderFault, and the API reference lists it under AddListenerCertificates, CreateListener and ModifyListener with one sentence, "The specified certificate does not exist." That sentence is the message rather than one naming the ARN, because it is the one the reference publishes. The check covers the listener types the member belongs to and no more. The reference marks Certificates "[HTTPS and TLS listeners]" on CreateListener and ModifyListener, and describes AddListenerCertificates as adding to the list "for the specified HTTPS or TLS listener", so a certificate on a listener of any other protocol is a configuration it does not describe. What AWS answers there is not CertificateNotFound on any evidence to hand, so such a request keeps the behaviour it had rather than being refused with a code read off the wrong case. A test pins each side of that line. The line follows the protocol the listener ends the call with, not the one it started with: ModifyListener takes a protocol without taking certificates, so when none arrive the certificates checked are the ones already on file. An HTTP listener holding an ARN that resolves to nothing is left alone, and the request that turns it into an HTTPS one, which is where those certificates start being served, is refused. A blank entry is refused the same way, rather than skipped. Certificates is the list of certificates the listener serves, an empty value in it names one no better than a value that is no ARN at all, and the Query parser turns an empty CertificateArn parameter into exactly that entry, so skipping it stored a certificate the listener cannot serve. ELB Classic already answered this question in full, resolving an ARN to an IAM server certificate or an ACM one and holding IAM's certificate lock across the write. This is the second caller, so the three private methods it kept, certificateExists, iamServerCertificate and acmCertificateExists, move to CertificateReferenceResolver in core.common and Classic reads them from there. Neither referrer owns the lookup: IAM holds server certificates, ACM holds the rest, and a listener carries only the ARN. Classic's public constructors are untouched, so its unit tests still build it the same way. The check alone is not enough, which is why the lock moves with it. A certificate can be deleted between the check and the write, and the delete walks the reference providers under IAM's own lock, so every write that records an IAM certificate runs inside that lock and re-checks there, while the fail-fast check outside it keeps the error precedence. That covers CreateListener as much as the two writes to a listener already published: until the new listener is in the map, nothing the delete walks can see that it holds the certificate. A race test drives each of them against DeleteServerCertificate over the wire, and with the lock removed they leave a listener holding a deleted certificate in 1 of 30 trials for AddListenerCertificates and 4 of 30 for CreateListener, so the guarantee is measured rather than asserted. Where the check sits in ModifyListener is part of the fix. The listener it modifies is the stored object, and the port, protocol and SSL policy were set before anything could refuse the request, so a refusal answered 400 over a listener already moved to the new port: no later read put it back, and the data plane was never restarted to match. Every refusal now lands before the first setter. An absent resolver leaves the old behaviour in place. ElbV2Service is wired by hand in its unit tests, with no IAM and no ACM, and a listener write there is the write it was before any certificate existed to check. The dependency is a field rather than a constructor parameter because that is how this class takes all six of its others, and converting it would be a refactor this change does not need. docs/services/elb.md said listener certificate ARNs are not validated when they are added, which was true and is the behaviour this removes, so it now documents the three operations, the protocols they cover, the empty value, the protocol change, the error and the lock, as the Classic page already does. Sixteen integration tests cover a missing IAM certificate, a missing ACM one, a blank entry, a value that is no ARN at all and an ARN of a service that serves no certificates, an uploaded certificate and an ACM certificate being accepted, a listener carrying no certificate, a TLS listener held to the same check as an HTTPS one and a listener of a protocol with no certificates left alone, a protocol change refused over the certificate it already held and allowed over one that exists, a second certificate being added, a refused change leaving the port and protocol as they were, and the two writes that must refuse without changing what the listener already serves. Every certificate and load balancer they make is registered for cleanup: the account's certificate quota is 20 and the Quarkus instance is shared, so one left behind fails an unrelated class's upload instead of anything here. Three things the reference states about these operations stay open, each wanting an error code no source here gives: CreateListener and ModifyListener take "exactly one certificate" and AddListenerCertificates "one certificate per call", where Floci accepts a list; TooManyCertificates is modeled on all three and no quota is enforced; and DescribeListenerCertificates is documented to report the default certificate alongside the list, with IsDefault telling them apart, which Floci does not model. Driven through the standard hashicorp/aws provider against a local instance as well, which is how the change was checked against a real client rather than only against the suite: an aws_iam_server_certificate and an aws_lb_listener serving it apply clean, and a listener naming a certificate nobody uploaded fails with CertificateNotFound and the reference's sentence. That failure arrives at the end of the provider's create timeout rather than at once, because the provider retries this error on all three calls, the AddListenerCertificates one against a constant named iamPropagationTimeout: real AWS is eventually consistent about a certificate just imported, so a client waits it out. Floci's storage is immediately consistent and nothing here models a propagation delay, so the retry simply ends in the refusal. The same contract is pinned at the SDK boundary too, as eight boto3 tests in compatibility-tests: the refusal on each of the three operations, the accepted cases, and both protocol edges. They run in under a second, where driving the same thing through Terraform in CI costs about a minute for the accepted case and nearly two for the refusal, almost all of it the provider's waiter and the retry above rather than anything Floci does. The suite had no ELB coverage at all before this. Each test takes its load balancer back out before its certificates, which is the order that frees them, and test_acm.py's private certificate builder moves to a conftest fixture taking the common name rather than being copied, since the new file needs the same pair. |
||
|
|
22b0627245 |
test(compat): assert recorded metric filter publishing through the SDK modules (#3809)
* feat(logs): add metric filters with per-event metric publication Implements PutMetricFilter, DescribeMetricFilters, DeleteMetricFilter and TestMetricFilter on the CloudWatch Logs JSON 1.1 handler, backed by a filter pattern engine for term, space-delimited and JSON patterns. The grammar is checked against 148 TestMetricFilter cases recorded from AWS, kept as fixtures under src/test/resources/cloudwatchlogs and recaptured with the opt-in script under tools/aws-capture/cloudwatchlogs. Validation follows the observed AWS wire behavior: the five regex-bearing filters per log group quota is shared with subscription filters through one canonical backend monitor, a filter pattern may hold at most two regular expressions, defaultValue must be a JSON number, DescribeMetricFilters requires metricName and metricNamespace together in both directions, and TestMetricFilter reports one-based event numbers with an empty public extractedValues map for JSON patterns. Ingested events publish samples into CloudWatch Metrics per event at the event timestamp: matching events contribute the extracted or literal value, non-matching events contribute defaultValue, dimensions are all-or-none, and system dimensions only attach to matching events. Failed publications are retried from a bounded queue of 10,000 samples with stable publication ids. Resettable gains beforeReset and afterReset default hooks so the metric filter publisher can pause and drain before a state reset wipes storage and resume afterwards. EmulatorInfoController.performReset is serialized and calls the hooks around the existing container teardown and storage wipe, running afterReset in a finally block so a failed wipe cannot leave a publisher paused. The GetMetricStatistics and GetMetricData Query responses now carry the CloudWatch namespace so both read paths return the same samples. * feat(cloudformation): provision AWS::Logs::MetricFilter Adds LogsMetricFilterCfnProvisioner for creates, in-place updates, name changes and deletes. Ref and PhysicalResourceId are the filter name alone, as observed on AWS; the log group is kept as private resource metadata. A replacement deletes the old filter before creating the new one, matching the DELETE then CREATE event order AWS emits, and a failed replacement recreates the previous definition on rollback. Every mutation records an APPLIED, NOT_APPLIED or UNKNOWN outcome under the service lock so a failed or ambiguous call can never authorize deleting or overwriting a filter the stack does not own. Ownership that cannot be proven is resolved conservatively before the next mutation. The engine gains three small provisioner hooks that this type needs and others may reuse: - ProvisionContext carries a progress consumer so a provisioner can emit the intermediate DELETE_IN_PROGRESS and DELETE_COMPLETE events of a delete-first replacement while provision is still running. - rollbackUpdate(resource, progress) lets a provisioner restore its own previous state during UPDATE_ROLLBACK and report the steps as events. - hasPendingRollbackCleanup and retainsFailedUpdateState let a provisioner tell the engine that an UPDATE_FAILED resource still holds its own rollback snapshot, so the engine neither restores the previous resource over it nor refuses a later DeleteStack. Both default to false; only this provisioner overrides them. The type is listed in supported-resource-types.tsv, the generated resource table and CfnProvisionerFixture, with unit, integration, storage reload and SDK coverage. * docs(logs): document metric filters and the AWS verification record Describes the metric filter operations, publication semantics and CloudFormation support in docs/services/cloudwatch.md and adds cloudwatch-metric-filters-verification.md, the record of what was observed on AWS in eu-west-1, with which tools, and where each recorded fixture came from. Registers the handler and the verification page with the docs tooling and teaches the service inventory test to count facet pages. * feat(logs): publish metric filter samples off the PutLogEvents thread PutLogEvents evaluated each filter and wrote one CloudWatch Metrics sample per filter and event on the request thread while holding the filter-store monitor, up to a million writes for a maximal request, so ingestion latency depended on the Metrics sink and every PutMetricFilter waited behind the whole batch. The request thread now only evaluates the group's filters as they are at ingestion and hands the resulting immutable samples, with their stable publication ids, to a bounded queue of 100,000 samples. The existing single worker drains it and writes one sample per monitor acquisition, so a PutMetricFilter or a reset waits for at most one write. A batch that does not fit the queue is written inline on the request thread rather than dropped. Failed writes still land in the 10,000 sample retry map with the same ids and cadence as before. Reset pauses the worker, discards queued and failed samples and bumps a generation counter so a batch taken before the reset is never written into the wiped store. Shutdown drains the queue before storage shuts down and clears the retry map only after the worker has terminated. Samples ingested while Metrics is disabled are discarded at startup. Integration and SDK tests poll for the sample, as they would against AWS. * test(compat): assert recorded metric filter publishing through the SDK modules Extends the Java compatibility module with the publishing scenarios recorded from AWS: mixed defaults and quiet traffic, extraction and ordinary dimension series, system dimensions on matches only, and a Sum alarm driven by quiet defaults. Each series is read through the SDK's CloudWatch JSON protocol and again as a signed legacy Query request, so GetMetricStatistics and GetMetricData agree on every sample, timestamp, unit and dimension set. Expected values come from module-local copies of the root fixture metric-filter-publishing-aws.json. MetricFilterFixturePackagingTest checks the Java copy loads from the classpath and the root CloudWatchLogsMetricFilterFixturePackagingTest fails when either SDK module copy drifts from the root file. The Python module gains tests/metric_filter_replay.py, an opt-in replay of the same scenarios against a Floci endpoint or, with explicit profile, region and write acknowledgement, against AWS. Its logic is covered offline by tests/test_metric_filter_replay.py with the network blocked. Both module Dockerfiles are unchanged: the Java image already runs the whole suite and the Python image already copies tests/. * test(compat): assert every recorded statistic and poll for published samples The SDK publishing assertions compared only Sum and SampleCount although the AWS fixture also records Minimum and Maximum for the default-value scenarios. Both the SDK JSON reads and the signed legacy Query reads now assert every statistic the fixture carries, on GetMetricStatistics and GetMetricData. Publication now happens shortly after PutLogEvents returns, so present series are polled and absent series are asserted only after a later positive control of the same filter is visible, which the publisher's ordering guarantees. The read window ends at second 59 so a sample stamped on the following minute is never in scope. The live replay's Region check names the commercial partition explicitly. botocore already defaults get_available_regions to partition_name="aws", so GovCloud and China Regions were rejected before; the offline test now pins it. * test(compat): keep the metric filter SDK test on the Java 17 API of the compat image List.getLast() is Java 21; the sdk-test-java image compiles with Temurin 17. |
||
|
|
eeefb729c4 |
test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo * fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler * fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest * test: add sdk tests for multipart S3 copy coverage * fix: cover and fix smithy cbor and multipart s3 copy regressions * test: migrate more test coverage to new folder * test: add missing ec2 expectation in healthcheck test * docs: update READMEs in `./compatibility-tests` |