accounts: fix TestUpdateKeyfileContents (#29867)
Create the directory before NewKeyStore. This ensures the watcher successfully starts on the first attempt, and waitWatcherStart functions as intended.
This commit is contained in:
parent
153f8da887
commit
b8cf1636d4
@ -326,6 +326,11 @@ func TestUpdatedKeyfileContents(t *testing.T) {
|
|||||||
|
|
||||||
// Create a temporary keystore to test with
|
// Create a temporary keystore to test with
|
||||||
dir := filepath.Join(os.TempDir(), fmt.Sprintf("eth-keystore-updatedkeyfilecontents-test-%d-%d", os.Getpid(), rand.Int()))
|
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)
|
ks := NewKeyStore(dir, LightScryptN, LightScryptP)
|
||||||
|
|
||||||
list := ks.Accounts()
|
list := ks.Accounts()
|
||||||
@ -335,9 +340,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
|
|||||||
if !waitWatcherStart(ks) {
|
if !waitWatcherStart(ks) {
|
||||||
t.Fatal("keystore watcher didn't start in time")
|
t.Fatal("keystore watcher didn't start in time")
|
||||||
}
|
}
|
||||||
// Create the directory and copy a key file into it.
|
// Copy a key file into it
|
||||||
os.MkdirAll(dir, 0700)
|
|
||||||
defer os.RemoveAll(dir)
|
|
||||||
file := filepath.Join(dir, "aaa")
|
file := filepath.Join(dir, "aaa")
|
||||||
|
|
||||||
// Place one of our testfiles in there
|
// Place one of our testfiles in there
|
||||||
|
Loading…
Reference in New Issue
Block a user