forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_bundler_rule.go
109 lines (98 loc) · 3.26 KB
/
fake_bundler_rule.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Code generated by counterfeiter. DO NOT EDIT.
package rundmcfakes
import (
"sync"
"code.cloudfoundry.org/guardian/gardener/container-spec"
"code.cloudfoundry.org/guardian/rundmc"
"code.cloudfoundry.org/guardian/rundmc/goci"
)
type FakeBundlerRule struct {
ApplyStub func(bndle goci.Bndl, desiredContainerSpec spec.DesiredContainerSpec, containerDir string) (goci.Bndl, error)
applyMutex sync.RWMutex
applyArgsForCall []struct {
bndle goci.Bndl
desiredContainerSpec spec.DesiredContainerSpec
containerDir string
}
applyReturns struct {
result1 goci.Bndl
result2 error
}
applyReturnsOnCall map[int]struct {
result1 goci.Bndl
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeBundlerRule) Apply(bndle goci.Bndl, desiredContainerSpec spec.DesiredContainerSpec, containerDir string) (goci.Bndl, error) {
fake.applyMutex.Lock()
ret, specificReturn := fake.applyReturnsOnCall[len(fake.applyArgsForCall)]
fake.applyArgsForCall = append(fake.applyArgsForCall, struct {
bndle goci.Bndl
desiredContainerSpec spec.DesiredContainerSpec
containerDir string
}{bndle, desiredContainerSpec, containerDir})
fake.recordInvocation("Apply", []interface{}{bndle, desiredContainerSpec, containerDir})
fake.applyMutex.Unlock()
if fake.ApplyStub != nil {
return fake.ApplyStub(bndle, desiredContainerSpec, containerDir)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.applyReturns.result1, fake.applyReturns.result2
}
func (fake *FakeBundlerRule) ApplyCallCount() int {
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
return len(fake.applyArgsForCall)
}
func (fake *FakeBundlerRule) ApplyArgsForCall(i int) (goci.Bndl, spec.DesiredContainerSpec, string) {
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
return fake.applyArgsForCall[i].bndle, fake.applyArgsForCall[i].desiredContainerSpec, fake.applyArgsForCall[i].containerDir
}
func (fake *FakeBundlerRule) ApplyReturns(result1 goci.Bndl, result2 error) {
fake.ApplyStub = nil
fake.applyReturns = struct {
result1 goci.Bndl
result2 error
}{result1, result2}
}
func (fake *FakeBundlerRule) ApplyReturnsOnCall(i int, result1 goci.Bndl, result2 error) {
fake.ApplyStub = nil
if fake.applyReturnsOnCall == nil {
fake.applyReturnsOnCall = make(map[int]struct {
result1 goci.Bndl
result2 error
})
}
fake.applyReturnsOnCall[i] = struct {
result1 goci.Bndl
result2 error
}{result1, result2}
}
func (fake *FakeBundlerRule) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeBundlerRule) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ rundmc.BundlerRule = new(FakeBundlerRule)