test(cache): remove timestamp granularity from dedup check

Assisted-By: docker-agent
This commit is contained in:
David Gageot committed 2026-10-16 11:10:03 +01:00
1 parent 5d8ab241d6
commit 3b013894c1
1 file changed
+7 -1
+7 -1
View File
@@ -101,6 +101,9 @@ func TestFileCache_dedupSkipsRedundantWrite(t *testing.T) {
require.NoError(t, err)
c.Store("q", "a")
// Separate the baseline from the next write even on coarse-grained filesystems.
baseline := time.Unix(946684800, 0)
require.NoError(t, os.Chtimes(path, baseline, baseline))
infoBefore, err := os.Stat(path)
require.NoError(t, err)
@@ -115,8 +118,11 @@ func TestFileCache_dedupSkipsRedundantWrite(t *testing.T) {
c.Store("q", "b")
infoChanged, err := os.Stat(path)
require.NoError(t, err)
assert.True(t, infoChanged.ModTime().After(infoBefore.ModTime()) || infoChanged.Size() != infoBefore.Size(),
assert.True(t, infoChanged.ModTime().After(infoBefore.ModTime()),
"different Store must rewrite the cache file")
data, err := os.ReadFile(path)
require.NoError(t, err)
assert.JSONEq(t, `{"q":"b"}`, string(data))
}
func TestFileCache_persists(t *testing.T) {