From 575b02a931253aa753d4bc7ddb1032f4b4a738ce Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 10 Apr 2024 18:02:25 -0700 Subject: [PATCH] accounts/keystore: add sleep back for TestUpdatedKeyfileContents --- accounts/keystore/account_cache_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/accounts/keystore/account_cache_test.go b/accounts/keystore/account_cache_test.go index 1a9f9a4714..5c54a10148 100644 --- a/accounts/keystore/account_cache_test.go +++ b/accounts/keystore/account_cache_test.go @@ -352,8 +352,8 @@ func TestUpdatedKeyfileContents(t *testing.T) { t.Error(err) return } - // needed so that modTime of `file` is different to its current value after forceCopyFile - os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) + // needed so that modTime of `file` will be greater than its current value after forceCopyFile + time.Sleep(time.Second) // Now replace file contents if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil { @@ -368,8 +368,8 @@ func TestUpdatedKeyfileContents(t *testing.T) { return } - // needed so that modTime of `file` is different to its current value after forceCopyFile - os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) + // needed so that modTime of `file` will be greater than its current value after forceCopyFile + time.Sleep(time.Second) // Now replace file contents again if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil { @@ -384,8 +384,8 @@ func TestUpdatedKeyfileContents(t *testing.T) { return } - // needed so that modTime of `file` is different to its current value after os.WriteFile - os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) + // needed so that modTime of `file` will be greater than its current value after os.WriteFile + time.Sleep(time.Second) // Now replace file contents with crap if err := os.WriteFile(file, []byte("foo"), 0600); err != nil {