test: address Copilot review on infra helpers · Entire
test: address Copilot review on infra helpers
b0e6da6→main·
Soph·1w ago·3 files·+11 added/-4 removed
- AssertCheckpointsOnRemote (git-refs arm): surface git errors instead of reporting a misleading "found none" via gitOutputSafe
- RemoteCheckpointState: fail the test on git error instead of returning "" (two broken invocations comparing equal would pass vacuously)
- hermeticity self-test comment: the guard is per-host http proxy entries, not an insteadOf redirect
Co-Authored-By: Claude Fable 5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq
Sessions
d4f06e259d79View transcript
Changes
3
cmd/entire/cli/integration_test
Mbackend.go+3/-1
Mhermeticity_test.go+3/-2
e2e/testutil
Mrepo.go+5/-1
113 unmodified lines
114
115
116
117
117
118
119
120
121
122
113 unmodified lines
cmd.Env = testutil.GitIsolatedEnv()
out, err := cmd.Output()
if err != nil {
return ""
// Fail rather than return "": two broken invocations comparing equal
// would make an idempotence assertion pass vacuously.
env.T.Fatalf("RemoteCheckpointState: git for-each-ref %s in %s failed: %v", prefix, bareDir, err)
}
lines := strings.Split(strings.TrimSpace(string(out)), "\n")
sort.Strings(lines)
Mcmd/entire/cli/integration_test/backend.go+3/-1
23 unmodified lines
24
25
26
27
28
27
28
29
30
31
32
23 unmodified lines
defer cancel()
// ls-remote against a public-looking github URL must be refused immediately
// by the insteadOf redirect to 127.0.0.1:1, not hang on DNS/network or block
// on a credential prompt.
// by the per-host http.<url>.proxy entries pointing at the dead loopback
// address (see testutil.hermeticGitConfig), not hang on DNS/network or
// block on a credential prompt.
cmd := exec.CommandContext(ctx, "git", "ls-remote", "https://github.com/example/example")
cmd.Env = testutil.GitIsolatedEnv()
Mcmd/entire/cli/integration_test/hermeticity_test.go+3/-2
207 unmodified lines
208
209
210
211
211
212
213
214
215
216
217
218
207 unmodified lines
t.Helper()
if UsingGitRefs() {
out := gitOutputSafe(bareDir, "for-each-ref", "--format=%(refname)", checkpointRefPrefix)
out, err := GitOutputErr(bareDir, "for-each-ref", "--format=%(refname)", checkpointRefPrefix)
if err != nil {
t.Errorf("listing %s* refs on remote %s failed: %v", checkpointRefPrefix, bareDir, err)
return
}
if strings.TrimSpace(out) == "" {
t.Errorf("expected at least one %s* ref on remote %s, found none", checkpointRefPrefix, bareDir)
}
Me2e/testutil/repo.go+5/-1