mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 13:26:26 +00:00
* k8s 1.18 import wip backup, cmd, controller, generated, restic, restore, serverstatusrequest, test and util Signed-off-by: Andrew Lavery <laverya@umich.edu> * go mod tidy Signed-off-by: Andrew Lavery <laverya@umich.edu> * add changelog file Signed-off-by: Andrew Lavery <laverya@umich.edu> * go fmt Signed-off-by: Andrew Lavery <laverya@umich.edu> * update code-generator and controller-gen in CI Signed-off-by: Andrew Lavery <laverya@umich.edu> * checkout proper code-generator version, regen Signed-off-by: Andrew Lavery <laverya@umich.edu> * fix remaining calls Signed-off-by: Andrew Lavery <laverya@umich.edu> * regenerate CRDs with ./hack/update-generated-crd-code.sh Signed-off-by: Andrew Lavery <laverya@umich.edu> * use existing context in restic and server Signed-off-by: Andrew Lavery <laverya@umich.edu> * fix test cases by resetting resource version also use main library go context, not golang.org/x/net/context, in pkg/restore/restore.go Signed-off-by: Andrew Lavery <laverya@umich.edu> * clarify changelog message Signed-off-by: Andrew Lavery <laverya@umich.edu> * use github.com/kubernetes-csi/external-snapshotter/v2@v2.2.0-rc1 Signed-off-by: Andrew Lavery <laverya@umich.edu> * run 'go mod tidy' to remove old external-snapshotter version Signed-off-by: Andrew Lavery <laverya@umich.edu>
80 lines
2.9 KiB
Go
80 lines
2.9 KiB
Go
/*
|
|
Copyright 2018 the Velero contributors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package test
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
corev1api "k8s.io/api/core/v1"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
"k8s.io/apimachinery/pkg/types"
|
|
"k8s.io/apimachinery/pkg/watch"
|
|
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
|
)
|
|
|
|
type FakeNamespaceClient struct {
|
|
mock.Mock
|
|
}
|
|
|
|
var _ corev1.NamespaceInterface = &FakeNamespaceClient{}
|
|
|
|
func (c *FakeNamespaceClient) List(ctx context.Context, options metav1.ListOptions) (*corev1api.NamespaceList, error) {
|
|
args := c.Called(options)
|
|
return args.Get(0).(*corev1api.NamespaceList), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Create(ctx context.Context, obj *corev1api.Namespace, options metav1.CreateOptions) (*corev1api.Namespace, error) {
|
|
args := c.Called(obj)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Watch(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
|
|
args := c.Called(options)
|
|
return args.Get(0).(watch.Interface), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1api.Namespace, error) {
|
|
args := c.Called(name, opts)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*corev1api.Namespace, error) {
|
|
args := c.Called(name, pt, data, subresources)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
|
args := c.Called(name, opts)
|
|
return args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Finalize(ctx context.Context, item *corev1api.Namespace, options metav1.UpdateOptions) (*corev1api.Namespace, error) {
|
|
args := c.Called(item)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) Update(ctx context.Context, namespace *corev1api.Namespace, options metav1.UpdateOptions) (*corev1api.Namespace, error) {
|
|
args := c.Called(namespace)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|
|
|
|
func (c *FakeNamespaceClient) UpdateStatus(ctx context.Context, namespace *corev1api.Namespace, options metav1.UpdateOptions) (*corev1api.Namespace, error) {
|
|
args := c.Called(namespace)
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
|
}
|