diff --git a/test/mock/mock_web_api_test.go b/test/mock/mock_web_api_test.go index fc4d9c69b15bc7e35b8d56b6397b5e99f53677b9..378097c82bf287465529995e2f98f1af2dfaeb39 100644 --- a/test/mock/mock_web_api_test.go +++ b/test/mock/mock_web_api_test.go @@ -9,12 +9,13 @@ import ( "runtime" "testing" - "github.com/eris-ltd/eris-db/account" - core "github.com/eris-ltd/eris-db/core" + account "github.com/eris-ltd/eris-db/account" core_types "github.com/eris-ltd/eris-db/core/types" - "github.com/eris-ltd/eris-db/rpc" - "github.com/eris-ltd/eris-db/server" - td "github.com/eris-ltd/eris-db/test/testdata/testdata" + event "github.com/eris-ltd/eris-db/event" + rpc "github.com/eris-ltd/eris-db/rpc" + rpc_v0 "github.com/eris-ltd/eris-db/rpc/v0" + server "github.com/eris-ltd/eris-db/server" + td "github.com/eris-ltd/eris-db/test/testdata/testdata" "github.com/eris-ltd/eris-db/txs" "github.com/gin-gonic/gin" @@ -45,20 +46,20 @@ func (this *MockSuite) SetupSuite() { // Load the supporting objects. testData := td.LoadTestData() pipe := NewMockPipe(testData) - codec := &core_types.TCodec{} - evtSubs := core.NewEventSubscriptions(pipe.Events()) + codec := &rpc_v0.TCodec{} + evtSubs := event.NewEventSubscriptions(pipe.Events()) // The server - restServer := core.NewRestServer(codec, pipe, evtSubs) + restServer := rpc_v0.NewRestServer(codec, pipe, evtSubs) sConf := server.DefaultServerConfig() sConf.Bind.Port = 31402 // Create a server process. - proc := server.NewServeProcess(sConf, restServer) + proc, _ := server.NewServeProcess(sConf, restServer) err := proc.Start() if err != nil { panic(err) } this.serveProcess = proc - this.codec = core_types.NewTCodec() + this.codec = rpc_v0.NewTCodec() this.testData = testData this.sUrl = "http://localhost:31402" } diff --git a/test/mock/pipe.go b/test/mock/pipe.go index 21e946fc7e835a2bfb0519c02e829d3db1d33c85..cc6460da3720245013fb9002af2def6a6b616caf 100644 --- a/test/mock/pipe.go +++ b/test/mock/pipe.go @@ -1,14 +1,16 @@ package mock import ( - "github.com/eris-ltd/eris-db/account" - core_types "github.com/eris-ltd/eris-db/core/types" - definitions "github.com/eris-ltd/eris-db/definitions" - event "github.com/eris-ltd/eris-db/event" - td "github.com/eris-ltd/eris-db/test/testdata/testdata" - types "github.com/eris-ltd/eris-db/txs" + account "github.com/eris-ltd/eris-db/account" + core_types "github.com/eris-ltd/eris-db/core/types" + definitions "github.com/eris-ltd/eris-db/definitions" + event "github.com/eris-ltd/eris-db/event" + manager_types "github.com/eris-ltd/eris-db/manager/types" + td "github.com/eris-ltd/eris-db/test/testdata/testdata" + types "github.com/eris-ltd/eris-db/txs" mintTypes "github.com/tendermint/tendermint/types" + evts "github.com/tendermint/go-events" ) // Base struct. @@ -65,18 +67,27 @@ func (this *MockPipe) Events() event.EventEmitter { return this.events } -func (this *MockPipe) NameReg() core_types.NameReg { +func (this *MockPipe) NameReg() definitions.NameReg { return this.namereg } -func (this *MockPipe) Net() core_types.Net { +func (this *MockPipe) Net() definitions.Net { return this.net } -func (this *MockPipe) Transactor() core_types.Transactor { +func (this *MockPipe) Transactor() definitions.Transactor { return this.transactor } +func (this *MockPipe) GetApplication() manager_types.Application { + // TODO: [ben] mock application + return nil +} + +func (this *MockPipe) SetConsensusEngine(_ definitions.ConsensusEngine) error { + // TODO: [ben] mock consensus engine + return nil +} // Components // Accounts @@ -159,7 +170,7 @@ type eventer struct { testData *td.TestData } -func (this *eventer) Subscribe(subId, event string, callback func(events.EventData)) (bool, error) { +func (this *eventer) Subscribe(subId, event string, callback func(evts.EventData)) (bool, error) { return true, nil } diff --git a/test/server/ws_burst_test.go b/test/server/ws_burst_test.go index d7d656c9c2261fa6d23c2da4182101bb33456d20..4316af17980813a26409f2c9b2099936accf3b18 100644 --- a/test/server/ws_burst_test.go +++ b/test/server/ws_burst_test.go @@ -65,9 +65,9 @@ func TestWsFlooding(t *testing.T) { assert.NoError(t, errRun, "ScumSocketed!") assert.NoError(t, errStop, "ScumSocketed!") o, c, a := sc.Report() - assert.Equal(t, o, CONNS, "Server registered '%d' opened conns out of '%d'", o, CONNS) - assert.Equal(t, c, CONNS, "Server registered '%d' closed conns out of '%d'", c, CONNS) - assert.Equal(t, a, 0, "Server registered '%d' conns still active after shutting down.", a) + assert.Equal(t, uint16(o), CONNS, "Server registered '%d' opened conns out of '%d'", o, CONNS) + assert.Equal(t, uint16(c), CONNS, "Server registered '%d' closed conns out of '%d'", c, CONNS) + assert.Equal(t, uint16(a), uint16(0), "Server registered '%d' conns still active after shutting down.", a) } func runWs() error { diff --git a/test/testdata/testdata/testdata.go b/test/testdata/testdata/testdata.go index 39d24603173723ddb307eb4c008a486dbf6744ff..811ee65547ed07703f597d4b1958dbe090281463 100644 --- a/test/testdata/testdata/testdata.go +++ b/test/testdata/testdata/testdata.go @@ -1,6 +1,8 @@ package testdata import ( + wire "github.com/tendermint/go-wire" + account "github.com/eris-ltd/eris-db/account" core_types "github.com/eris-ltd/eris-db/core/types" event "github.com/eris-ltd/eris-db/event"