Merge PR #4651: Remove debugdb & colors
This commit is contained in:
parent
48e8161f25
commit
b5cd01d1a8
|
@ -12,8 +12,6 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/store/types"
|
"github.com/cosmos/cosmos-sdk/store/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const useDebugDB = false
|
|
||||||
|
|
||||||
func TestStoreType(t *testing.T) {
|
func TestStoreType(t *testing.T) {
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
store := NewStore(db)
|
store := NewStore(db)
|
||||||
|
@ -39,9 +37,6 @@ func TestStoreMount(t *testing.T) {
|
||||||
|
|
||||||
func TestCacheMultiStoreWithVersion(t *testing.T) {
|
func TestCacheMultiStoreWithVersion(t *testing.T) {
|
||||||
var db dbm.DB = dbm.NewMemDB()
|
var db dbm.DB = dbm.NewMemDB()
|
||||||
if useDebugDB {
|
|
||||||
db = dbm.NewDebugDB("CMS", db)
|
|
||||||
}
|
|
||||||
ms := newMultiStoreWithMounts(db)
|
ms := newMultiStoreWithMounts(db)
|
||||||
err := ms.LoadLatestVersion()
|
err := ms.LoadLatestVersion()
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
@ -79,9 +74,6 @@ func TestCacheMultiStoreWithVersion(t *testing.T) {
|
||||||
|
|
||||||
func TestHashStableWithEmptyCommit(t *testing.T) {
|
func TestHashStableWithEmptyCommit(t *testing.T) {
|
||||||
var db dbm.DB = dbm.NewMemDB()
|
var db dbm.DB = dbm.NewMemDB()
|
||||||
if useDebugDB {
|
|
||||||
db = dbm.NewDebugDB("CMS", db)
|
|
||||||
}
|
|
||||||
ms := newMultiStoreWithMounts(db)
|
ms := newMultiStoreWithMounts(db)
|
||||||
err := ms.LoadLatestVersion()
|
err := ms.LoadLatestVersion()
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
@ -106,9 +98,6 @@ func TestHashStableWithEmptyCommit(t *testing.T) {
|
||||||
|
|
||||||
func TestMultistoreCommitLoad(t *testing.T) {
|
func TestMultistoreCommitLoad(t *testing.T) {
|
||||||
var db dbm.DB = dbm.NewMemDB()
|
var db dbm.DB = dbm.NewMemDB()
|
||||||
if useDebugDB {
|
|
||||||
db = dbm.NewDebugDB("CMS", db)
|
|
||||||
}
|
|
||||||
store := newMultiStoreWithMounts(db)
|
store := newMultiStoreWithMounts(db)
|
||||||
err := store.LoadLatestVersion()
|
err := store.LoadLatestVersion()
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
|
@ -8,14 +8,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
cmn "github.com/tendermint/tendermint/libs/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExecuteT executes the command, pipes any input to STDIN and return STDOUT,
|
// ExecuteT executes the command, pipes any input to STDIN and return STDOUT,
|
||||||
// logging STDOUT/STDERR to t.
|
// logging STDOUT/STDERR to t.
|
||||||
// nolint: errcheck
|
// nolint: errcheck
|
||||||
func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) {
|
func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) {
|
||||||
t.Log("Running", cmn.Cyan(cmd))
|
t.Log("Running", cmd)
|
||||||
|
|
||||||
// split cmd to name and args
|
// split cmd to name and args
|
||||||
split := strings.Split(cmd, " ")
|
split := strings.Split(cmd, " ")
|
||||||
|
@ -43,11 +42,11 @@ func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) {
|
||||||
proc.Wait()
|
proc.Wait()
|
||||||
|
|
||||||
if len(outbz) > 0 {
|
if len(outbz) > 0 {
|
||||||
t.Log("Stdout:", cmn.Green(string(outbz)))
|
t.Log("Stdout:", string(outbz))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errbz) > 0 {
|
if len(errbz) > 0 {
|
||||||
t.Log("Stderr:", cmn.Red(string(errbz)))
|
t.Log("Stderr:", string(errbz))
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout = strings.Trim(string(outbz), "\n")
|
stdout = strings.Trim(string(outbz), "\n")
|
||||||
|
@ -59,7 +58,7 @@ func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) {
|
||||||
// Execute the command, launch goroutines to log stdout/err to t.
|
// Execute the command, launch goroutines to log stdout/err to t.
|
||||||
// Caller should wait for .Wait() or .Stop() to terminate.
|
// Caller should wait for .Wait() or .Stop() to terminate.
|
||||||
func GoExecuteT(t *testing.T, cmd string) (proc *Process) {
|
func GoExecuteT(t *testing.T, cmd string) (proc *Process) {
|
||||||
t.Log("Running", cmn.Cyan(cmd))
|
t.Log("Running", cmd)
|
||||||
|
|
||||||
// Split cmd to name and args.
|
// Split cmd to name and args.
|
||||||
split := strings.Split(cmd, " ")
|
split := strings.Split(cmd, " ")
|
||||||
|
@ -77,7 +76,7 @@ func GoExecuteT(t *testing.T, cmd string) (proc *Process) {
|
||||||
|
|
||||||
// Same as GoExecuteT but spawns a go routine to ReadAll off stdout.
|
// Same as GoExecuteT but spawns a go routine to ReadAll off stdout.
|
||||||
func GoExecuteTWithStdout(t *testing.T, cmd string) (proc *Process) {
|
func GoExecuteTWithStdout(t *testing.T, cmd string) (proc *Process) {
|
||||||
t.Log("Running", cmn.Cyan(cmd))
|
t.Log("Running", cmd)
|
||||||
|
|
||||||
// Split cmd to name and args.
|
// Split cmd to name and args.
|
||||||
split := strings.Split(cmd, " ")
|
split := strings.Split(cmd, " ")
|
||||||
|
|
Loading…
Reference in New Issue