Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
force-pushed
the
fix/968
branch
2 times, most recently
from
October 15, 2026 19:29
a7d49cb to
ff602ba
Compare
TestNewAgent_StillActivates called the real NewAgent, which built a real DNS client, DynamoDB registry and EC2 tag writer from ambient credentials: every `make check` with a profile set did a real Route53 UPSERT via the DNS API, an EC2 CreateTags and a DynamoDB PutItem, and passed either way. - pkg/agent: newDNSClient/newPeerRegistry/newTagPutter seams (newPeerRegistry named as in #920); the activation test now asserts the leased UPSERT, the dns-status tag and the registry PutItem through httptest fakes. An fsxMounter seam keeps the FSx gating test off DescribeFileSystems. - Other offenders found by running every module under the new gate: provider and config public-IP lookups (ipify/ifconfig.me/icanhazip), taskpool job scripts' `aws s3 cp` (stub aws on PATH), ttl-reaper's init-time STS GetCallerIdentity (moved to main), a dashboard-api handler test's DynamoDB GetItem (loadAWSConfig seam), dns-updater handler tests' registry Scan. - Gate: internal/hermetic + test/hermetic, a `go test -exec` wrapper that strips AWS_* and sets fake creds, points AWS_ENDPOINT_URL and HTTP(S)_PROXY at a loopback recorder, and fails the package naming every request. The proxy is what catches the DNS client, which is not an SDK client. Wired into make check, CI (test, race, API surface) and scripts/nested-modules.sh; pkg/agent also installs it via TestMain. TestGateIsWired checks the wiring. (#968)
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.
Fixes #968
The bug
TestNewAgent_StillActivatescalled the realNewAgentwithDNSName/JobArrayID/PublicIP. With ambient credentials, everymake checksent a real Route53 UPSERT through the spore.host DNS API, an EC2CreateTags, and a DynamoDBPutItem. In CI, with no credentials, those calls failed. The test passed in both cases because NewAgent only logs the failures.Fix
newDNSClient,newPeerRegistry(same name and shape as Register only hybrid job-array members with the hybrid registry (#904) #920's), andnewTagPutter. The activation test now builds a realdns.ClientandPeerRegistryaimed at httptest fakes. It asserts a leasedUPSERT demo -> 203.0.113.10, aspawn:dns-status=registeredtag, a registryPutItem, and peer discovery. A newAgent.fsxMounterseam keeps the FSx gating test from pollingDescribeFileSystems.-shortand full, under the new gate. Static greps found nothing more.pkg/agentTestMaybeMountPendingFSx_GatingAndIdempotencyDescribeFileSystems(a background poll, up to 25 min)pkg/providerlocal-provider testslookupPublicIPseam, stubbed inTestMain)pkg/configTestLoadLocalConfig_PublicIPResolution(non-short)pkg/taskpoolexec/worker/substrate testsPutObjectoftasks/nf-*/completion.jsonand.exitcodethrough the realawsCLI (a stubawsnow goes first on PATH inTestMain)lambda/ttl-reaper(every test)GetCallerIdentityfrom packageinit(moved intomainasconfigure())lambda/dashboard-apiTestHandlerMissingTeamIDGetItemonspawn-user-accounts(newloadAWSConfigseam)lambda/dns-updatertwo handler alias testsScanof the live DNS account registry (aliasTestZonenow stubs the registry)Gate
internal/hermeticplustest/hermetic, ago test -execwrapper. For each test binary it:AWS_*variable and sets fake static credentials,AWS_CONFIG_FILE/AWS_SHARED_CREDENTIALS_FILE=/dev/null, andAWS_EC2_METADATA_DISABLED=true;AWS_ENDPOINT_URLandHTTP(S)_PROXYat a loopback recorder, withNO_PROXYset to loopback only. The proxy is what catches the DNS client: it is a plainnet/httpPOST to a Lambda Function URL, soAWS_ENDPOINT_URLdoes not touch it. httptest and Substrate stay reachable because Go never proxies loopback;HTTPS CONNECT …lambda-url.us-east-1.on.aws:443,service=ec2 action=CreateTags,target=DynamoDB_20120810.PutItem.It is wired into
make check(newtest-hermetictarget),test-race, CI's Test, Race and API-surface steps, andscripts/nested-modules.sh.pkg/agentalso installs it through its ownTestMain, so a plaingo test ./pkg/agentis hermetic too.TestGateIsWiredfails if any non-taggedgo teststep in ci.yml, ormake check, or the nested script stops using the wrapper.TestRun_*checks that the wrapper fails a binary making a DNS-API-shaped request and one making an SDK request, and passes a quiet one.Evidence
--- PASS: TestNewAgent_StillActivates, thenHERMETIC GATE FAILED … 3 network request(s)(DNS Function URL CONNECT, ec2 CreateTags, DynamoDB PutItem), soFAIL pkg/agent.DNS API got 0 request(s)) and the gate fails with the same three requests.TestRun_…/dns-apifails. Dropping-execfrom the CI race step:TestGateIsWiredfails.make checkpasses except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nestedpasses (9 modules), as domake check-tidyandmake test-race. A full non-shortgo test ./...under the wrapper, root and every nested module, reports no hermetic failures.Left for you to decide
demo.1kpqzg2c.spore.host -> 203.0.113.10(TEST-NET-3), created by this test, is still in place. It is leased, so the reaper's lease expiry should remove it if enabled; deleting it by hand would be another production write. Repeatedmake checkruns with credentials may have kept renewing it, and other developers' runs may have left similardemo.<their-account>records.newPeerRegistrydeclarations collide (resolve by keeping one). ItsjoinsHybridRegistryalso means a plain EC2 job-array member no longer registers, so this test's PutItem assertion would needBurst: trueinqueryProvider().