Repository navigation
test: raise pkg/aws coverage to 31.4% + fix ListInstances nil panic - #5
Merged
Merged
Conversation
…ic (#3) pkg/aws helper tests (no AWS): DetectArchitecture, estimateVolumeSize, buildBlockDevices (default/override/hibernate/KMS), valueOrEmpty, contains/ findSubstring, and the IAM pure helpers (generateRoleName determinism, hashPolicies, buildInlinePolicy, buildIAMTags). pkg/aws lifecycle tests via substrate: GetInstanceState, UpdateInstanceTags, Terminate, Stop/Start, GetInstancePublicIP, ListInstances, key-pair ops, GetAccountID, GetEnabledRegions, Config/GetConfig accessors. Fixes a nil-pointer panic in listInstancesInRegion: instance.State and instance.Placement are pointers AWS may leave nil, but the code dereferenced them unconditionally — ListInstances would crash on any instance missing placement/state. Now guarded. Aggregate spawn coverage 24.7% → 25.7%. CI ratchet floor raised 22 → 24.
This was referenced May 30, 2026
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.
First coverage pass on spawn's highest-leverage package (#3), plus a nil-panic fix found via the new tests.
Coverage
pkg/awsCI ratchet floor raised 22 → 24. (spawn is a 40+ package module, so doubling
pkg/awsmoves the aggregate modestly — more passes to come per #3.)What's tested
Pure helpers (no AWS):
DetectArchitecture,estimateVolumeSize,buildBlockDevices(default / size override / hibernate-RAM-sizing / KMS encryption),valueOrEmpty,contains/findSubstring, and the IAM helpersgenerateRoleName(determinism + uniqueness),hashPolicies,buildInlinePolicy(template + spored base + unknown-template skip),buildIAMTags.Lifecycle via substrate:
GetInstanceState,UpdateInstanceTags,Terminate,StopInstance/StartInstance,GetInstancePublicIP,ListInstances(with/without state filter), key-pair import+check,GetAccountID,GetEnabledRegions,Config/GetConfig.Bug fix
listInstancesInRegiondereferencedinstance.State.Nameandinstance.Placement.AvailabilityZoneunconditionally. Both are pointers AWS may leave nil — soListInstancespanicked on any instance missing placement or state (surfaced immediately by the substrate test). Now both are nil-guarded.Verification
go build,go vet,gofmt,golangci-lint(changed files clean),go test ./pkg/aws/pass. Gate validated: 25.7% ≥ 24%.