Skip to content

Commit

Permalink
accounts: fix TestUpdateKeyfileContents (ethereum#29867)
Browse files Browse the repository at this point in the history
Create the directory before NewKeyStore. This ensures the watcher successfully starts on
the first attempt, and waitWatcherStart functions as intended.
  • Loading branch information
Steven Wang authored and jorgemmsilva committed Jun 17, 2024
1 parent ffdede5 commit fd8a4bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ func TestUpdatedKeyfileContents(t *testing.T) {

// Create a temporary keystore to test with
dir := filepath.Join(os.TempDir(), fmt.Sprintf("eth-keystore-updatedkeyfilecontents-test-%d-%d", os.Getpid(), rand.Int()))

// Create the directory
os.MkdirAll(dir, 0700)
defer os.RemoveAll(dir)

ks := NewKeyStore(dir, LightScryptN, LightScryptP)

list := ks.Accounts()
Expand All @@ -335,9 +340,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
if !waitWatcherStart(ks) {
t.Fatal("keystore watcher didn't start in time")
}
// Create the directory and copy a key file into it.
os.MkdirAll(dir, 0700)
defer os.RemoveAll(dir)
// Copy a key file into it
file := filepath.Join(dir, "aaa")

// Place one of our testfiles in there
Expand Down

0 comments on commit fd8a4bf

Please sign in to comment.