You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pkg/agent unit test registers a real spore.host DNS record with ambient credentials #968
TestNewAgent_StillActivates (pkg/agent/query_mode_test.go) calls the real agent.NewAgent with a config that sets DNSName: "demo", JobArrayID: "ja-abc" and a public IP. NewAgent's activation block then builds a real dns.Client and a real registry.PeerRegistry from the ambient AWS credentials. So a plain go test ./pkg/agent (and make check) sends production writes:
$ AWS_PROFILE=aws AWS_REGION=us-west-2 go test -count=1 -run TestNewAgent_StillActivates -v ./pkg/agent
Registering DNS: demo -> 203.0.113.10
✓ DNS registered: demo.1kpqzg2c.spore.host -> 203.0.113.10 (change: /change/C0420773GLXIQ6N9IEFE)
DNS: failed to clear stale dns-error tag: ... DeleteTags ... InvalidID: The ID 'i-0123456789abcdef0' is not valid
DNS: failed to write dns-status tag: ... CreateTags ... InvalidID ...
Warning: Failed to register with hybrid registry: ... DynamoDB: PutItem ... ResourceNotFoundException
--- PASS: TestNewAgent_StillActivates (1.34s)
That is a real Route53 UPSERT through the DNS API, with a leased record (demo.<account-base36>.spore.host -> 203.0.113.10), plus EC2 CreateTags/DeleteTags and DynamoDB PutItem calls. They fail only because the instance ID and table are fake. Every developer with credentials who runs make check re-registers that record. In CI, with no credentials, the same test passes because every call fails. So the test passes whether or not it is isolated, and nothing shows it is touching production.
Relevant rules: CLAUDE.md cost safety ("any real-AWS test MUST..."). Short tests are not meant to reach AWS at all.
Suggested: give newAgent seams for the DNS client and registry constructors (or a Provider-level hook), and have the test assert activation through those fakes rather than through real clients. Or strip DNSName/PublicIP from the activation test and assert activation on the peer-discovery call alone. A gate could run the agent package's short tests with AWS_EC2_METADATA_DISABLED=true and an HTTPClient that fails on any request.
The DNS record created by my run (demo.1kpqzg2c.spore.host -> 203.0.113.10, a TEST-NET-3 address) was left in place. It is leased, and deleting it would be another production write.
Activity
Make unit tests hermetic: no real AWS/DNS calls from make check (#968)
Use a non-key-shaped fake access key and annotate the wrapper's exec …
Make unit tests hermetic: no real AWS/DNS calls from make check (#968)
Use a non-key-shaped fake access key and annotate the wrapper's exec …
Make unit tests hermetic: no real AWS/DNS calls from make check (#968)
Make unit tests hermetic: no real AWS/DNS calls from make check (#968)
Make unit tests hermetic: no real AWS/DNS calls from make check (#968)
Make the activation test's member a burst member now that only hybrid…
Make unit tests hermetic: no real AWS/DNS calls from make check (#968) (
deploychecklist: the v0.151.0 replay never fetches old deps; skip whe…
deps: libs v0.51.4 (#1477)