chore(tests): migrate to use go.uber.org/mock instead of github.com/golang/mock

This commit is contained in:
Quentin McGaw
2026-07-19 13:16:15 +00:00
parent e7b304d0b4
commit 08e0403d2b
53 changed files with 492 additions and 382 deletions
+26 -17
View File
@@ -1,5 +1,10 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/qdm12/gluetun/internal/provider/common (interfaces: ParallelResolver,Storage,Unzipper,Warner)
//
// Generated by this command:
//
// mockgen -destination=mocks.go -package common . ParallelResolver,Storage,Unzipper,Warner
//
// Package common is a generated GoMock package.
package common
@@ -9,16 +14,17 @@ import (
netip "net/netip"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
settings "github.com/qdm12/gluetun/internal/configuration/settings"
models "github.com/qdm12/gluetun/internal/models"
resolver "github.com/qdm12/gluetun/internal/updater/resolver"
gomock "go.uber.org/mock/gomock"
)
// MockParallelResolver is a mock of ParallelResolver interface.
type MockParallelResolver struct {
ctrl *gomock.Controller
recorder *MockParallelResolverMockRecorder
isgomock struct{}
}
// MockParallelResolverMockRecorder is the mock recorder for MockParallelResolver.
@@ -39,9 +45,9 @@ func (m *MockParallelResolver) EXPECT() *MockParallelResolverMockRecorder {
}
// Resolve mocks base method.
func (m *MockParallelResolver) Resolve(arg0 context.Context, arg1 resolver.ParallelSettings) (map[string][]netip.Addr, []string, error) {
func (m *MockParallelResolver) Resolve(ctx context.Context, arg1 resolver.ParallelSettings) (map[string][]netip.Addr, []string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Resolve", arg0, arg1)
ret := m.ctrl.Call(m, "Resolve", ctx, arg1)
ret0, _ := ret[0].(map[string][]netip.Addr)
ret1, _ := ret[1].([]string)
ret2, _ := ret[2].(error)
@@ -49,15 +55,16 @@ func (m *MockParallelResolver) Resolve(arg0 context.Context, arg1 resolver.Paral
}
// Resolve indicates an expected call of Resolve.
func (mr *MockParallelResolverMockRecorder) Resolve(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockParallelResolverMockRecorder) Resolve(ctx, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Resolve", reflect.TypeOf((*MockParallelResolver)(nil).Resolve), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Resolve", reflect.TypeOf((*MockParallelResolver)(nil).Resolve), ctx, arg1)
}
// MockStorage is a mock of Storage interface.
type MockStorage struct {
ctrl *gomock.Controller
recorder *MockStorageMockRecorder
isgomock struct{}
}
// MockStorageMockRecorder is the mock recorder for MockStorage.
@@ -78,24 +85,25 @@ func (m *MockStorage) EXPECT() *MockStorageMockRecorder {
}
// FilterServers mocks base method.
func (m *MockStorage) FilterServers(arg0 string, arg1 settings.ServerSelection) ([]models.Server, error) {
func (m *MockStorage) FilterServers(provider string, selection settings.ServerSelection) ([]models.Server, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FilterServers", arg0, arg1)
ret := m.ctrl.Call(m, "FilterServers", provider, selection)
ret0, _ := ret[0].([]models.Server)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// FilterServers indicates an expected call of FilterServers.
func (mr *MockStorageMockRecorder) FilterServers(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockStorageMockRecorder) FilterServers(provider, selection any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FilterServers", reflect.TypeOf((*MockStorage)(nil).FilterServers), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FilterServers", reflect.TypeOf((*MockStorage)(nil).FilterServers), provider, selection)
}
// MockUnzipper is a mock of Unzipper interface.
type MockUnzipper struct {
ctrl *gomock.Controller
recorder *MockUnzipperMockRecorder
isgomock struct{}
}
// MockUnzipperMockRecorder is the mock recorder for MockUnzipper.
@@ -116,24 +124,25 @@ func (m *MockUnzipper) EXPECT() *MockUnzipperMockRecorder {
}
// FetchAndExtract mocks base method.
func (m *MockUnzipper) FetchAndExtract(arg0 context.Context, arg1 string) (map[string][]byte, error) {
func (m *MockUnzipper) FetchAndExtract(ctx context.Context, url string) (map[string][]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FetchAndExtract", arg0, arg1)
ret := m.ctrl.Call(m, "FetchAndExtract", ctx, url)
ret0, _ := ret[0].(map[string][]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// FetchAndExtract indicates an expected call of FetchAndExtract.
func (mr *MockUnzipperMockRecorder) FetchAndExtract(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockUnzipperMockRecorder) FetchAndExtract(ctx, url any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchAndExtract", reflect.TypeOf((*MockUnzipper)(nil).FetchAndExtract), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchAndExtract", reflect.TypeOf((*MockUnzipper)(nil).FetchAndExtract), ctx, url)
}
// MockWarner is a mock of Warner interface.
type MockWarner struct {
ctrl *gomock.Controller
recorder *MockWarnerMockRecorder
isgomock struct{}
}
// MockWarnerMockRecorder is the mock recorder for MockWarner.
@@ -154,13 +163,13 @@ func (m *MockWarner) EXPECT() *MockWarnerMockRecorder {
}
// Warn mocks base method.
func (m *MockWarner) Warn(arg0 string) {
func (m *MockWarner) Warn(s string) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Warn", arg0)
m.ctrl.Call(m, "Warn", s)
}
// Warn indicates an expected call of Warn.
func (mr *MockWarnerMockRecorder) Warn(arg0 interface{}) *gomock.Call {
func (mr *MockWarnerMockRecorder) Warn(s any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockWarner)(nil).Warn), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockWarner)(nil).Warn), s)
}
@@ -5,7 +5,6 @@ import (
"net/netip"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
@@ -13,6 +12,7 @@ import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func Test_Provider_GetConnection(t *testing.T) {
@@ -7,13 +7,13 @@ import (
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/constants/vpn"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/internal/updater/resolver"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
func Test_Updater_GetServers(t *testing.T) {
+1 -1
View File
@@ -6,7 +6,6 @@ import (
"net/netip"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
@@ -14,6 +13,7 @@ import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func Test_Provider_GetConnection(t *testing.T) {
@@ -10,13 +10,13 @@ import (
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/constants/vpn"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/internal/updater/resolver"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
func Test_Updater_GetServers(t *testing.T) {
+1 -1
View File
@@ -6,7 +6,6 @@ import (
"net/netip"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
@@ -14,6 +13,7 @@ import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func Test_Provider_GetConnection(t *testing.T) {
+1 -1
View File
@@ -6,7 +6,6 @@ import (
"net/netip"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
@@ -14,6 +13,7 @@ import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func Test_GetConnection(t *testing.T) {
@@ -7,10 +7,10 @@ import (
"strings"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
"golang.org/x/net/html"
)
@@ -6,7 +6,6 @@ import (
"net/netip"
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
@@ -14,6 +13,7 @@ import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func Test_Provider_GetConnection(t *testing.T) {