mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 06:54:32 +00:00
Add pod exec backup hooks
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
@@ -34,13 +34,8 @@ type FakeDynamicFactory struct {
|
||||
|
||||
var _ client.DynamicFactory = &FakeDynamicFactory{}
|
||||
|
||||
func (df *FakeDynamicFactory) ClientForGroupVersionResource(gvr schema.GroupVersionResource, resource metav1.APIResource, namespace string) (client.Dynamic, error) {
|
||||
args := df.Called(gvr, resource, namespace)
|
||||
return args.Get(0).(client.Dynamic), args.Error(1)
|
||||
}
|
||||
|
||||
func (df *FakeDynamicFactory) ClientForGroupVersionKind(gvk schema.GroupVersionKind, resource metav1.APIResource, namespace string) (client.Dynamic, error) {
|
||||
args := df.Called(gvk, resource, namespace)
|
||||
func (df *FakeDynamicFactory) ClientForGroupVersionResource(gv schema.GroupVersion, resource metav1.APIResource, namespace string) (client.Dynamic, error) {
|
||||
args := df.Called(gv, resource, namespace)
|
||||
return args.Get(0).(client.Dynamic), args.Error(1)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ limitations under the License.
|
||||
package test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
@@ -38,12 +37,12 @@ func (m *FakeMapper) ResourceFor(input schema.GroupVersionResource) (schema.Grou
|
||||
}, nil
|
||||
}
|
||||
if m.Resources == nil {
|
||||
return schema.GroupVersionResource{}, errors.New("invalid resource")
|
||||
return schema.GroupVersionResource{}, errors.Errorf("invalid resource %q", input.String())
|
||||
}
|
||||
|
||||
if gr, found := m.Resources[input]; found {
|
||||
return gr, nil
|
||||
}
|
||||
|
||||
return schema.GroupVersionResource{}, errors.New("invalid resource")
|
||||
return schema.GroupVersionResource{}, errors.Errorf("invalid resource %q", input.String())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2017 the Heptio Ark 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 (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func NewLogger() *logrus.Entry {
|
||||
logger := logrus.New()
|
||||
logger.Out = ioutil.Discard
|
||||
return logrus.NewEntry(logger)
|
||||
}
|
||||
Reference in New Issue
Block a user