From 80eb45fcfb73be7ecf55caba443c0c2fcfbd278c Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 28 Nov 2016 23:37:22 -0700 Subject: [PATCH] tls: Improve flaky test depending on CPU scheduling (I think) --- caddytls/user_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/caddytls/user_test.go b/caddytls/user_test.go index 77d04d4a..0b7490a6 100644 --- a/caddytls/user_test.go +++ b/caddytls/user_test.go @@ -166,12 +166,12 @@ func TestGetEmail(t *testing.T) { t.Fatalf("Error saving user %d: %v", i, err) } - // Change modified time so they're all different, so the test becomes deterministic + // Change modified time so they're all different and the test becomes more deterministic f, err := os.Stat(testStorage.user(eml)) if err != nil { t.Fatalf("Could not access user folder for '%s': %v", eml, err) } - chTime := f.ModTime().Add(-(time.Duration(i) * time.Second)) + chTime := f.ModTime().Add(-(time.Duration(i) * time.Hour)) // 1 second isn't always enough space! if err := os.Chtimes(testStorage.user(eml), chTime, chTime); err != nil { t.Fatalf("Could not change user folder mod time for '%s': %v", eml, err) }