Skip to content

Commit

Permalink
[TECHDEBT] [P2P] Raintree test suite improvements: edge cases - Issue #…
Browse files Browse the repository at this point in the history
…279

Won't fix / outdated TODOes. Tracked in #179
  • Loading branch information
deblasis authored Oct 5, 2022
1 parent cb8135a commit ba657c9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions p2p/module_raintree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"google.golang.org/protobuf/types/known/anypb"
)

// IMPROVE(team): Looking into adding more tests and accounting for more edge cases.

// ### RainTree Unit Tests ###

func TestRainTreeCompleteOneNodes(t *testing.T) {
Expand Down Expand Up @@ -313,8 +311,6 @@ func prepareConsensusMock(t *testing.T, genesisState modules.GenesisState) *modu
return consensusMock
}

// TODO(team): make the test more rigorous but adding MaxTimes `EmitEvent` expectations. Since we are talking about more than one node
// I have decided to do with `AnyTimes` for the moment.
func prepareTelemetryMock(t *testing.T) *modulesMock.MockTelemetryModule {
ctrl := gomock.NewController(t)
telemetryMock := modulesMock.NewMockTelemetryModule(ctrl)
Expand Down Expand Up @@ -359,7 +355,7 @@ func prepareConnMock(t *testing.T, expectedNumNetworkReads, expectedNumNetworkWr
connMock.EXPECT().Read().DoAndReturn(func() ([]byte, error) {
data := <-testChannel
return data, nil
}).MaxTimes(int(expectedNumNetworkReads + 1)) // INVESTIGATE(olshansky): The +1 is necessary because there is one extra read of empty data by every channel...
}).MaxTimes(int(expectedNumNetworkReads + 1))

connMock.EXPECT().Write(gomock.Any()).DoAndReturn(func(data []byte) error {
testChannel <- data
Expand Down
2 changes: 0 additions & 2 deletions p2p/raintree/peers_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ type ExpectedRainTreeMessageProp struct {
targets []ExpectedRainTreeMessageTarget
}

// IMPROVE(team): Looking into adding more tests and accounting for more edge cases.

func TestRainTreeAddrBookUtilsHandleUpdate(t *testing.T) {
addr, err := cryptoPocket.GenerateAddress()
require.NoError(t, err)
Expand Down

0 comments on commit ba657c9

Please sign in to comment.