test: make network-dependent unit tests hermetic
Merged
MA
1h ago+67+67+01234567890123456789-85-85-01234567890123456789
Refs PFM-7940
Summary
Two unit tests made live outbound HTTP calls, so they failed on any runner without internet egress (air-gapped CI, outages, rate limits). This makes them not need the network at all, reusing loopback patterns already present in the repo.
- rego (
pkg/policies/engine/rego): replace the two "allowed network requests" subtests that dialedwww.chainloop.devandgithub.comwithTestRego_AllowedHostnames(asserts allow-list membership) andTestRego_AllowedHostIsReachable(reaches an allowed host on a loopbackhttptestserver). Theforbidden functions/forbidden network requestssubtests are unchanged. Drops the now-unusedrestricted_mode_networking_allowed_host.regotestfile. - materials (
pkg/attestation/crafter/materials): replace thenon-existent pathOCI case that reached Docker Hub for itsUNAUTHORIZEDresponse withTestOCIImageCraft_UnresolvableRemoteReferenceagainst an in-memory loopback registry, asserting the deterministicNAME_UNKNOWNerror.
No production behavior changes. The engine's host allow-list, netguard ranges, and http.send gating are untouched. The fix lives entirely in test code.