Repository navigation
test(#756): pin EC2's compute projections and record them - #1331
Merged
Merged
Conversation
EC2Instance, EC2KeyPair, EC2LaunchTemplate and EC2PlacementGroup are the last four EC2 records, ten of the inventory's lines. Four tests extend emulator/ec2_wire_test.go and drive twenty-four routed operations, CreateFleet among them since a fleet's instances are EC2Instance records too. Two of the four carry a third bookkeeping member under omitempty, and each is read back from the record before any absence is asserted. EverTagged is set only by a tag write (#938), so the instance test calls CreateTags first; a control without it fails at the read-back rather than passing vacuously, which is the trap #1304 fell into on EFS. CreatedAt is written on both key-pair create paths and DescribeKeyPairs is anchored on the published createTime it feeds. check-wire-bookkeeping goes from 191 projected across 78 records to 201 across 82, and from 128 still reachable to 118, of the same 319 declared. All thirty of EC2's baseline lines are now cited. #756 stays open: 118 lines remain in AC3's tail.
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.
This is the third and last of the EC2 PRs in #756's AC3. It covers the compute records, which are
the remaining 10 of EC2's 30 baseline lines. After this, every EC2 record is cited. As with
#1329 and #1330, there are no production code changes.
What it adds
Four tests extend
emulator/ec2_wire_test.go, driving 24 routed operations:EC2InstanceEC2KeyPairEC2LaunchTemplateEC2PlacementGroupCreateFleetis in the instance test because a fleet launches through the same path, so itsinstances are
EC2Instancerecords too.The two
,omitemptymembers, which are where an assertion could be vacuousEC2Instance.EverTaggedisever_tagged,omitemptyand is set only by a tag write (fix(tagging): GetResources reports untagged resources, which AWS omits #938).An untagged instance's response is missing it for free, which is the vacuous assertion fix(#756): render EFS responses from the published shape #1304
shipped on EFS. So the test calls
CreateTags, readsever_tagged: trueback from the storedrecord, and only then walks any response.
EC2KeyPair.CreatedAtis written on both create paths. It is read back from the record, andDescribeKeyPairsis anchored on the published<createTime>it feeds.Each record's account member is read under its own spelling:
accountIdforEC2KeyPair,accountIDforEC2LaunchTemplate, andaccount_idfor the others.Negative controls (each run, then restored)
ever_taggedintoreservationSet,CreatedAtintokeySet,accountIDintolaunchTemplatesandaccount_idintoplacementGroupSet. Exactlythe four new tests failed, each on its Describe subtest, and none of the ten earlier tests did.
ec2_plugin.gowas verified diff-free afterwards.CreateTagsstep removed, the instance test fails withinstance:…/i-… must persist ever_tagged before an absence assertion on it means anything. Itfails before any response is walked, not after passing on an absence.
One correction while writing this
I first wrote a "valid ed25519 key" for
ImportKeyPair, with a comment saying the handler wouldfingerprint it. The handler does not parse the material at all. The test now uses the short value
TestEC2_KeyPair_Importuses, and its comment says plainly that it asserts on the response, not onimport validation.
The ratchet
Across the three PRs, EC2 went from 148 to 118 reachable. All 14 EC2 records are cited, across 78
subtests.
Verification
All of these pass:
make lint: 0 issues.make test: race,-count=1.docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check.#756 stays open: 118 lines remain in AC3's tail.