mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
5da8045bb2ed954f4df652be2f2c38ae22c19150
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c149ef7166 |
docs(tools): point the snapshot miner's opening at records in this repository (#7526)
The module docstring is argparse's description too, so it is the tool's `--help` text, and it credited a planning file this repository does not carry: a reader following that pointer finds nothing. The readings it names are written down in `docs/services/iam.md` and `docs/services/sts.md`, which anyone reading the tool can open, so it points there instead. Nothing else moves. The tool's 20 tests pass and a full run over a checkout still reads 2173 recordings over 1195 tests. |
||
|
|
7bc09c7925 |
chore(tools): read the answers AWS already gave out of LocalStack's snapshots (#7494)
Several questions this repository had about AWS behaviour were settled one at a time by opening LocalStack's AWS-validated snapshots by hand: the two IAM constraint messages showing that IAM leaves the offending value out, the enum set UpdateAccessKey names, the STS message for an invalid parameter. A test LocalStack marks @markers.aws.validated ran against a real account, so what its snapshot carries is a recording rather than an emulator's answer, and there are 37 services' worth of them. This asks the whole set at once. Per recording it prints the service, the test, its marker, the date LocalStack recorded it, the path inside the recorded content, and the error code, status and message. --grep adds every other recorded string carrying a text, for a question that is not about an error code; --services all reads every service that carries a snapshot, for a wording Smithy writes rather than a service does; --tsv is one row per line, for pasting into an issue. A marker other than validated is not evidence of AWS behaviour, so those tests are left out unless --all-markers asks for them, and then each line says which marker it carries. Three things decide whether what it prints can be trusted. The markers are read off the parsed test file rather than matched line by line. A parametrized test stacks @pytest.mark.parametrize between the marker and the def, over a line per case, and matching lines found 10 of IAM's 84 AWS-validated tests before this read the decorators instead. A class's marker carries to the tests inside it, and a test's own wins over it. A marker is looked up by the key a snapshot names: Class::name for a test in a class, the bare name for one at module level, and the bare name as well for a name the file carries exactly once, since a snapshot key sometimes names no class for a test that now sits in one. LocalStack carries 20 names defined in more than one class, so keying those bare would let one class's validated marker stand for another class's unmarked test, and an unclassified recording would read as AWS evidence. An answer is read off the object that holds it rather than by walking the path string back down, so an error nested in a list keeps its message and status, and a key with a dot in it is one step rather than two. The path stays as a label for the reader. A field that would end the row or the column, a newline or a tab, is escaped: 53 of the messages in these snapshots carry one. A snapshot is looked for all the way down a service's directory, since it sits beside its test: 137 of the files in that tree are a directory or two below the service's own door and hold 1505 recordings, which a search one level deep reads none of. The service a recording belongs to is the directory under tests/aws/services rather than the one the file sits in, and a recording is reported under its key's own tail, test_iam.py::TestOne::test_x[case], so two classes carrying one test name stay two tests in the output and in the count. That tail is cut at the file rather than at the last slash: 33 keys in that tree carry a slash inside the parameter, and cutting there leaves name] where a test should be. LocalStack is not vendored here, so the tool takes a checkout: make snapshot-mine LOCALSTACK=../localstack. Its own tests cover each of those readings and run with make snapshot-mine-test. A full run over a checkout reads 2173 recordings over 1195 tests. |
||
|
|
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. |