provider tests: TestUnreadLoginsNotWrittenOver counts only the copies kept from its second step — the first add also keeps the half-written file aside (writeLogins always does), named by the second; on a Mac both adds fell in one second and shared a name, on Linux CI (run 37380281215, 8278ccf2) they crossed a second and the test saw two. The test now removes the first step's copy. With a 1.1s pause before the second step the old test fails as CI did and this one passes; -race -count=20 passes.

This commit is contained in:
yetone committed 2026-10-06 07:12:03 +08:00
1 parent 2cc663d0a2
commit 237d216b52
1 file changed
+6 -1
+6 -1
View File
@@ -45,7 +45,12 @@ func TestUnreadLoginsNotWrittenOver(t *testing.T) {
}
// nothing read before (magpie just started): the file is kept aside
// before it is written over
// before it is written over. The add above kept its own copy, named by
// the second it was made, so only the copies made from here count.
before, _ := filepath.Glob(p + ".bad-*")
for _, f := range before {
os.Remove(f)
}
half := good[:len(good)/2]
os.WriteFile(p, half, 0o600)
lastLoginsMu.Lock()