Skip to content

Commit

Permalink
Update accounts/keystore/keystore_test.go
Browse files Browse the repository at this point in the history
Co-authored-by: Chihyun Song <ian0371@gmail.com>
  • Loading branch information
blukat29 and ian0371 committed Apr 30, 2024
1 parent 7d95568 commit 0259a34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions accounts/keystore/keystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,19 @@ func TestImportRace(t *testing.T) {
}
dir2, ks2 := tmpKeyStore(t, true)
defer os.RemoveAll(dir2)
var atom uint32
var errCnt uint32
var wg sync.WaitGroup
wg.Add(2)
for i := 0; i < 2; i++ {
go func() {
defer wg.Done()
if _, err := ks2.Import(json, "new", "new"); err != nil {
atomic.AddUint32(&atom, 1)
atomic.AddUint32(&errCnt, 1)
}
}()
}
wg.Wait()
if atom != 1 {
if errCnt != 1 {
t.Errorf("Import is racy")
}
}
Expand Down

0 comments on commit 0259a34

Please sign in to comment.