-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsecrets.go
More file actions
58 lines (48 loc) · 1.64 KB
/
secrets.go
File metadata and controls
58 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package k8s
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)
// FakeSecret is a mock function that can be swapped in for
// (k8s.io/kubernetes/pkg/client/unversioned).SecretsInterface,
// so you can unit test your code.
type FakeSecret struct {
FnGet func(string) (*v1.Secret, error)
FnCreate func(*v1.Secret) (*v1.Secret, error)
FnUpdate func(*v1.Secret) (*v1.Secret, error)
}
// Get is the interface definition.
func (f *FakeSecret) Get(name string) (*v1.Secret, error) {
return f.FnGet(name)
}
// Delete is the interface definition.
func (f *FakeSecret) Delete(name string) error {
return nil
}
// Create is the interface definition.
func (f *FakeSecret) Create(secret *v1.Secret) (*v1.Secret, error) {
return f.FnCreate(secret)
}
// Update is the interface definition.
func (f *FakeSecret) Update(secret *v1.Secret) (*v1.Secret, error) {
return f.FnUpdate(secret)
}
// List is the interface definition.
func (f *FakeSecret) List(opts metav1.ListOptions) (*v1.SecretList, error) {
return &v1.SecretList{}, nil
}
// Watch is the interface definition.
func (f *FakeSecret) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return nil, nil
}
// FakeSecretsNamespacer is a mock function that can be swapped in for an
// (k8s.io/kubernetes/pkg/client/unversioned).SecretsNamespacer, so you can unit test you code
type FakeSecretsNamespacer struct {
Fn func(string) corev1.SecretInterface
}
// Secrets is the interface definition.
func (f *FakeSecretsNamespacer) Secrets(namespace string) corev1.SecretInterface {
return f.Fn(namespace)
}