forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_deployment_config_store.go
55 lines (42 loc) · 1.28 KB
/
fake_deployment_config_store.go
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
package test
import (
"k8s.io/apimachinery/pkg/util/sets"
deployapi "github.com/openshift/origin/pkg/deploy/apis/apps"
)
type FakeDeploymentConfigStore struct {
DeploymentConfig *deployapi.DeploymentConfig
Err error
}
func NewFakeDeploymentConfigStore(deployment *deployapi.DeploymentConfig) FakeDeploymentConfigStore {
return FakeDeploymentConfigStore{DeploymentConfig: deployment}
}
func (s FakeDeploymentConfigStore) Add(obj interface{}) error {
return s.Err
}
func (s FakeDeploymentConfigStore) Update(obj interface{}) error {
return s.Err
}
func (s FakeDeploymentConfigStore) Delete(obj interface{}) error {
return s.Err
}
func (s FakeDeploymentConfigStore) List() []interface{} {
return []interface{}{s.DeploymentConfig}
}
func (s FakeDeploymentConfigStore) ContainedIDs() sets.String {
return sets.NewString()
}
func (s FakeDeploymentConfigStore) Get(obj interface{}) (item interface{}, exists bool, err error) {
return s.GetByKey("")
}
func (s FakeDeploymentConfigStore) GetByKey(id string) (item interface{}, exists bool, err error) {
if s.Err != nil {
return nil, false, err
}
if s.DeploymentConfig == nil {
return nil, false, nil
}
return s.DeploymentConfig, true, nil
}
func (s FakeDeploymentConfigStore) Replace(list []interface{}) error {
return nil
}