forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_runc_cmd_runner.go
101 lines (90 loc) · 2.76 KB
/
fake_runc_cmd_runner.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
// Code generated by counterfeiter. DO NOT EDIT.
package runruncfakes
import (
"sync"
"code.cloudfoundry.org/guardian/rundmc/runrunc"
"code.cloudfoundry.org/lager"
)
type FakeRuncCmdRunner struct {
RunAndLogStub func(log lager.Logger, cmd runrunc.LoggingCmd) error
runAndLogMutex sync.RWMutex
runAndLogArgsForCall []struct {
log lager.Logger
cmd runrunc.LoggingCmd
}
runAndLogReturns struct {
result1 error
}
runAndLogReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeRuncCmdRunner) RunAndLog(log lager.Logger, cmd runrunc.LoggingCmd) error {
fake.runAndLogMutex.Lock()
ret, specificReturn := fake.runAndLogReturnsOnCall[len(fake.runAndLogArgsForCall)]
fake.runAndLogArgsForCall = append(fake.runAndLogArgsForCall, struct {
log lager.Logger
cmd runrunc.LoggingCmd
}{log, cmd})
fake.recordInvocation("RunAndLog", []interface{}{log, cmd})
fake.runAndLogMutex.Unlock()
if fake.RunAndLogStub != nil {
return fake.RunAndLogStub(log, cmd)
}
if specificReturn {
return ret.result1
}
return fake.runAndLogReturns.result1
}
func (fake *FakeRuncCmdRunner) RunAndLogCallCount() int {
fake.runAndLogMutex.RLock()
defer fake.runAndLogMutex.RUnlock()
return len(fake.runAndLogArgsForCall)
}
func (fake *FakeRuncCmdRunner) RunAndLogArgsForCall(i int) (lager.Logger, runrunc.LoggingCmd) {
fake.runAndLogMutex.RLock()
defer fake.runAndLogMutex.RUnlock()
return fake.runAndLogArgsForCall[i].log, fake.runAndLogArgsForCall[i].cmd
}
func (fake *FakeRuncCmdRunner) RunAndLogReturns(result1 error) {
fake.RunAndLogStub = nil
fake.runAndLogReturns = struct {
result1 error
}{result1}
}
func (fake *FakeRuncCmdRunner) RunAndLogReturnsOnCall(i int, result1 error) {
fake.RunAndLogStub = nil
if fake.runAndLogReturnsOnCall == nil {
fake.runAndLogReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.runAndLogReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeRuncCmdRunner) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.runAndLogMutex.RLock()
defer fake.runAndLogMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeRuncCmdRunner) 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 _ runrunc.RuncCmdRunner = new(FakeRuncCmdRunner)