mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
chore: enable use-any from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -46,7 +46,7 @@ func (rp *MockRestartableProcess) ResetIfNeeded() error {
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (interface{}, error) {
|
||||
func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (any, error) {
|
||||
args := rp.Called(key)
|
||||
return args.Get(0), args.Error(1)
|
||||
}
|
||||
@@ -57,21 +57,21 @@ func (rp *MockRestartableProcess) Stop() {
|
||||
|
||||
type RestartableDelegateTest struct {
|
||||
Function string
|
||||
Inputs []interface{}
|
||||
ExpectedErrorOutputs []interface{}
|
||||
ExpectedDelegateOutputs []interface{}
|
||||
Inputs []any
|
||||
ExpectedErrorOutputs []any
|
||||
ExpectedDelegateOutputs []any
|
||||
}
|
||||
|
||||
type Mockable interface {
|
||||
Test(t mock.TestingT)
|
||||
On(method string, args ...interface{}) *mock.Call
|
||||
On(method string, args ...any) *mock.Call
|
||||
AssertExpectations(t mock.TestingT) bool
|
||||
}
|
||||
|
||||
func RunRestartableDelegateTests(
|
||||
t *testing.T,
|
||||
kind common.PluginKind,
|
||||
newRestartable func(key process.KindAndName, p process.RestartableProcess) interface{},
|
||||
newRestartable func(key process.KindAndName, p process.RestartableProcess) any,
|
||||
newMock func() Mockable,
|
||||
tests ...RestartableDelegateTest,
|
||||
) {
|
||||
@@ -92,7 +92,7 @@ func RunRestartableDelegateTests(
|
||||
method := reflect.ValueOf(r).MethodByName(tc.Function)
|
||||
require.NotEmpty(t, method)
|
||||
|
||||
// Convert the test case inputs ([]interface{}) to []reflect.Value
|
||||
// Convert the test case inputs ([]any) to []reflect.Value
|
||||
var inputValues []reflect.Value
|
||||
for i := range tc.Inputs {
|
||||
inputValues = append(inputValues, reflect.ValueOf(tc.Inputs[i]))
|
||||
@@ -102,7 +102,7 @@ func RunRestartableDelegateTests(
|
||||
actual := method.Call(inputValues)
|
||||
|
||||
// This Function asserts that the actual outputs match the expected outputs
|
||||
checkOutputs := func(expected []interface{}, actual []reflect.Value) {
|
||||
checkOutputs := func(expected []any, actual []reflect.Value) {
|
||||
require.Equal(t, len(expected), len(actual))
|
||||
|
||||
for i := range actual {
|
||||
|
||||
Reference in New Issue
Block a user