Skip to content

Commit

Permalink
Fix race in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
arijitAD committed Mar 24, 2021
1 parent ca4d061 commit bade5cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dot/state/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,25 @@ func TestStorage_LoadFromDB(t *testing.T) {
require.NoError(t, err)

// Clear trie from cache and fetch data from disk.
storage.lock.Lock()
delete(storage.tries, root)
storage.lock.Unlock()

data, err := storage.GetStorage(&root, trieKV[0].key)
require.NoError(t, err)
require.Equal(t, trieKV[0].value, data)

storage.lock.Lock()
delete(storage.tries, root)
storage.lock.Unlock()

prefixKeys, err := storage.GetKeysWithPrefix(&root, []byte("ke"))
require.NoError(t, err)
require.Equal(t, 2, len(prefixKeys))

storage.lock.Lock()
delete(storage.tries, root)
storage.lock.Unlock()

entries, err := storage.Entries(&root)
require.NoError(t, err)
Expand Down

0 comments on commit bade5cf

Please sign in to comment.