refac: atomic merge, lost-update race, RunPurge cost, duplicated walks

This commit is contained in:
Florian Sylvain committed 2026-10-21 22:47:46 +02:00
1 parent 0fc3511e2b
commit 074944c99a
45 files changed
+2204 -267

No files matched your search

+9 -3
View File
@@ -743,16 +743,22 @@ func TestPurgeRun(t *testing.T) {
env.useImages(22, 3, 4)
env.useImages(23, 3)
env.images.failDeleteFor = map[uint32]error{2: errRepositoryFailure}
originalA := env.bodies()[20]
copyURL := env.urlOf(2)
expectRaw(t, env.run(t, `{}`), 200, counters(2, 1, 1, 1, 1))
if strings.Contains(env.bodies()[20], env.urlOf(2)) {
t.Errorf("expected article 20 to stay switched to the kept copy")
if env.bodies()[20] != originalA {
t.Errorf("expected group A's bodies back to their original text")
}
if got := numberOf(env.preview(t)["groups"]); got != 1 {
t.Errorf("expected group A to be planned again, got %d groups", got)
}
env.images.failDeleteFor = nil
expectRaw(t, env.run(t, `{}`), 200, counters(1, 1, 1, 0, 0))
expectRaw(t, env.run(t, `{}`), 200, counters(1, 1, 1, 1, 0))
if strings.Contains(env.bodies()[20], copyURL) {
t.Errorf("expected article 20 to use the kept copy after the next run")
}
expectIds(t, env.imageIds(), []uint32{1, 3})
})
t.Run("Every group failing is still a 200 with the counters", func(t *testing.T) {