github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/exec/execfakes/fake_step.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package execfakes 3 4 import ( 5 "context" 6 "sync" 7 8 "github.com/pf-qiu/concourse/v6/atc/exec" 9 ) 10 11 type FakeStep struct { 12 RunStub func(context.Context, exec.RunState) (bool, error) 13 runMutex sync.RWMutex 14 runArgsForCall []struct { 15 arg1 context.Context 16 arg2 exec.RunState 17 } 18 runReturns struct { 19 result1 bool 20 result2 error 21 } 22 runReturnsOnCall map[int]struct { 23 result1 bool 24 result2 error 25 } 26 invocations map[string][][]interface{} 27 invocationsMutex sync.RWMutex 28 } 29 30 func (fake *FakeStep) Run(arg1 context.Context, arg2 exec.RunState) (bool, error) { 31 fake.runMutex.Lock() 32 ret, specificReturn := fake.runReturnsOnCall[len(fake.runArgsForCall)] 33 fake.runArgsForCall = append(fake.runArgsForCall, struct { 34 arg1 context.Context 35 arg2 exec.RunState 36 }{arg1, arg2}) 37 fake.recordInvocation("Run", []interface{}{arg1, arg2}) 38 fake.runMutex.Unlock() 39 if fake.RunStub != nil { 40 return fake.RunStub(arg1, arg2) 41 } 42 if specificReturn { 43 return ret.result1, ret.result2 44 } 45 fakeReturns := fake.runReturns 46 return fakeReturns.result1, fakeReturns.result2 47 } 48 49 func (fake *FakeStep) RunCallCount() int { 50 fake.runMutex.RLock() 51 defer fake.runMutex.RUnlock() 52 return len(fake.runArgsForCall) 53 } 54 55 func (fake *FakeStep) RunCalls(stub func(context.Context, exec.RunState) (bool, error)) { 56 fake.runMutex.Lock() 57 defer fake.runMutex.Unlock() 58 fake.RunStub = stub 59 } 60 61 func (fake *FakeStep) RunArgsForCall(i int) (context.Context, exec.RunState) { 62 fake.runMutex.RLock() 63 defer fake.runMutex.RUnlock() 64 argsForCall := fake.runArgsForCall[i] 65 return argsForCall.arg1, argsForCall.arg2 66 } 67 68 func (fake *FakeStep) RunReturns(result1 bool, result2 error) { 69 fake.runMutex.Lock() 70 defer fake.runMutex.Unlock() 71 fake.RunStub = nil 72 fake.runReturns = struct { 73 result1 bool 74 result2 error 75 }{result1, result2} 76 } 77 78 func (fake *FakeStep) RunReturnsOnCall(i int, result1 bool, result2 error) { 79 fake.runMutex.Lock() 80 defer fake.runMutex.Unlock() 81 fake.RunStub = nil 82 if fake.runReturnsOnCall == nil { 83 fake.runReturnsOnCall = make(map[int]struct { 84 result1 bool 85 result2 error 86 }) 87 } 88 fake.runReturnsOnCall[i] = struct { 89 result1 bool 90 result2 error 91 }{result1, result2} 92 } 93 94 func (fake *FakeStep) Invocations() map[string][][]interface{} { 95 fake.invocationsMutex.RLock() 96 defer fake.invocationsMutex.RUnlock() 97 fake.runMutex.RLock() 98 defer fake.runMutex.RUnlock() 99 copiedInvocations := map[string][][]interface{}{} 100 for key, value := range fake.invocations { 101 copiedInvocations[key] = value 102 } 103 return copiedInvocations 104 } 105 106 func (fake *FakeStep) recordInvocation(key string, args []interface{}) { 107 fake.invocationsMutex.Lock() 108 defer fake.invocationsMutex.Unlock() 109 if fake.invocations == nil { 110 fake.invocations = map[string][][]interface{}{} 111 } 112 if fake.invocations[key] == nil { 113 fake.invocations[key] = [][]interface{}{} 114 } 115 fake.invocations[key] = append(fake.invocations[key], args) 116 } 117 118 var _ exec.Step = new(FakeStep)