Skip to content

Commit

Permalink
Merge pull request #15498 from nonsense/account_cache_modtime_test_fix
Browse files Browse the repository at this point in the history
accounts/keystore: change modtime for test case files to be bigger than 1sec.
  • Loading branch information
karalabe authored Nov 24, 2017
2 parents f14047d + b645256 commit 0981d2e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestWatchNewFile(t *testing.T) {

// Ensure the watcher is started before adding any files.
ks.Accounts()
time.Sleep(200 * time.Millisecond)
time.Sleep(1000 * time.Millisecond)

// Move in the files.
wantAccounts := make([]accounts.Account, len(cachetestAccounts))
Expand Down Expand Up @@ -349,6 +349,9 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return
}

// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents
if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil {
t.Fatal(err)
Expand All @@ -362,6 +365,9 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return
}

// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents again
if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil {
t.Fatal(err)
Expand All @@ -374,6 +380,10 @@ func TestUpdatedKeyfileContents(t *testing.T) {
t.Error(err)
return
}

// needed so that modTime of `file` is different to its current value after ioutil.WriteFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents with crap
if err := ioutil.WriteFile(file, []byte("foo"), 0644); err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 0981d2e

Please sign in to comment.