From 237d216b524e1370fe52ae698d3403fa53058c72 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 6 Oct 2026 07:12:00 +0800 Subject: [PATCH] =?UTF-8?q?provider=20tests:=20TestUnreadLoginsNotWrittenO?= =?UTF-8?q?ver=20counts=20only=20the=20copies=20kept=20from=20its=20second?= =?UTF-8?q?=20step=20=E2=80=94=20the=20first=20add=20also=20keeps=20the=20?= =?UTF-8?q?half-written=20file=20aside=20(writeLogins=20always=20does),=20?= =?UTF-8?q?named=20by=20the=20second;=20on=20a=20Mac=20both=20adds=20fell?= =?UTF-8?q?=20in=20one=20second=20and=20shared=20a=20name,=20on=20Linux=20?= =?UTF-8?q?CI=20(run=2037380281215,=208278ccf2)=20they=20crossed=20a=20sec?= =?UTF-8?q?ond=20and=20the=20test=20saw=20two.=20The=20test=20now=20remove?= =?UTF-8?q?s=20the=20first=20step's=20copy.=20With=20a=201.1s=20pause=20be?= =?UTF-8?q?fore=20the=20second=20step=20the=20old=20test=20fails=20as=20CI?= =?UTF-8?q?=20did=20and=20this=20one=20passes;=20-race=20-count=3D20=20pas?= =?UTF-8?q?ses.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/provider/logins_unread_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/provider/logins_unread_test.go b/internal/provider/logins_unread_test.go index f1adce0b..a71fe596 100644 --- a/internal/provider/logins_unread_test.go +++ b/internal/provider/logins_unread_test.go @@ -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()