Repository navigation
test(#756): pin the Backup projections and record them - #1326
Merged
Merged
Conversation
Six baseline lines, two per record: BackupVault, BackupPlan and BackupSelection each declare AccountID and Region under wire-visible json tags. None reaches a response — the vault answers through backupVaultOut since #1325, and every plan and selection response is a map built member by member — but the projected inventory refuses a record until a named test asserts it on the raw bytes. emulator/backup_wire_test.go drives all twelve routed operations across three parallel tests and walks each decoded document, failing on a member named for either at any depth and reporting the $.a.b[0].c path. The walk covers the whole document rather than a record's subtree, which matters here: GetBackupPlan and GetBackupSelection nest the record's published members under BackupPlan and BackupSelection while answering others flat, so "the record's subtree" is not one place, and a member rendered on the envelope would pass a subtree walk. Absence rather than exact membership, which is the weaker of the two forms in the suite: DescribeBackupVault answers 5 of API_DescribeBackupVault's 17 published members and ListBackupVaults 5 of API_BackupVaultListMember's 13, so an exact expectation would pin that gap (#1199) and have to be rewritten by the PR closing it. Nothing here is vacuous for free. Neither member carries ,omitempty on any of the three records, and Backup routes no tag operation, so no record declares EverTagged and #1304's trap cannot arise; the records are read back as raw JSON as the presence anchor regardless. Each case also asserts a published member is present before asserting a bookkeeping one is absent, so a body that failed to render the record fails as a missing anchor rather than passing as an absence. The three deletes answer {} and read nothing off the record. They are driven anyway, so the set of twelve reads as complete rather than as a sample, and a control confirms all three subtests fail if a member is added to the empty object. Four more controls were run: a leak reintroduced on backupVaultOut, on one plan map and on one selection map each failed exactly the one test citing that record and no other, and a misspelt citation was refused by check-wire-bookkeeping. 159 projected across 62 records to 165 across 65; 160 still reachable to 154. No assertion equates a timestamp — TimeController.Now advances from its baseline by elapsed wall time, and pinning a Backup date's rendering is emulator/backup_dates_test.go's job (#1324).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #756 (AC3). Does not close it — see the figures below.
What this discharges
Six baseline lines, two per record:
BackupVault,BackupPlanandBackupSelectioneach declareAccountIDandRegionunder wire-visiblejsontags. None reaches a response — the vault answersthrough
backupVaultOutsince #1325, and every plan and selection response is amap[string]interface{}built member by member — butscripts/wire-bookkeeping-projected.txtrefusesa record until a named test asserts that on the raw bytes.
The test
emulator/backup_wire_test.go— threet.Parallel()tests, one per record, driving all twelverouted operations and walking each decoded document for a member named for either at any depth,
reporting the
$.a.b[0].cpath.The walk covers the whole document rather than a record's subtree, which matters for Backup
specifically:
GetBackupPlanandGetBackupSelectionnest the record's published members underBackupPlanandBackupSelectionwhile answering others flat, so "the record's subtree" is not oneplace, and a member rendered on the envelope would pass a subtree walk.
Absence rather than exact membership, which is the weaker of the two forms in the suite and is
chosen deliberately:
DescribeBackupVaultanswers 5 ofAPI_DescribeBackupVault's 17 publishedmembers and
ListBackupVaults5 ofAPI_BackupVaultListMember's 13, so an exact expectation would pinthat gap (#1199, now with two Backup rows) and have to be rewritten by the PR closing it.
Nothing is vacuous for free. Neither member carries
,omitemptyon any of the three records, andBackup routes no tag operation at all, so no record declares
EverTaggedand the trap #1304 fell intoon EFS cannot arise here. The records are still read back as raw JSON for the presence anchor rather
than taking that on trust. Each case also asserts a published member is present before asserting a
bookkeeping one is absent, so a body that failed to render the record fails as a missing anchor rather
than passing as an absence.
The three deletes answer
{}and read nothing off the record. They are driven anyway, so the set oftwelve reads as complete rather than as a sample.
Negative controls, all five run and restored
AccountIDadded back tobackupVaultOutDescribeBackupVault+ListBackupVaults, nothing elseRegionadded togetBackupPlan's mapGetBackupPlan, nothing elseAccountIDadded togetBackupSelection's mapGetBackupSelection, nothing else"Region"added to all three empty{}deleteswire-bookkeeping-checkrefusesSo the delete subtests are regression guards rather than decoration, and each projected line is held
by a test that is non-vacuous for both of its record's members.
Verification
make lint— 0 issues (misspellcaught one British spelling in a Go comment; fixed).make test(race,-count=1) — all packages pass.make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check— all pass; the two operationchecks report no change, since no operation is added or renamed.
TimeController.Nowadvances from its baseline by elapsed walltime, so this file only walks member names; pinning a Backup date's rendering is
emulator/backup_dates_test.go's job (backup: nine date members are RFC3339 strings where every page publishes a Timestamp in Unix form #1324), which freezes the clock for exactly that reason.Note on the projected file's ordering
The plan expected
backupto sort to the top of the file. It does not —emulator/apigateway_types.goand
emulator/appsync_types.goprecede it — so the three lines are inserted between AppSync andCognito. The check does not enforce ordering, but the file is sorted by path and should stay that way.