Add UT for pkg/cmd/cli/backup (#6400)

Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
danfengliu
2023-06-21 11:10:13 +08:00
committed by GitHub
parent 6f3adcf728
commit ef443fece0
33 changed files with 2984 additions and 32 deletions
@@ -0,0 +1,79 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
discovery "k8s.io/client-go/discovery"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1"
)
// Interface is an autogenerated mock type for the Interface type
type Interface struct {
mock.Mock
}
// Discovery provides a mock function with given fields:
func (_m *Interface) Discovery() discovery.DiscoveryInterface {
ret := _m.Called()
var r0 discovery.DiscoveryInterface
if rf, ok := ret.Get(0).(func() discovery.DiscoveryInterface); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(discovery.DiscoveryInterface)
}
}
return r0
}
// VeleroV1 provides a mock function with given fields:
func (_m *Interface) VeleroV1() v1.VeleroV1Interface {
ret := _m.Called()
var r0 v1.VeleroV1Interface
if rf, ok := ret.Get(0).(func() v1.VeleroV1Interface); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.VeleroV1Interface)
}
}
return r0
}
// VeleroV2alpha1 provides a mock function with given fields:
func (_m *Interface) VeleroV2alpha1() v2alpha1.VeleroV2alpha1Interface {
ret := _m.Called()
var r0 v2alpha1.VeleroV2alpha1Interface
if rf, ok := ret.Get(0).(func() v2alpha1.VeleroV2alpha1Interface); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v2alpha1.VeleroV2alpha1Interface)
}
}
return r0
}
// NewInterface creates a new instance of Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewInterface(t interface {
mock.TestingT
Cleanup(func())
}) *Interface {
mock := &Interface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,252 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
watch "k8s.io/apimachinery/pkg/watch"
)
// BackupInterface is an autogenerated mock type for the BackupInterface type
type BackupInterface struct {
mock.Mock
}
// Create provides a mock function with given fields: ctx, backup, opts
func (_m *BackupInterface) Create(ctx context.Context, backup *v1.Backup, opts metav1.CreateOptions) (*v1.Backup, error) {
ret := _m.Called(ctx, backup, opts)
var r0 *v1.Backup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.CreateOptions) (*v1.Backup, error)); ok {
return rf(ctx, backup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.CreateOptions) *v1.Backup); ok {
r0 = rf(ctx, backup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Backup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.CreateOptions) error); ok {
r1 = rf(ctx, backup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Delete provides a mock function with given fields: ctx, name, opts
func (_m *BackupInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
ret := _m.Called(ctx, name, opts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok {
r0 = rf(ctx, name, opts)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts
func (_m *BackupInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
ret := _m.Called(ctx, opts, listOpts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok {
r0 = rf(ctx, opts, listOpts)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: ctx, name, opts
func (_m *BackupInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Backup, error) {
ret := _m.Called(ctx, name, opts)
var r0 *v1.Backup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.Backup, error)); ok {
return rf(ctx, name, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.Backup); ok {
r0 = rf(ctx, name, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Backup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok {
r1 = rf(ctx, name, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// List provides a mock function with given fields: ctx, opts
func (_m *BackupInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.BackupList, error) {
ret := _m.Called(ctx, opts)
var r0 *v1.BackupList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.BackupList, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.BackupList); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.BackupList)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources
func (_m *BackupInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.Backup, error) {
_va := make([]interface{}, len(subresources))
for _i := range subresources {
_va[_i] = subresources[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, name, pt, data, opts)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v1.Backup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.Backup, error)); ok {
return rf(ctx, name, pt, data, opts, subresources...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.Backup); ok {
r0 = rf(ctx, name, pt, data, opts, subresources...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Backup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok {
r1 = rf(ctx, name, pt, data, opts, subresources...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, backup, opts
func (_m *BackupInterface) Update(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) {
ret := _m.Called(ctx, backup, opts)
var r0 *v1.Backup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) (*v1.Backup, error)); ok {
return rf(ctx, backup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) *v1.Backup); ok {
r0 = rf(ctx, backup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Backup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, backup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStatus provides a mock function with given fields: ctx, backup, opts
func (_m *BackupInterface) UpdateStatus(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) {
ret := _m.Called(ctx, backup, opts)
var r0 *v1.Backup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) (*v1.Backup, error)); ok {
return rf(ctx, backup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) *v1.Backup); ok {
r0 = rf(ctx, backup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Backup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, backup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Watch provides a mock function with given fields: ctx, opts
func (_m *BackupInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
ret := _m.Called(ctx, opts)
var r0 watch.Interface
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(watch.Interface)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewBackupInterface creates a new instance of BackupInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewBackupInterface(t interface {
mock.TestingT
Cleanup(func())
}) *BackupInterface {
mock := &BackupInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,43 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
)
// BackupsGetter is an autogenerated mock type for the BackupsGetter type
type BackupsGetter struct {
mock.Mock
}
// Backups provides a mock function with given fields: namespace
func (_m *BackupsGetter) Backups(namespace string) v1.BackupInterface {
ret := _m.Called(namespace)
var r0 v1.BackupInterface
if rf, ok := ret.Get(0).(func(string) v1.BackupInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.BackupInterface)
}
}
return r0
}
// NewBackupsGetter creates a new instance of BackupsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewBackupsGetter(t interface {
mock.TestingT
Cleanup(func())
}) *BackupsGetter {
mock := &BackupsGetter{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,252 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
watch "k8s.io/apimachinery/pkg/watch"
)
// DeleteBackupRequestInterface is an autogenerated mock type for the DeleteBackupRequestInterface type
type DeleteBackupRequestInterface struct {
mock.Mock
}
// Create provides a mock function with given fields: ctx, deleteBackupRequest, opts
func (_m *DeleteBackupRequestInterface) Create(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.CreateOptions) (*v1.DeleteBackupRequest, error) {
ret := _m.Called(ctx, deleteBackupRequest, opts)
var r0 *v1.DeleteBackupRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) (*v1.DeleteBackupRequest, error)); ok {
return rf(ctx, deleteBackupRequest, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) *v1.DeleteBackupRequest); ok {
r0 = rf(ctx, deleteBackupRequest, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) error); ok {
r1 = rf(ctx, deleteBackupRequest, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Delete provides a mock function with given fields: ctx, name, opts
func (_m *DeleteBackupRequestInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
ret := _m.Called(ctx, name, opts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok {
r0 = rf(ctx, name, opts)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts
func (_m *DeleteBackupRequestInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
ret := _m.Called(ctx, opts, listOpts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok {
r0 = rf(ctx, opts, listOpts)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: ctx, name, opts
func (_m *DeleteBackupRequestInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.DeleteBackupRequest, error) {
ret := _m.Called(ctx, name, opts)
var r0 *v1.DeleteBackupRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.DeleteBackupRequest, error)); ok {
return rf(ctx, name, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.DeleteBackupRequest); ok {
r0 = rf(ctx, name, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok {
r1 = rf(ctx, name, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// List provides a mock function with given fields: ctx, opts
func (_m *DeleteBackupRequestInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.DeleteBackupRequestList, error) {
ret := _m.Called(ctx, opts)
var r0 *v1.DeleteBackupRequestList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.DeleteBackupRequestList, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.DeleteBackupRequestList); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequestList)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources
func (_m *DeleteBackupRequestInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.DeleteBackupRequest, error) {
_va := make([]interface{}, len(subresources))
for _i := range subresources {
_va[_i] = subresources[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, name, pt, data, opts)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v1.DeleteBackupRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.DeleteBackupRequest, error)); ok {
return rf(ctx, name, pt, data, opts, subresources...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.DeleteBackupRequest); ok {
r0 = rf(ctx, name, pt, data, opts, subresources...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok {
r1 = rf(ctx, name, pt, data, opts, subresources...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, deleteBackupRequest, opts
func (_m *DeleteBackupRequestInterface) Update(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) {
ret := _m.Called(ctx, deleteBackupRequest, opts)
var r0 *v1.DeleteBackupRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) (*v1.DeleteBackupRequest, error)); ok {
return rf(ctx, deleteBackupRequest, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) *v1.DeleteBackupRequest); ok {
r0 = rf(ctx, deleteBackupRequest, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, deleteBackupRequest, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStatus provides a mock function with given fields: ctx, deleteBackupRequest, opts
func (_m *DeleteBackupRequestInterface) UpdateStatus(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) {
ret := _m.Called(ctx, deleteBackupRequest, opts)
var r0 *v1.DeleteBackupRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) (*v1.DeleteBackupRequest, error)); ok {
return rf(ctx, deleteBackupRequest, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) *v1.DeleteBackupRequest); ok {
r0 = rf(ctx, deleteBackupRequest, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.DeleteBackupRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, deleteBackupRequest, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Watch provides a mock function with given fields: ctx, opts
func (_m *DeleteBackupRequestInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
ret := _m.Called(ctx, opts)
var r0 watch.Interface
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(watch.Interface)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewDeleteBackupRequestInterface creates a new instance of DeleteBackupRequestInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewDeleteBackupRequestInterface(t interface {
mock.TestingT
Cleanup(func())
}) *DeleteBackupRequestInterface {
mock := &DeleteBackupRequestInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,43 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
)
// DeleteBackupRequestsGetter is an autogenerated mock type for the DeleteBackupRequestsGetter type
type DeleteBackupRequestsGetter struct {
mock.Mock
}
// DeleteBackupRequests provides a mock function with given fields: namespace
func (_m *DeleteBackupRequestsGetter) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface {
ret := _m.Called(namespace)
var r0 v1.DeleteBackupRequestInterface
if rf, ok := ret.Get(0).(func(string) v1.DeleteBackupRequestInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.DeleteBackupRequestInterface)
}
}
return r0
}
// NewDeleteBackupRequestsGetter creates a new instance of DeleteBackupRequestsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewDeleteBackupRequestsGetter(t interface {
mock.TestingT
Cleanup(func())
}) *DeleteBackupRequestsGetter {
mock := &DeleteBackupRequestsGetter{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,252 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
watch "k8s.io/apimachinery/pkg/watch"
)
// PodVolumeBackupInterface is an autogenerated mock type for the PodVolumeBackupInterface type
type PodVolumeBackupInterface struct {
mock.Mock
}
// Create provides a mock function with given fields: ctx, podVolumeBackup, opts
func (_m *PodVolumeBackupInterface) Create(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.CreateOptions) (*v1.PodVolumeBackup, error) {
ret := _m.Called(ctx, podVolumeBackup, opts)
var r0 *v1.PodVolumeBackup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) (*v1.PodVolumeBackup, error)); ok {
return rf(ctx, podVolumeBackup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) *v1.PodVolumeBackup); ok {
r0 = rf(ctx, podVolumeBackup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) error); ok {
r1 = rf(ctx, podVolumeBackup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Delete provides a mock function with given fields: ctx, name, opts
func (_m *PodVolumeBackupInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
ret := _m.Called(ctx, name, opts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok {
r0 = rf(ctx, name, opts)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts
func (_m *PodVolumeBackupInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
ret := _m.Called(ctx, opts, listOpts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok {
r0 = rf(ctx, opts, listOpts)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: ctx, name, opts
func (_m *PodVolumeBackupInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodVolumeBackup, error) {
ret := _m.Called(ctx, name, opts)
var r0 *v1.PodVolumeBackup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.PodVolumeBackup, error)); ok {
return rf(ctx, name, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.PodVolumeBackup); ok {
r0 = rf(ctx, name, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok {
r1 = rf(ctx, name, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// List provides a mock function with given fields: ctx, opts
func (_m *PodVolumeBackupInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.PodVolumeBackupList, error) {
ret := _m.Called(ctx, opts)
var r0 *v1.PodVolumeBackupList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.PodVolumeBackupList, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.PodVolumeBackupList); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackupList)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources
func (_m *PodVolumeBackupInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.PodVolumeBackup, error) {
_va := make([]interface{}, len(subresources))
for _i := range subresources {
_va[_i] = subresources[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, name, pt, data, opts)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v1.PodVolumeBackup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.PodVolumeBackup, error)); ok {
return rf(ctx, name, pt, data, opts, subresources...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.PodVolumeBackup); ok {
r0 = rf(ctx, name, pt, data, opts, subresources...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok {
r1 = rf(ctx, name, pt, data, opts, subresources...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, podVolumeBackup, opts
func (_m *PodVolumeBackupInterface) Update(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) {
ret := _m.Called(ctx, podVolumeBackup, opts)
var r0 *v1.PodVolumeBackup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) (*v1.PodVolumeBackup, error)); ok {
return rf(ctx, podVolumeBackup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) *v1.PodVolumeBackup); ok {
r0 = rf(ctx, podVolumeBackup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, podVolumeBackup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStatus provides a mock function with given fields: ctx, podVolumeBackup, opts
func (_m *PodVolumeBackupInterface) UpdateStatus(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) {
ret := _m.Called(ctx, podVolumeBackup, opts)
var r0 *v1.PodVolumeBackup
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) (*v1.PodVolumeBackup, error)); ok {
return rf(ctx, podVolumeBackup, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) *v1.PodVolumeBackup); ok {
r0 = rf(ctx, podVolumeBackup, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.PodVolumeBackup)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, podVolumeBackup, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Watch provides a mock function with given fields: ctx, opts
func (_m *PodVolumeBackupInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
ret := _m.Called(ctx, opts)
var r0 watch.Interface
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(watch.Interface)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewPodVolumeBackupInterface creates a new instance of PodVolumeBackupInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewPodVolumeBackupInterface(t interface {
mock.TestingT
Cleanup(func())
}) *PodVolumeBackupInterface {
mock := &PodVolumeBackupInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,252 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
watch "k8s.io/apimachinery/pkg/watch"
)
// ScheduleInterface is an autogenerated mock type for the ScheduleInterface type
type ScheduleInterface struct {
mock.Mock
}
// Create provides a mock function with given fields: ctx, schedule, opts
func (_m *ScheduleInterface) Create(ctx context.Context, schedule *v1.Schedule, opts metav1.CreateOptions) (*v1.Schedule, error) {
ret := _m.Called(ctx, schedule, opts)
var r0 *v1.Schedule
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.CreateOptions) (*v1.Schedule, error)); ok {
return rf(ctx, schedule, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.CreateOptions) *v1.Schedule); ok {
r0 = rf(ctx, schedule, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Schedule)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.CreateOptions) error); ok {
r1 = rf(ctx, schedule, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Delete provides a mock function with given fields: ctx, name, opts
func (_m *ScheduleInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
ret := _m.Called(ctx, name, opts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok {
r0 = rf(ctx, name, opts)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts
func (_m *ScheduleInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
ret := _m.Called(ctx, opts, listOpts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok {
r0 = rf(ctx, opts, listOpts)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: ctx, name, opts
func (_m *ScheduleInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Schedule, error) {
ret := _m.Called(ctx, name, opts)
var r0 *v1.Schedule
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.Schedule, error)); ok {
return rf(ctx, name, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.Schedule); ok {
r0 = rf(ctx, name, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Schedule)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok {
r1 = rf(ctx, name, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// List provides a mock function with given fields: ctx, opts
func (_m *ScheduleInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.ScheduleList, error) {
ret := _m.Called(ctx, opts)
var r0 *v1.ScheduleList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.ScheduleList, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.ScheduleList); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.ScheduleList)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources
func (_m *ScheduleInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.Schedule, error) {
_va := make([]interface{}, len(subresources))
for _i := range subresources {
_va[_i] = subresources[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, name, pt, data, opts)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v1.Schedule
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.Schedule, error)); ok {
return rf(ctx, name, pt, data, opts, subresources...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.Schedule); ok {
r0 = rf(ctx, name, pt, data, opts, subresources...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Schedule)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok {
r1 = rf(ctx, name, pt, data, opts, subresources...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, schedule, opts
func (_m *ScheduleInterface) Update(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) {
ret := _m.Called(ctx, schedule, opts)
var r0 *v1.Schedule
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) (*v1.Schedule, error)); ok {
return rf(ctx, schedule, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) *v1.Schedule); ok {
r0 = rf(ctx, schedule, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Schedule)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, schedule, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStatus provides a mock function with given fields: ctx, schedule, opts
func (_m *ScheduleInterface) UpdateStatus(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) {
ret := _m.Called(ctx, schedule, opts)
var r0 *v1.Schedule
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) (*v1.Schedule, error)); ok {
return rf(ctx, schedule, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) *v1.Schedule); ok {
r0 = rf(ctx, schedule, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Schedule)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, schedule, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Watch provides a mock function with given fields: ctx, opts
func (_m *ScheduleInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
ret := _m.Called(ctx, opts)
var r0 watch.Interface
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(watch.Interface)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewScheduleInterface creates a new instance of ScheduleInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewScheduleInterface(t interface {
mock.TestingT
Cleanup(func())
}) *ScheduleInterface {
mock := &ScheduleInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,43 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
)
// SchedulesGetter is an autogenerated mock type for the SchedulesGetter type
type SchedulesGetter struct {
mock.Mock
}
// Schedules provides a mock function with given fields: namespace
func (_m *SchedulesGetter) Schedules(namespace string) v1.ScheduleInterface {
ret := _m.Called(namespace)
var r0 v1.ScheduleInterface
if rf, ok := ret.Get(0).(func(string) v1.ScheduleInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.ScheduleInterface)
}
}
return r0
}
// NewSchedulesGetter creates a new instance of SchedulesGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSchedulesGetter(t interface {
mock.TestingT
Cleanup(func())
}) *SchedulesGetter {
mock := &SchedulesGetter{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,221 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
rest "k8s.io/client-go/rest"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
)
// VeleroV1Interface is an autogenerated mock type for the VeleroV1Interface type
type VeleroV1Interface struct {
mock.Mock
}
// BackupRepositories provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) BackupRepositories(namespace string) v1.BackupRepositoryInterface {
ret := _m.Called(namespace)
var r0 v1.BackupRepositoryInterface
if rf, ok := ret.Get(0).(func(string) v1.BackupRepositoryInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.BackupRepositoryInterface)
}
}
return r0
}
// BackupStorageLocations provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) BackupStorageLocations(namespace string) v1.BackupStorageLocationInterface {
ret := _m.Called(namespace)
var r0 v1.BackupStorageLocationInterface
if rf, ok := ret.Get(0).(func(string) v1.BackupStorageLocationInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.BackupStorageLocationInterface)
}
}
return r0
}
// Backups provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) Backups(namespace string) v1.BackupInterface {
ret := _m.Called(namespace)
var r0 v1.BackupInterface
if rf, ok := ret.Get(0).(func(string) v1.BackupInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.BackupInterface)
}
}
return r0
}
// DeleteBackupRequests provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface {
ret := _m.Called(namespace)
var r0 v1.DeleteBackupRequestInterface
if rf, ok := ret.Get(0).(func(string) v1.DeleteBackupRequestInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.DeleteBackupRequestInterface)
}
}
return r0
}
// DownloadRequests provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) DownloadRequests(namespace string) v1.DownloadRequestInterface {
ret := _m.Called(namespace)
var r0 v1.DownloadRequestInterface
if rf, ok := ret.Get(0).(func(string) v1.DownloadRequestInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.DownloadRequestInterface)
}
}
return r0
}
// PodVolumeBackups provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) PodVolumeBackups(namespace string) v1.PodVolumeBackupInterface {
ret := _m.Called(namespace)
var r0 v1.PodVolumeBackupInterface
if rf, ok := ret.Get(0).(func(string) v1.PodVolumeBackupInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.PodVolumeBackupInterface)
}
}
return r0
}
// PodVolumeRestores provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) PodVolumeRestores(namespace string) v1.PodVolumeRestoreInterface {
ret := _m.Called(namespace)
var r0 v1.PodVolumeRestoreInterface
if rf, ok := ret.Get(0).(func(string) v1.PodVolumeRestoreInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.PodVolumeRestoreInterface)
}
}
return r0
}
// RESTClient provides a mock function with given fields:
func (_m *VeleroV1Interface) RESTClient() rest.Interface {
ret := _m.Called()
var r0 rest.Interface
if rf, ok := ret.Get(0).(func() rest.Interface); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(rest.Interface)
}
}
return r0
}
// Restores provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) Restores(namespace string) v1.RestoreInterface {
ret := _m.Called(namespace)
var r0 v1.RestoreInterface
if rf, ok := ret.Get(0).(func(string) v1.RestoreInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.RestoreInterface)
}
}
return r0
}
// Schedules provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) Schedules(namespace string) v1.ScheduleInterface {
ret := _m.Called(namespace)
var r0 v1.ScheduleInterface
if rf, ok := ret.Get(0).(func(string) v1.ScheduleInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.ScheduleInterface)
}
}
return r0
}
// ServerStatusRequests provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) ServerStatusRequests(namespace string) v1.ServerStatusRequestInterface {
ret := _m.Called(namespace)
var r0 v1.ServerStatusRequestInterface
if rf, ok := ret.Get(0).(func(string) v1.ServerStatusRequestInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.ServerStatusRequestInterface)
}
}
return r0
}
// VolumeSnapshotLocations provides a mock function with given fields: namespace
func (_m *VeleroV1Interface) VolumeSnapshotLocations(namespace string) v1.VolumeSnapshotLocationInterface {
ret := _m.Called(namespace)
var r0 v1.VolumeSnapshotLocationInterface
if rf, ok := ret.Get(0).(func(string) v1.VolumeSnapshotLocationInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.VolumeSnapshotLocationInterface)
}
}
return r0
}
// NewVeleroV1Interface creates a new instance of VeleroV1Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewVeleroV1Interface(t interface {
mock.TestingT
Cleanup(func())
}) *VeleroV1Interface {
mock := &VeleroV1Interface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,252 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
watch "k8s.io/apimachinery/pkg/watch"
)
// VolumeSnapshotLocationInterface is an autogenerated mock type for the VolumeSnapshotLocationInterface type
type VolumeSnapshotLocationInterface struct {
mock.Mock
}
// Create provides a mock function with given fields: ctx, volumeSnapshotLocation, opts
func (_m *VolumeSnapshotLocationInterface) Create(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.CreateOptions) (*v1.VolumeSnapshotLocation, error) {
ret := _m.Called(ctx, volumeSnapshotLocation, opts)
var r0 *v1.VolumeSnapshotLocation
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) (*v1.VolumeSnapshotLocation, error)); ok {
return rf(ctx, volumeSnapshotLocation, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) *v1.VolumeSnapshotLocation); ok {
r0 = rf(ctx, volumeSnapshotLocation, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) error); ok {
r1 = rf(ctx, volumeSnapshotLocation, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Delete provides a mock function with given fields: ctx, name, opts
func (_m *VolumeSnapshotLocationInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
ret := _m.Called(ctx, name, opts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok {
r0 = rf(ctx, name, opts)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts
func (_m *VolumeSnapshotLocationInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
ret := _m.Called(ctx, opts, listOpts)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok {
r0 = rf(ctx, opts, listOpts)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: ctx, name, opts
func (_m *VolumeSnapshotLocationInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotLocation, error) {
ret := _m.Called(ctx, name, opts)
var r0 *v1.VolumeSnapshotLocation
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.VolumeSnapshotLocation, error)); ok {
return rf(ctx, name, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.VolumeSnapshotLocation); ok {
r0 = rf(ctx, name, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok {
r1 = rf(ctx, name, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// List provides a mock function with given fields: ctx, opts
func (_m *VolumeSnapshotLocationInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotLocationList, error) {
ret := _m.Called(ctx, opts)
var r0 *v1.VolumeSnapshotLocationList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.VolumeSnapshotLocationList, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.VolumeSnapshotLocationList); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocationList)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources
func (_m *VolumeSnapshotLocationInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.VolumeSnapshotLocation, error) {
_va := make([]interface{}, len(subresources))
for _i := range subresources {
_va[_i] = subresources[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, name, pt, data, opts)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v1.VolumeSnapshotLocation
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.VolumeSnapshotLocation, error)); ok {
return rf(ctx, name, pt, data, opts, subresources...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.VolumeSnapshotLocation); ok {
r0 = rf(ctx, name, pt, data, opts, subresources...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok {
r1 = rf(ctx, name, pt, data, opts, subresources...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, volumeSnapshotLocation, opts
func (_m *VolumeSnapshotLocationInterface) Update(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) {
ret := _m.Called(ctx, volumeSnapshotLocation, opts)
var r0 *v1.VolumeSnapshotLocation
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error)); ok {
return rf(ctx, volumeSnapshotLocation, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) *v1.VolumeSnapshotLocation); ok {
r0 = rf(ctx, volumeSnapshotLocation, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, volumeSnapshotLocation, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStatus provides a mock function with given fields: ctx, volumeSnapshotLocation, opts
func (_m *VolumeSnapshotLocationInterface) UpdateStatus(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) {
ret := _m.Called(ctx, volumeSnapshotLocation, opts)
var r0 *v1.VolumeSnapshotLocation
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error)); ok {
return rf(ctx, volumeSnapshotLocation, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) *v1.VolumeSnapshotLocation); ok {
r0 = rf(ctx, volumeSnapshotLocation, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.VolumeSnapshotLocation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) error); ok {
r1 = rf(ctx, volumeSnapshotLocation, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Watch provides a mock function with given fields: ctx, opts
func (_m *VolumeSnapshotLocationInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
ret := _m.Called(ctx, opts)
var r0 watch.Interface
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok {
return rf(ctx, opts)
}
if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok {
r0 = rf(ctx, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(watch.Interface)
}
}
if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok {
r1 = rf(ctx, opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewVolumeSnapshotLocationInterface creates a new instance of VolumeSnapshotLocationInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewVolumeSnapshotLocationInterface(t interface {
mock.TestingT
Cleanup(func())
}) *VolumeSnapshotLocationInterface {
mock := &VolumeSnapshotLocationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,43 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
)
// VolumeSnapshotLocationsGetter is an autogenerated mock type for the VolumeSnapshotLocationsGetter type
type VolumeSnapshotLocationsGetter struct {
mock.Mock
}
// VolumeSnapshotLocations provides a mock function with given fields: namespace
func (_m *VolumeSnapshotLocationsGetter) VolumeSnapshotLocations(namespace string) v1.VolumeSnapshotLocationInterface {
ret := _m.Called(namespace)
var r0 v1.VolumeSnapshotLocationInterface
if rf, ok := ret.Get(0).(func(string) v1.VolumeSnapshotLocationInterface); ok {
r0 = rf(namespace)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1.VolumeSnapshotLocationInterface)
}
}
return r0
}
// NewVolumeSnapshotLocationsGetter creates a new instance of VolumeSnapshotLocationsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewVolumeSnapshotLocationsGetter(t interface {
mock.TestingT
Cleanup(func())
}) *VolumeSnapshotLocationsGetter {
mock := &VolumeSnapshotLocationsGetter{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -36,6 +36,7 @@ type PodVolumeBackupsGetter interface {
PodVolumeBackups(namespace string) PodVolumeBackupInterface
}
//go:generate mockery --name PodVolumeBackupInterface
// PodVolumeBackupInterface has methods to work with PodVolumeBackup resources.
type PodVolumeBackupInterface interface {
Create(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.CreateOptions) (*v1.PodVolumeBackup, error)