fix: correct flaky test (TestLauncher_PIDFile_Locked) (#25490)

pull/25501/head
Geoffrey Wossum 2024-10-24 17:26:54 -05:00 committed by GitHub
parent c35321b470
commit 48f760065b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 6 deletions

View File

@ -9,7 +9,6 @@ import (
nethttp "net/http"
"os"
"path/filepath"
"runtime"
"strconv"
"testing"
"time"
@ -219,11 +218,11 @@ func TestLauncher_PIDFile_Locked(t *testing.T) {
curSt, err := os.Stat(pidFilename)
require.NoError(t, err)
// CircleCI test runners for darwin don't have `noatime` / `relatime`, so
// the atime will differ, which is inside the system specific data.
if runtime.GOOS != "darwin" {
require.Equal(t, origSt, curSt)
}
// We can't compare origSt and curSt directly because even on mounts
// with "noatime" or "relatime" options, the sys.Atim field can still
// change. We'll just compare the most relevant exposed fields.
require.Equal(t, origSt.ModTime(), curSt.ModTime())
require.Equal(t, origSt.Mode(), curSt.Mode())
}()
require.ErrorIs(t, err, launcher.ErrPIDFileExists)