Repository navigation
test(sweep): add the detached-sweep hardware test, and list the Lambda as hardware-sensitive - #750
Merged
Merged
Conversation
…a as hardware-sensitive Written to verify #725's tags on real hardware; it found #749 instead — a detached parameter sweep launches ZERO instances. The CLI never seeds `ami` into the params the orchestrator reads, so every RunInstances is rejected with MissingParameter: ImageId, the Lambda logs "All instances launched and completed", and the CLI prints "Parameter sweep queued successfully" and exits 0. So this test currently FAILS, correctly. #725's tag assertions are written and waiting behind #749, since the default path creates nothing to tag. Two traps are recorded in the script because I hit both writing it: 1. Rows must be discovered by spawn:sweep-id, NEVER by Name. The orchestrator names rows "<SweepName>-<index>" from a derived SweepName, not the name passed to `spawn launch` — so a Name filter built from the CLI argument matches nothing. My first version did that, which would have made the script's own CLEANUP miss any row that did launch. The hardware smoke's sweep leg documents the same lesson about --tag; this is it one layer along. 2. The orchestrator's log group is in the INFRA account while the rows land in the target account. Tailing it with the launch profile returns ResourceNotFoundException and loses the one diagnostic that explains the failure — which is how the first run reported "0 rows" with no reason attached. The polling loop is retained but is explicitly NOT why an earlier check saw zero rows: that was #749, a real total failure, which the absence of polling had merely made easy to misread. I had attributed it to timing. Also adds lambda/sweep-orchestrator/ to scripts/hardware-sensitive.txt. It composes RunInstances from param keys with no compile-time link to the CLI that writes them, so no unit test on either side can see a key-set disagreement across that seam. Its absence from the manifest is why #749 shipped. Cost safety: smallest ARM type, 20-minute TTL, explicit terminate, and a leak-check that re-queries rather than trusting the terminate call. The real run created no instances and left none behind, verified twice.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Two corrections to the leak-check, both found by running it: 1. shutting-down was excluded from the post-terminate state list. It is excluded from EC2's own default filter too — the blind spot behind #736 — so the check would report "nothing left behind" for an instance merely mid-termination, and identically for one whose terminate FAILED and left it stuck. 2. An ad-hoc cross-check I ran alongside this used `length(Reservations[].Instances[?State.Name!=`terminated`])`, which counts RESERVATIONS, not instances: the filter yields one list per reservation, so two reservations holding ZERO live instances answers "2". It raised a false leak alarm on a run where the script was correct. The script already used the sound form (server-side filter + grep -c on instance IDs); the reasoning is now written down next to it so nobody reaches for length() again. Also waits for the instances to leave the live states instead of sleeping a fixed 15s, so "still shutting down" and "stuck" are distinguishable.
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.
Written to verify #725's tags on hardware. It found #749 instead — a detached
parameter sweep launches zero instances and reports success. This PR is the
test and the manifest entry; the fix is #749.
What the test does
Launches a two-row detached sweep (the default path), polls for the rows, then
asserts each carries
spawn:managed=trueandspawn:ttl-deadline, and that thereaper's
ec2:TerminateInstancesis actually permitted against the tag — a tagis only worth having if it unlocks the terminate.
It currently fails, correctly, at the polling step. #725's tag assertions are
written and waiting behind #749, because the default path creates nothing to tag.
Two traps recorded in the script, both of which I hit writing it
1. Rows must be found by
spawn:sweep-id, never byName. The orchestratornames rows
<SweepName>-<index>from a derivedSweepName, not the name passedto
spawn launch. My first version filtered onName=<cli-arg>-*and matchednothing — and because the cleanup used the same filter, it would have missed
any row that did launch. I caught it from the launch output before anything
could leak.
The hardware smoke's sweep leg already documents this lesson about
--tag:Same trap, one layer along. That is an argument for discovering sweep rows by
sweep-id everywhere, not just here.
2. The orchestrator's log group is in the infra account, while the rows land
in the target account. Tailing it with the launch profile returns
ResourceNotFoundException, which is how the first run reported "0 rows" with noreason attached — I had to re-fetch the log separately with the infra profile to
find the
MissingParameterat all. The script now uses the right profile forthat one call and says why.
A correction to my own earlier diagnosis
The polling loop is retained, but it is explicitly not why an earlier run of
this check saw zero rows. I had attributed the smoke's
expected 2 running rows, found 0to checking before the Lambda had launchedanything. That was wrong: it was #749, a real total failure. "Found 0" was a true
positive I explained away as a timing artifact, and then built polling to fix.
The comment in the script says so, because the next person reading a zero-row
result deserves to not be sent down the same path.
The manifest entry is the durable half
lambda/sweep-orchestrator/was not inscripts/hardware-sensitive.txt, andthat is why #749 shipped. It composes
RunInstancesfrom param keys, with nocompile-time link to the CLI that writes them — so no unit test on either side
can see a key-set disagreement across that seam. Added, with the reason, in the
format the file asks for ("the reason is recorded so the list can be argued with
rather than inherited").
Cost safety
Smallest ARM type, 20-minute TTL, explicit terminate, and a leak-check that
re-queries rather than trusting the terminate call. The real run created no
instances and left none behind — verified twice, once by the script and once by an
independent
describe-instancesacross the whole target account.bash -non the script,go build ./...,go test -short ./...,make check-docs, changelog gate,semgrep scan --config=auto --error(0 findings).