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