From 1e8bce029fa5826f4d5bf0f1a02fc0180e2e6485 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 17 Apr 2021 09:37:51 -0600 Subject: [PATCH] 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. --- db_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db_test.go b/db_test.go index a302067..35b9951 100644 --- a/db_test.go +++ b/db_test.go @@ -100,9 +100,12 @@ func TestDB_UpdatedAt(t *testing.T) { t.Fatal(err) } + sleepTime := 100 * time.Millisecond 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 { t.Fatal(err) }