snapshots: fix flaky TestMetastore

35a8e6e589/check/containerd-build-arm64/de237af/logs/make_test.txt

--- FAIL: TestMetastore (18.27s)
    --- FAIL: TestMetastore/GetInfo (13.91s)
        metastore_test.go:242: assertion failed:
            --- expected
            +++ info
            {snapshots.Info}.Created:
            	-: s"0001-01-01 00:00:00 +0000 UTC"
            	+: s"2020-01-15 14:15:38.71882571 +0000 UTC"
            {snapshots.Info}.Updated:
            	-: s"0001-01-01 00:00:00 +0000 UTC"
            	+: s"2020-01-15 14:15:38.71882571 +0000 UTC"
            : on key committed-1

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
This commit is contained in:
Shengjing Zhu 2020-01-15 23:08:36 +08:00
parent 5383d31f32
commit 1189cc40f2

View File

@ -261,7 +261,7 @@ var cmpSnapshotInfo = cmp.FilterPath(
// actual value should be within a few seconds of now // actual value should be within a few seconds of now
now := time.Now() now := time.Now()
delta := now.Sub(actual) delta := now.Sub(actual)
threshold := 10 * time.Second threshold := 30 * time.Second
return delta > -threshold && delta < threshold return delta > -threshold && delta < threshold
})) }))