diff --git a/Makefile b/Makefile index bfdaf0077..9985c39ad 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,11 @@ dist: test: @echo "--> Running go test" - @go test $(PACKAGES) + @go test -p 1 $(PACKAGES) test_race: @echo "--> Running go test --race" - @go test -v -race $(PACKAGES) + @go test -p 1 -v -race $(PACKAGES) test_integrations: @bash ./test/test.sh diff --git a/rpc/client/mock/abci_test.go b/rpc/client/mock/abci_test.go index 50e767edf..ce9a12728 100644 --- a/rpc/client/mock/abci_test.go +++ b/rpc/client/mock/abci_test.go @@ -2,10 +2,12 @@ package mock_test import ( "errors" + "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/tendermint/abci/example/dummy" abci "github.com/tendermint/abci/types" ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/tendermint/tendermint/types" @@ -138,5 +140,27 @@ func TestABCIRecorder(t *testing.T) { assert.Nil(ba.Response) require.NotNil(ba.Error) assert.EqualValues(ba.Args, txs[2]) +} + +func TestABCIApp(t *testing.T) { + assert, require := assert.New(t), require.New(t) + app := dummy.NewDummyApplication() + m := mock.ABCIApp{app} + + // get some info + info, err := m.ABCIInfo() + require.Nil(err) + assert.Equal(`{"size":0}`, info.Response.GetData()) + + // add a key + key, value := "foo", "bar" + tx := fmt.Sprintf("%s=%s", key, value) + res, err := m.BroadcastTxSync(types.Tx(tx)) + require.Nil(err) + assert.True(res.Code.IsOK()) + // check the key + qres, err := m.ABCIQuery("/key", []byte(key), false) + require.Nil(err) + assert.EqualValues(value, qres.Response.Value) }