[#48] pool/test: remove defer for controller close

We have go1.16 in go.mod and `gomock.NewController` comment indicates:
```
New in go1.14+, if you are passing a *testing.T into this function you no
longer need to call ctrl.Finish() in your test methods.
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-10-26 15:00:55 +03:00 committed by Alex Vanin
parent a64aa36c1a
commit d541aab1ff

View file

@ -39,7 +39,6 @@ func TestBuildPoolClientFailed(t *testing.T) {
func TestBuildPoolCreateSessionFailed(t *testing.T) { func TestBuildPoolCreateSessionFailed(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
key, err := keys.NewPrivateKey() key, err := keys.NewPrivateKey()
require.NoError(t, err) require.NoError(t, err)
@ -68,9 +67,7 @@ func TestBuildPoolCreateSessionFailed(t *testing.T) {
func TestBuildPoolOneNodeFailed(t *testing.T) { func TestBuildPoolOneNodeFailed(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
ctrl2 := gomock.NewController(t) ctrl2 := gomock.NewController(t)
defer ctrl2.Finish()
key, err := keys.NewPrivateKey() key, err := keys.NewPrivateKey()
require.NoError(t, err) require.NoError(t, err)
@ -143,7 +140,6 @@ func TestBuildPoolZeroNodes(t *testing.T) {
func TestOneNode(t *testing.T) { func TestOneNode(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
tok := session.NewToken() tok := session.NewToken()
uid, err := uuid.New().MarshalBinary() uid, err := uuid.New().MarshalBinary()
@ -180,7 +176,6 @@ func TestOneNode(t *testing.T) {
func TestTwoNodes(t *testing.T) { func TestTwoNodes(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
var tokens []*session.Token var tokens []*session.Token
clientBuilder := func(opts ...client.Option) (client.Client, error) { clientBuilder := func(opts ...client.Option) (client.Client, error) {
@ -221,9 +216,7 @@ func TestTwoNodes(t *testing.T) {
func TestOneOfTwoFailed(t *testing.T) { func TestOneOfTwoFailed(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
ctrl2 := gomock.NewController(t) ctrl2 := gomock.NewController(t)
defer ctrl2.Finish()
var tokens []*session.Token var tokens []*session.Token
clientCount := -1 clientCount := -1
@ -283,7 +276,6 @@ func TestOneOfTwoFailed(t *testing.T) {
func TestTwoFailed(t *testing.T) { func TestTwoFailed(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
clientBuilder := func(opts ...client.Option) (client.Client, error) { clientBuilder := func(opts ...client.Option) (client.Client, error) {
mockClient := NewMockClient(ctrl) mockClient := NewMockClient(ctrl)
@ -329,7 +321,6 @@ func newToken(t *testing.T) *session.Token {
func TestWaitPresence(t *testing.T) { func TestWaitPresence(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockClient := NewMockClient(ctrl) mockClient := NewMockClient(ctrl)
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()