Merge pull request #7350 from kzys/timer-windows

Make checkContainerTimestamps less strict on Windows
This commit is contained in:
Phil Estes 2022-09-01 11:14:41 -04:00 committed by GitHub
commit 0f1a14a402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"path/filepath" "path/filepath"
"runtime"
"testing" "testing"
"time" "time"
@ -687,7 +688,12 @@ func checkContainerTimestamps(t *testing.T, c *containers.Container, now time.Ti
} else { } else {
// ensure that updatedat is always after createdat // ensure that updatedat is always after createdat
if !c.UpdatedAt.After(c.CreatedAt) { if !c.UpdatedAt.After(c.CreatedAt) {
t.Fatalf("timestamp for updatedat not after createdat: %v <= %v", c.UpdatedAt, c.CreatedAt) if runtime.GOOS == "windows" && c.UpdatedAt == c.CreatedAt {
// Windows' time.Now resolution is lower than Linux, due to Go.
// https://github.com/golang/go/issues/31160
} else {
t.Fatalf("timestamp for updatedat not after createdat: %v <= %v", c.UpdatedAt, c.CreatedAt)
}
} }
} }