From f639cd9c78984aa793d72ea8cf7920db45270c4e Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 12 Nov 2024 13:05:57 +0000 Subject: [PATCH] onedrive: fix integration tests after precision change We changed the precision of the onedrive personal backend in c053429b9c0bbca5 from 1mS to 1S. However the tests did not get updated. This changes the time tests to use `fstest.AssertTimeEqualWithPrecision` which compares with precision so hopefully won't break again. --- backend/onedrive/onedrive_internal_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/onedrive/onedrive_internal_test.go b/backend/onedrive/onedrive_internal_test.go index 5ac2141d0..843ede35f 100644 --- a/backend/onedrive/onedrive_internal_test.go +++ b/backend/onedrive/onedrive_internal_test.go @@ -215,11 +215,11 @@ func (f *Fs) TestDirectoryMetadata(t *testing.T, r *fstest.Run) { compareDirMeta(expectedMeta, actualMeta, false) // modtime - assert.Equal(t, t1.Truncate(f.Precision()), newDst.ModTime(ctx)) + fstest.AssertTimeEqualWithPrecision(t, newDst.Remote(), t1, newDst.ModTime(ctx), f.Precision()) // try changing it and re-check it newDst, err = operations.SetDirModTime(ctx, f, newDst, "", t2) assert.NoError(t, err) - assert.Equal(t, t2.Truncate(f.Precision()), newDst.ModTime(ctx)) + fstest.AssertTimeEqualWithPrecision(t, newDst.Remote(), t2, newDst.ModTime(ctx), f.Precision()) // ensure that f.DirSetModTime also works err = f.DirSetModTime(ctx, "subdir", t3) assert.NoError(t, err) @@ -227,7 +227,7 @@ func (f *Fs) TestDirectoryMetadata(t *testing.T, r *fstest.Run) { assert.NoError(t, err) entries.ForDir(func(dir fs.Directory) { if dir.Remote() == "subdir" { - assert.True(t, t3.Truncate(f.Precision()).Equal(dir.ModTime(ctx)), fmt.Sprintf("got %v", dir.ModTime(ctx))) + fstest.AssertTimeEqualWithPrecision(t, dir.Remote(), t3, dir.ModTime(ctx), f.Precision()) } })