Documentation ¶
Index ¶
- func AddNodesToEachOthersPeerStore(t *testing.T, nodes []p2p.LibP2PNode, ids flow.IdentityList)
- func CreateNode(t *testing.T, networkKey crypto.PrivateKey, sporkID flow.Identifier, ...) p2p.LibP2PNode
- func EnsureMessageExchangeOverUnicast(t *testing.T, ctx context.Context, nodes []p2p.LibP2PNode, ...)
- func EnsureNoStreamCreation(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode, ...)
- func EnsureNoStreamCreationBetweenGroups(t *testing.T, ctx context.Context, groupA []p2p.LibP2PNode, ...)
- func EnsureNotConnected(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode)
- func EnsureStreamCreation(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode)
- func HasSubReceivedMessage(t *testing.T, ctx context.Context, expectedMessage []byte, ...) bool
- func LongStringMessageFactoryFixture(t *testing.T) func() string
- func MustEncodeEvent(t *testing.T, v interface{}, channel channels.Channel) []byte
- func NetworkingKeyFixtures(t *testing.T) crypto.PrivateKey
- func SilentNodeFixture(t *testing.T) (net.Listener, flow.Identity)
- func SubMustNeverReceiveAnyMessage(t *testing.T, ctx context.Context, sub p2p.Subscription)
- func SubMustReceiveMessage(t *testing.T, ctx context.Context, expectedMessage []byte, ...)
- func SubsMustNeverReceiveAnyMessage(t *testing.T, ctx context.Context, subs []p2p.Subscription)
- func SubsMustReceiveMessage(t *testing.T, ctx context.Context, expectedMessage []byte, ...)
- func WithSubscriptionFilter(filter pubsub.SubscriptionFilter) nodeOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNodesToEachOthersPeerStore ¶
func AddNodesToEachOthersPeerStore(t *testing.T, nodes []p2p.LibP2PNode, ids flow.IdentityList)
AddNodesToEachOthersPeerStore adds the dialing address of all nodes to the peer store of all other nodes. However, it does not connect them to each other.
func CreateNode ¶
func CreateNode(t *testing.T, networkKey crypto.PrivateKey, sporkID flow.Identifier, logger zerolog.Logger, nodeIds flow.IdentityList, opts ...nodeOpt) p2p.LibP2PNode
TODO: this should be replaced by node fixture: https://github.com/onflow/flow-go/blob/master/network/p2p/test/fixtures.go
func EnsureMessageExchangeOverUnicast ¶
func EnsureMessageExchangeOverUnicast(t *testing.T, ctx context.Context, nodes []p2p.LibP2PNode, inbounds []chan string, messageFactory func() string)
EnsureMessageExchangeOverUnicast ensures that the given nodes exchange arbitrary messages on through unicasting (i.e., stream creation). It fails the test if any of the nodes does not receive the message from the other nodes. The "inbounds" parameter specifies the inbound channel of the nodes on which the messages are received. The "messageFactory" parameter specifies the function that creates unique messages to be sent.
func EnsureNoStreamCreation ¶
func EnsureNoStreamCreation(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode, errorCheckers ...func(*testing.T, error))
EnsureNoStreamCreation ensures that no stream is created "from" the given nodes "to" the given nodes.
func EnsureNoStreamCreationBetweenGroups ¶
func EnsureNoStreamCreationBetweenGroups(t *testing.T, ctx context.Context, groupA []p2p.LibP2PNode, groupB []p2p.LibP2PNode, errorCheckers ...func(*testing.T, error))
EnsureNoStreamCreationBetweenGroups ensures that no stream is created between the given groups of nodes.
func EnsureNotConnected ¶
func EnsureNotConnected(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode)
EnsureNotConnected ensures that no connection exists from "from" nodes to "to" nodes.
func EnsureStreamCreation ¶
func EnsureStreamCreation(t *testing.T, ctx context.Context, from []p2p.LibP2PNode, to []p2p.LibP2PNode)
EnsureStreamCreation ensures that a stream is created between each of the "from" nodes to each of the "to" nodes.
func HasSubReceivedMessage ¶
func HasSubReceivedMessage(t *testing.T, ctx context.Context, expectedMessage []byte, sub p2p.Subscription) bool
HasSubReceivedMessage checks that the subscription have received the given message within the given timeout by the context. It returns true if the subscription has received the message, false otherwise.
func LongStringMessageFactoryFixture ¶
LongStringMessageFactoryFixture returns a function that creates a long unique string message.
func MustEncodeEvent ¶
MustEncodeEvent encodes and returns the given event and fails the test if it faces any issue while encoding.
func NetworkingKeyFixtures ¶
func NetworkingKeyFixtures(t *testing.T) crypto.PrivateKey
NetworkingKeyFixtures is a test helper that generates a ECDSA flow key pair.
func SilentNodeFixture ¶
SilentNodeFixture returns a TCP listener and a node which never replies
func SubMustNeverReceiveAnyMessage ¶
SubMustNeverReceiveAnyMessage checks that the subscription never receives any message within the given timeout by the context.
func SubMustReceiveMessage ¶
func SubMustReceiveMessage(t *testing.T, ctx context.Context, expectedMessage []byte, sub p2p.Subscription)
SubMustReceiveMessage checks that the subscription have received the given message within the given timeout by the context.
func SubsMustNeverReceiveAnyMessage ¶
SubsMustNeverReceiveAnyMessage checks that all subscriptions never receive any message within the given timeout by the context.
func SubsMustReceiveMessage ¶
func SubsMustReceiveMessage(t *testing.T, ctx context.Context, expectedMessage []byte, subs []p2p.Subscription)
SubsMustReceiveMessage checks that all subscriptions receive the given message within the given timeout by the context.
func WithSubscriptionFilter ¶
func WithSubscriptionFilter(filter pubsub.SubscriptionFilter) nodeOpt
Types ¶
This section is empty.