mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
test(cache): remove timestamp granularity from dedup check
Assisted-By: docker-agent
This commit is contained in:
1 file changed
+7
-1
Vendored
+7
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user