accounts/keystore: add sleep back for TestUpdatedKeyfileContents

This commit is contained in:
Darioush Jalali 2024-04-10 18:02:25 -07:00
parent 34aac1d756
commit 575b02a931
No known key found for this signature in database
GPG key ID: 3A24B01A606B0548

View file

@ -352,8 +352,8 @@ func TestUpdatedKeyfileContents(t *testing.T) {
t.Error(err) t.Error(err)
return return
} }
// needed so that modTime of `file` is different to its current value after forceCopyFile // needed so that modTime of `file` will be greater than its current value after forceCopyFile
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) time.Sleep(time.Second)
// Now replace file contents // Now replace file contents
if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil { if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil {
@ -368,8 +368,8 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return return
} }
// needed so that modTime of `file` is different to its current value after forceCopyFile // needed so that modTime of `file` will be greater than its current value after forceCopyFile
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) time.Sleep(time.Second)
// Now replace file contents again // Now replace file contents again
if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil { if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil {
@ -384,8 +384,8 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return return
} }
// needed so that modTime of `file` is different to its current value after os.WriteFile // needed so that modTime of `file` will be greater than its current value after os.WriteFile
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) time.Sleep(time.Second)
// Now replace file contents with crap // Now replace file contents with crap
if err := os.WriteFile(file, []byte("foo"), 0600); err != nil { if err := os.WriteFile(file, []byte("foo"), 0600); err != nil {