Skip to content

Commit 0aadc13

Browse files
committed
Pusher engine test: update negative test
Because the event processing now happens in a worker, any errors raised within it are no longer visible to the caller of Process(). Because the test checked for error status, moved the tests to the same package and call the internal processing function directly.
1 parent 6d3f462 commit 0aadc13

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

engine/collection/pusher/engine_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package pusher_test
1+
package pusher
22

33
import (
44
"context"
@@ -10,14 +10,12 @@ import (
1010
"github.com/stretchr/testify/mock"
1111
"github.com/stretchr/testify/suite"
1212

13-
"github.com/onflow/flow-go/engine/collection/pusher"
1413
"github.com/onflow/flow-go/model/flow"
1514
"github.com/onflow/flow-go/model/flow/filter"
1615
"github.com/onflow/flow-go/model/messages"
1716
"github.com/onflow/flow-go/module/irrecoverable"
1817
"github.com/onflow/flow-go/module/metrics"
1918
module "github.com/onflow/flow-go/module/mock"
20-
"github.com/onflow/flow-go/network/channels"
2119
"github.com/onflow/flow-go/network/mocknetwork"
2220
protocol "github.com/onflow/flow-go/state/protocol/mock"
2321
storage "github.com/onflow/flow-go/storage/mock"
@@ -35,7 +33,7 @@ type Suite struct {
3533
collections *storage.Collections
3634
transactions *storage.Transactions
3735

38-
engine *pusher.Engine
36+
engine *Engine
3937
}
4038

4139
func (suite *Suite) SetupTest() {
@@ -66,7 +64,7 @@ func (suite *Suite) SetupTest() {
6664
suite.collections = new(storage.Collections)
6765
suite.transactions = new(storage.Transactions)
6866

69-
suite.engine, err = pusher.New(
67+
suite.engine, err = New(
7068
zerolog.New(io.Discard),
7169
net,
7270
suite.state,
@@ -119,7 +117,7 @@ func (suite *Suite) TestSubmitCollectionGuaranteeNonLocal() {
119117
msg := &messages.SubmitCollectionGuarantee{
120118
Guarantee: *guarantee,
121119
}
122-
err := suite.engine.Process(channels.PushGuarantees, sender.NodeID, msg)
120+
err := suite.engine.process(sender.NodeID, msg)
123121
suite.Require().Error(err)
124122

125123
suite.conduit.AssertNumberOfCalls(suite.T(), "Multicast", 0)

0 commit comments

Comments
 (0)