store: fix tests

This commit is contained in:
Ethan Buchman 2018-01-15 20:10:46 -05:00
parent e4676102a7
commit 48a864f93d
2 changed files with 13 additions and 9 deletions

View File

@ -111,7 +111,7 @@ func (rs *rootMultiStore) LoadVersion(ver int64) error {
} }
func (rs *rootMultiStore) nameToKey(name string) SubstoreKey { func (rs *rootMultiStore) nameToKey(name string) SubstoreKey {
for key, _ := range rs.substores { for key, _ := range rs.storeLoaders {
if key.Name() == name { if key.Name() == name {
return key return key
} }

View File

@ -4,8 +4,11 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
dbm "github.com/tendermint/tmlibs/db" dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/merkle" "github.com/tendermint/tmlibs/merkle"
sdk "github.com/cosmos/cosmos-sdk/types"
) )
func TestMultistoreCommitLoad(t *testing.T) { func TestMultistoreCommitLoad(t *testing.T) {
@ -65,13 +68,13 @@ func TestMultistoreCommitLoad(t *testing.T) {
func newMultiStoreWithLoaders(db dbm.DB) *rootMultiStore { func newMultiStoreWithLoaders(db dbm.DB) *rootMultiStore {
store := NewCommitMultiStore(db) store := NewCommitMultiStore(db)
storeLoaders := map[string]CommitStoreLoader{ storeLoaders := map[SubstoreKey]CommitStoreLoader{
"store1": newMockCommitStore, sdk.NewKVStoreKey("store1"): newMockCommitStore,
"store2": newMockCommitStore, sdk.NewKVStoreKey("store2"): newMockCommitStore,
"store3": newMockCommitStore, sdk.NewKVStoreKey("store3"): newMockCommitStore,
} }
for name, loader := range storeLoaders { for key, loader := range storeLoaders {
store.SetSubstoreLoader(name, loader) store.SetSubstoreLoader(key, loader)
} }
return store return store
} }
@ -90,9 +93,10 @@ func getExpectedCommitID(store *rootMultiStore, ver int64) CommitID {
} }
} }
func hashStores(stores map[string]CommitStore) []byte { func hashStores(stores map[SubstoreKey]CommitStore) []byte {
m := make(map[string]interface{}, len(stores)) m := make(map[string]interface{}, len(stores))
for name, store := range stores { for key, store := range stores {
name := key.Name()
m[name] = substore{ m[name] = substore{
Name: name, Name: name,
substoreCore: substoreCore{ substoreCore: substoreCore{