fix(review round 2): daemon symlink tars, orphan-safe removes, unique seed names, git ctx, IsErrNotFound, collision-free slugs, branch validation; web first-run WS, draft reset, IME guard, churn fix, test swap repair; 106 daemon + 190 web tests green
This commit is contained in:
+20
-12
@@ -53,17 +53,18 @@ type fakeDocker struct {
|
||||
create []recordedCreate
|
||||
archives []int // sizes of accepted CopyToContainer tar streams
|
||||
|
||||
failBuild bool
|
||||
failBuildHTTP bool
|
||||
failCreate bool
|
||||
failStart bool
|
||||
failStop bool
|
||||
failWait bool
|
||||
failVolumeCreate bool
|
||||
failVolumeDelete bool
|
||||
failArchive bool
|
||||
archiveHang bool
|
||||
waitHang bool
|
||||
failBuild bool
|
||||
failBuildHTTP bool
|
||||
failCreate bool
|
||||
failStart bool
|
||||
failStop bool
|
||||
failWait bool
|
||||
failVolumeCreate bool
|
||||
failVolumeDelete bool
|
||||
failVolumeInspect bool
|
||||
failArchive bool
|
||||
archiveHang bool
|
||||
waitHang bool
|
||||
|
||||
unknown []string
|
||||
}
|
||||
@@ -203,6 +204,10 @@ func (f *fakeDocker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
f.mu.Lock()
|
||||
exists := f.volume[name]
|
||||
f.mu.Unlock()
|
||||
if f.failVolumeInspect {
|
||||
writeJSONNow(w, http.StatusInternalServerError, `{"message":"transient docker error"}`)
|
||||
return
|
||||
}
|
||||
if exists {
|
||||
writeJSONNow(w, http.StatusOK, fmt.Sprintf(`{"Name":%q,"CreatedAt":"2024-01-01T00:00:00Z"}`, name))
|
||||
return
|
||||
@@ -288,10 +293,12 @@ const (
|
||||
fakeGitModeFail string = "fail"
|
||||
fakeGitModeNoisy string = "noisy"
|
||||
fakeGitModeSilent string = "silent"
|
||||
fakeGitModeHang string = "hang"
|
||||
)
|
||||
|
||||
// useFakeGit puts a shim `git` first on PATH. Modes: ok (exit 0), fail
|
||||
// (stderr + exit 1), noisy (600-byte stderr + exit 1, for truncation tests).
|
||||
// (stderr + exit 1), noisy (600-byte stderr + exit 1, for truncation tests),
|
||||
// hang (sleeps; only ctx cancellation can end it).
|
||||
func useFakeGit(t *testing.T, mode string) string {
|
||||
t.Helper()
|
||||
dir := t.TempDir()
|
||||
@@ -302,6 +309,7 @@ func useFakeGit(t *testing.T, mode string) string {
|
||||
" fail) echo 'fatal: repository not found'; exit 1;;\n" +
|
||||
" noisy) printf '%s\\n' \"" + strings.Repeat("x", 600) + "\"; exit 1;;\n" +
|
||||
" silent) exit 1;;\n" +
|
||||
" hang) exec sleep 30;;\n" +
|
||||
"esac\n" +
|
||||
"# branch probe: emit the configured HEAD name\n" +
|
||||
"if [ \"$1\" = '-C' ] && [ \"$3\" = rev-parse ]; then printf '%s' \"$FAKE_GIT_HEAD\"; exit 0; fi\n" +
|
||||
|
||||
Reference in New Issue
Block a user