Skip to content

Commit

Permalink
Merge "Fix txmgr test failure - CouchDB query limit"
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivasan Muralidharan authored and Gerrit Code Review committed Mar 26, 2017
2 parents 0460f21 + 1279870 commit 9a5b6a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/ledger/kvledger/txmgmt/txmgr/commontests/txmgr_test.go
Expand Up @@ -24,8 +24,13 @@ import (
"github.com/hyperledger/fabric/common/ledger/testutil"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/version"
ledgertestutil "github.com/hyperledger/fabric/core/ledger/testutil"
)

func TestMain(m *testing.M) {
ledgertestutil.SetupCoreYAMLConfig("./../../../../../../peer")
}

func TestTxSimulatorWithNoExistingData(t *testing.T) {
// run the tests for each environment configured in pkg_test.go
for _, testEnv := range testEnvs {
Expand Down Expand Up @@ -390,7 +395,6 @@ func testIteratorWithDeletes(t *testing.T, env testEnv) {
defer itr.Close()
kv, _ := itr.Next()
testutil.AssertEquals(t, kv.(*ledger.KV).Key, createTestKey(3))

kv, _ = itr.Next()
testutil.AssertEquals(t, kv.(*ledger.KV).Key, createTestKey(5))
}
Expand Down
7 changes: 6 additions & 1 deletion core/ledger/ledgerconfig/ledger_config.go
Expand Up @@ -91,7 +91,12 @@ func GetCouchDBDefinition() *CouchDBDef {

//GetQueryLimit exposes the queryLimit variable
func GetQueryLimit() int {
return viper.GetInt("ledger.state.queryLimit")
queryLimit := viper.GetInt("ledger.state.queryLimit")
// if queryLimit was unset, default to 10000
if queryLimit == 0 {
queryLimit = 10000
}
return queryLimit
}

//IsHistoryDBEnabled exposes the historyDatabase variable
Expand Down

0 comments on commit 9a5b6a2

Please sign in to comment.