Ensure minimum wait time for TestDB_UpdatedAt/WAL test

This commit fixes an issue where the test can be flakey if run on
a system with a higher time resolution. It now waits a minimum of
at least 100ms.
This commit is contained in:
Ben Johnson
2021-04-17 09:37:51 -06:00
parent c70e9c0ba8
commit 1e8bce029f

View File

@@ -100,9 +100,12 @@ func TestDB_UpdatedAt(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
sleepTime := 100 * time.Millisecond
if os.Getenv("CI") != "" { if os.Getenv("CI") != "" {
time.Sleep(1 * time.Second) sleepTime = 1 * time.Second
} }
time.Sleep(sleepTime)
if _, err := sqldb.Exec(`CREATE TABLE t (id INT);`); err != nil { if _, err := sqldb.Exec(`CREATE TABLE t (id INT);`); err != nil {
t.Fatal(err) t.Fatal(err)
} }