Skip to content

Commit

Permalink
fix a test that expected the old behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
electricmonk committed Dec 17, 2019
1 parent c0c07d4 commit d18edde
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions services/gossip/adapter/tcp/direct_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func TestDirectTransport_HandlesStartupWithEmptyPeerList(t *testing.T) {

func TestDirectTransport_SupportsTopologyChangeInRuntime(t *testing.T) {
with.Concurrency(t, func(ctx context.Context, harness *with.ConcurrencyHarness) {
harness.AllowErrorsMatching("failed sending gossip message") // because the test will send to node3 which is not in topology

node1 := aNode(ctx, harness.Logger)
node2 := aNode(ctx, harness.Logger)
node3 := aNode(ctx, harness.Logger)
Expand Down Expand Up @@ -86,12 +88,16 @@ func TestDirectTransport_SupportsTopologyChangeInRuntime(t *testing.T) {

node1.requireSendsSuccessfullyTo(t, ctx, node4)
node1.requireSendsSuccessfullyTo(t, ctx, node2)
require.Error(t, node2.transport.Send(ctx, &adapter.TransportData{
node2.listener.ExpectNotReceive()

node2.transport.Send(ctx, &adapter.TransportData{
SenderNodeAddress: node2.address,
RecipientMode: gossipmessages.RECIPIENT_LIST_MODE_LIST,
RecipientNodeAddresses: []primitives.NodeAddress{node3.address},
Payloads: aMessage(),
}), "node 2 was able to send a message to node 3 which is no longer a part of its topology")
})

require.NoError(t, test.ConsistentlyVerify(test.EVENTUALLY_ADAPTER_TIMEOUT, node1.listener, node2.listener, node3.listener), "node 2 was able to send a message to node 3 which is no longer a part of its topology")
})
}

Expand Down Expand Up @@ -138,7 +144,7 @@ func TestDirectTransport_SupportsBroadcastTransmissions(t *testing.T) {

func TestDirectTransport_FailsGracefullyIfMulticastFailedToSendToASingleRecipient(t *testing.T) {
with.Concurrency(t, func(ctx context.Context, harness *with.ConcurrencyHarness) {
harness.AllowErrorsMatching("failed sending gossip message")
harness.AllowErrorsMatching("failed sending gossip message") // because the test will send to an arbitrary recipient which is not in topology

node1 := aNode(ctx, harness.Logger)
node2 := aNode(ctx, harness.Logger)
Expand Down

0 comments on commit d18edde

Please sign in to comment.