forked from concourse/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_runner.go
134 lines (122 loc) · 3.73 KB
/
fake_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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Code generated by counterfeiter. DO NOT EDIT.
package runtimefakes
import (
"context"
"io"
"sync"
"github.com/pf-qiu/concourse/v6/atc/runtime"
)
type FakeRunner struct {
RunScriptStub func(context.Context, string, []string, []byte, interface{}, io.Writer, bool) error
runScriptMutex sync.RWMutex
runScriptArgsForCall []struct {
arg1 context.Context
arg2 string
arg3 []string
arg4 []byte
arg5 interface{}
arg6 io.Writer
arg7 bool
}
runScriptReturns struct {
result1 error
}
runScriptReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeRunner) RunScript(arg1 context.Context, arg2 string, arg3 []string, arg4 []byte, arg5 interface{}, arg6 io.Writer, arg7 bool) error {
var arg3Copy []string
if arg3 != nil {
arg3Copy = make([]string, len(arg3))
copy(arg3Copy, arg3)
}
var arg4Copy []byte
if arg4 != nil {
arg4Copy = make([]byte, len(arg4))
copy(arg4Copy, arg4)
}
fake.runScriptMutex.Lock()
ret, specificReturn := fake.runScriptReturnsOnCall[len(fake.runScriptArgsForCall)]
fake.runScriptArgsForCall = append(fake.runScriptArgsForCall, struct {
arg1 context.Context
arg2 string
arg3 []string
arg4 []byte
arg5 interface{}
arg6 io.Writer
arg7 bool
}{arg1, arg2, arg3Copy, arg4Copy, arg5, arg6, arg7})
fake.recordInvocation("RunScript", []interface{}{arg1, arg2, arg3Copy, arg4Copy, arg5, arg6, arg7})
fake.runScriptMutex.Unlock()
if fake.RunScriptStub != nil {
return fake.RunScriptStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.runScriptReturns
return fakeReturns.result1
}
func (fake *FakeRunner) RunScriptCallCount() int {
fake.runScriptMutex.RLock()
defer fake.runScriptMutex.RUnlock()
return len(fake.runScriptArgsForCall)
}
func (fake *FakeRunner) RunScriptCalls(stub func(context.Context, string, []string, []byte, interface{}, io.Writer, bool) error) {
fake.runScriptMutex.Lock()
defer fake.runScriptMutex.Unlock()
fake.RunScriptStub = stub
}
func (fake *FakeRunner) RunScriptArgsForCall(i int) (context.Context, string, []string, []byte, interface{}, io.Writer, bool) {
fake.runScriptMutex.RLock()
defer fake.runScriptMutex.RUnlock()
argsForCall := fake.runScriptArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7
}
func (fake *FakeRunner) RunScriptReturns(result1 error) {
fake.runScriptMutex.Lock()
defer fake.runScriptMutex.Unlock()
fake.RunScriptStub = nil
fake.runScriptReturns = struct {
result1 error
}{result1}
}
func (fake *FakeRunner) RunScriptReturnsOnCall(i int, result1 error) {
fake.runScriptMutex.Lock()
defer fake.runScriptMutex.Unlock()
fake.RunScriptStub = nil
if fake.runScriptReturnsOnCall == nil {
fake.runScriptReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.runScriptReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeRunner) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.runScriptMutex.RLock()
defer fake.runScriptMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeRunner) 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 _ runtime.Runner = new(FakeRunner)