Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accounts/keystore: add sleep back for TestUpdatedKeyfileContents #29508

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down