Fix flaky local fs LastModified test by increasing allowed range (#26731)
diff --git a/sdks/go/pkg/beam/io/filesystem/local/local_test.go b/sdks/go/pkg/beam/io/filesystem/local/local_test.go
index 18796ae..5fca25b 100644
--- a/sdks/go/pkg/beam/io/filesystem/local/local_test.go
+++ b/sdks/go/pkg/beam/io/filesystem/local/local_test.go
@@ -161,12 +161,12 @@
dir := t.TempDir()
filePath := filepath.Join(dir, "file.txt")
- // Account for a timestamp resolution of one second.
- t1 := time.Now().Truncate(time.Second)
+ // Account for time skew between system and go runtime.
+ t1 := time.Now().Truncate(time.Second).Add(-time.Second)
if err := filesystem.Write(ctx, localFS, filePath, []byte("")); err != nil {
t.Fatalf("filesystem.Write(ctx, %q) error = %v, want nil", filePath, err)
}
- t2 := time.Now()
+ t2 := time.Now().Truncate(time.Second).Add(2 * time.Second)
got, err := localFS.LastModified(ctx, filePath)
if err != nil {