Skip to content

Commit

Permalink
rm data race in test
Browse files Browse the repository at this point in the history
  • Loading branch information
countvonzero committed Sep 5, 2023
1 parent 210f2ec commit eb68375
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions activation/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atxHdlr.mValidator.EXPECT().NIPost(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(1), nil)
atxHdlr.mValidator.EXPECT().NIPostChallenge(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().PositioningAtx(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
_, err = atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
_, err := atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
require.NoError(t, err)
})

Expand All @@ -245,7 +245,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atxHdlr.mValidator.EXPECT().NIPostChallenge(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().PositioningAtx(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().VRFNonce(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
_, err = atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
_, err := atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
require.NoError(t, err)
})

Expand Down Expand Up @@ -309,7 +309,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
require.NoError(t, atxHdlr.SyntacticallyValidate(context.Background(), atx))
atxHdlr.mValidator.EXPECT().NIPostChallenge(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().VRFNonce(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("invalid VRF"))
_, err = atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
_, err := atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
require.ErrorContains(t, err, "invalid vrf nonce")
})

Expand Down Expand Up @@ -340,7 +340,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atxHdlr.mValidator.EXPECT().InitialNIPostChallenge(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().NIPost(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(1), nil)
atxHdlr.mValidator.EXPECT().PositioningAtx(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
_, err = atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
_, err := atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
require.NoError(t, err)
})

Expand Down Expand Up @@ -373,7 +373,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atxHdlr.mclock.EXPECT().CurrentLayer().Return(currentLayer)
require.NoError(t, atxHdlr.SyntacticallyValidate(context.Background(), atx))
atxHdlr.mValidator.EXPECT().NIPostChallenge(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("nipost error"))
_, err = atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
_, err := atxHdlr.SyntacticallyValidateDeps(context.Background(), atx)
require.EqualError(t, err, "nipost error")
})

Expand Down Expand Up @@ -437,7 +437,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {

atxHdlr.mclock.EXPECT().CurrentLayer().Return(currentLayer)

err = atxHdlr.SyntacticallyValidate(context.Background(), atx)
err := atxHdlr.SyntacticallyValidate(context.Background(), atx)
require.ErrorContains(t, err, "node id is missing")
})

Expand All @@ -456,7 +456,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atx.InnerActivationTx.NodeID = &nodeID

atxHdlr.mclock.EXPECT().CurrentLayer().Return(currentLayer)
err = atxHdlr.SyntacticallyValidate(context.Background(), atx)
err := atxHdlr.SyntacticallyValidate(context.Background(), atx)
require.ErrorContains(t, err, "vrf nonce is missing")
})

Expand All @@ -483,7 +483,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {
atxHdlr.mValidator.EXPECT().Post(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
atxHdlr.mValidator.EXPECT().VRFNonce(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("invalid VRF nonce"))

err = atxHdlr.SyntacticallyValidate(context.Background(), atx)
err := atxHdlr.SyntacticallyValidate(context.Background(), atx)
require.ErrorContains(t, err, "invalid VRF nonce")
})

Expand Down Expand Up @@ -542,7 +542,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {

atxHdlr.mclock.EXPECT().CurrentLayer().Return(currentLayer)

err = atxHdlr.SyntacticallyValidate(context.Background(), atx)
err := atxHdlr.SyntacticallyValidate(context.Background(), atx)
require.EqualError(t, err, "prev atx declared, but initial post is included")
})

Expand All @@ -561,7 +561,7 @@ func TestHandler_SyntacticallyValidateAtx(t *testing.T) {

atxHdlr.mclock.EXPECT().CurrentLayer().Return(currentLayer)

err = atxHdlr.SyntacticallyValidate(context.Background(), atx)
err := atxHdlr.SyntacticallyValidate(context.Background(), atx)
require.EqualError(t, err, "prev atx declared, but node id is included")
})
}
Expand Down

0 comments on commit eb68375

Please sign in to comment.