mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
fstest: reduce precision of directory time checks on CI
For unknown reasons the precision of modification times of directories on the CI is > 15mS compared to files which are 100nS. The tests work fine when run in Virtualbox though so I conjecture this is something to do with the file system used there.
This commit is contained in:
parent
0bfd70c405
commit
bd8523f208
|
@ -27,6 +27,7 @@ import (
|
||||||
"github.com/rclone/rclone/fs/config/configfile"
|
"github.com/rclone/rclone/fs/config/configfile"
|
||||||
"github.com/rclone/rclone/fs/hash"
|
"github.com/rclone/rclone/fs/hash"
|
||||||
"github.com/rclone/rclone/fs/walk"
|
"github.com/rclone/rclone/fs/walk"
|
||||||
|
"github.com/rclone/rclone/fstest/testy"
|
||||||
"github.com/rclone/rclone/lib/random"
|
"github.com/rclone/rclone/lib/random"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -620,7 +621,15 @@ func CheckDirModTime(ctx context.Context, t *testing.T, f fs.Fs, dir fs.Director
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gotT := dir.ModTime(ctx)
|
gotT := dir.ModTime(ctx)
|
||||||
AssertTimeEqualWithPrecision(t, dir.Remote(), wantT, gotT, f.Precision())
|
precision := f.Precision()
|
||||||
|
// For unknown reasons the precision of modification times of
|
||||||
|
// directories on the CI is about >15mS. The tests work fine
|
||||||
|
// when run in Virtualbox though so I conjecture this is
|
||||||
|
// something to do with the file system used there.
|
||||||
|
if runtime.GOOS == "windows" && testy.CI() {
|
||||||
|
precision = 100 * time.Millisecond
|
||||||
|
}
|
||||||
|
AssertTimeEqualWithPrecision(t, dir.Remote(), wantT, gotT, precision)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gz returns a compressed version of its input string
|
// Gz returns a compressed version of its input string
|
||||||
|
|
|
@ -6,9 +6,14 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CI returns true if we are running on the CI server
|
||||||
|
func CI() bool {
|
||||||
|
return os.Getenv("CI") != ""
|
||||||
|
}
|
||||||
|
|
||||||
// SkipUnreliable skips this test if running on CI
|
// SkipUnreliable skips this test if running on CI
|
||||||
func SkipUnreliable(t *testing.T) {
|
func SkipUnreliable(t *testing.T) {
|
||||||
if os.Getenv("CI") == "" {
|
if !CI() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.Skip("Skipping Unreliable Test on CI")
|
t.Skip("Skipping Unreliable Test on CI")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user