github.com/chenbh/concourse/v6@v6.4.2/worker/runtime/libcontainerd/libcontainerdfakes/fake_io.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package libcontainerdfakes 3 4 import ( 5 "sync" 6 7 "github.com/containerd/containerd/cio" 8 ) 9 10 type FakeIO struct { 11 CancelStub func() 12 cancelMutex sync.RWMutex 13 cancelArgsForCall []struct { 14 } 15 CloseStub func() error 16 closeMutex sync.RWMutex 17 closeArgsForCall []struct { 18 } 19 closeReturns struct { 20 result1 error 21 } 22 closeReturnsOnCall map[int]struct { 23 result1 error 24 } 25 ConfigStub func() cio.Config 26 configMutex sync.RWMutex 27 configArgsForCall []struct { 28 } 29 configReturns struct { 30 result1 cio.Config 31 } 32 configReturnsOnCall map[int]struct { 33 result1 cio.Config 34 } 35 WaitStub func() 36 waitMutex sync.RWMutex 37 waitArgsForCall []struct { 38 } 39 invocations map[string][][]interface{} 40 invocationsMutex sync.RWMutex 41 } 42 43 func (fake *FakeIO) Cancel() { 44 fake.cancelMutex.Lock() 45 fake.cancelArgsForCall = append(fake.cancelArgsForCall, struct { 46 }{}) 47 fake.recordInvocation("Cancel", []interface{}{}) 48 fake.cancelMutex.Unlock() 49 if fake.CancelStub != nil { 50 fake.CancelStub() 51 } 52 } 53 54 func (fake *FakeIO) CancelCallCount() int { 55 fake.cancelMutex.RLock() 56 defer fake.cancelMutex.RUnlock() 57 return len(fake.cancelArgsForCall) 58 } 59 60 func (fake *FakeIO) CancelCalls(stub func()) { 61 fake.cancelMutex.Lock() 62 defer fake.cancelMutex.Unlock() 63 fake.CancelStub = stub 64 } 65 66 func (fake *FakeIO) Close() error { 67 fake.closeMutex.Lock() 68 ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] 69 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 70 }{}) 71 fake.recordInvocation("Close", []interface{}{}) 72 fake.closeMutex.Unlock() 73 if fake.CloseStub != nil { 74 return fake.CloseStub() 75 } 76 if specificReturn { 77 return ret.result1 78 } 79 fakeReturns := fake.closeReturns 80 return fakeReturns.result1 81 } 82 83 func (fake *FakeIO) CloseCallCount() int { 84 fake.closeMutex.RLock() 85 defer fake.closeMutex.RUnlock() 86 return len(fake.closeArgsForCall) 87 } 88 89 func (fake *FakeIO) CloseCalls(stub func() error) { 90 fake.closeMutex.Lock() 91 defer fake.closeMutex.Unlock() 92 fake.CloseStub = stub 93 } 94 95 func (fake *FakeIO) CloseReturns(result1 error) { 96 fake.closeMutex.Lock() 97 defer fake.closeMutex.Unlock() 98 fake.CloseStub = nil 99 fake.closeReturns = struct { 100 result1 error 101 }{result1} 102 } 103 104 func (fake *FakeIO) CloseReturnsOnCall(i int, result1 error) { 105 fake.closeMutex.Lock() 106 defer fake.closeMutex.Unlock() 107 fake.CloseStub = nil 108 if fake.closeReturnsOnCall == nil { 109 fake.closeReturnsOnCall = make(map[int]struct { 110 result1 error 111 }) 112 } 113 fake.closeReturnsOnCall[i] = struct { 114 result1 error 115 }{result1} 116 } 117 118 func (fake *FakeIO) Config() cio.Config { 119 fake.configMutex.Lock() 120 ret, specificReturn := fake.configReturnsOnCall[len(fake.configArgsForCall)] 121 fake.configArgsForCall = append(fake.configArgsForCall, struct { 122 }{}) 123 fake.recordInvocation("Config", []interface{}{}) 124 fake.configMutex.Unlock() 125 if fake.ConfigStub != nil { 126 return fake.ConfigStub() 127 } 128 if specificReturn { 129 return ret.result1 130 } 131 fakeReturns := fake.configReturns 132 return fakeReturns.result1 133 } 134 135 func (fake *FakeIO) ConfigCallCount() int { 136 fake.configMutex.RLock() 137 defer fake.configMutex.RUnlock() 138 return len(fake.configArgsForCall) 139 } 140 141 func (fake *FakeIO) ConfigCalls(stub func() cio.Config) { 142 fake.configMutex.Lock() 143 defer fake.configMutex.Unlock() 144 fake.ConfigStub = stub 145 } 146 147 func (fake *FakeIO) ConfigReturns(result1 cio.Config) { 148 fake.configMutex.Lock() 149 defer fake.configMutex.Unlock() 150 fake.ConfigStub = nil 151 fake.configReturns = struct { 152 result1 cio.Config 153 }{result1} 154 } 155 156 func (fake *FakeIO) ConfigReturnsOnCall(i int, result1 cio.Config) { 157 fake.configMutex.Lock() 158 defer fake.configMutex.Unlock() 159 fake.ConfigStub = nil 160 if fake.configReturnsOnCall == nil { 161 fake.configReturnsOnCall = make(map[int]struct { 162 result1 cio.Config 163 }) 164 } 165 fake.configReturnsOnCall[i] = struct { 166 result1 cio.Config 167 }{result1} 168 } 169 170 func (fake *FakeIO) Wait() { 171 fake.waitMutex.Lock() 172 fake.waitArgsForCall = append(fake.waitArgsForCall, struct { 173 }{}) 174 fake.recordInvocation("Wait", []interface{}{}) 175 fake.waitMutex.Unlock() 176 if fake.WaitStub != nil { 177 fake.WaitStub() 178 } 179 } 180 181 func (fake *FakeIO) WaitCallCount() int { 182 fake.waitMutex.RLock() 183 defer fake.waitMutex.RUnlock() 184 return len(fake.waitArgsForCall) 185 } 186 187 func (fake *FakeIO) WaitCalls(stub func()) { 188 fake.waitMutex.Lock() 189 defer fake.waitMutex.Unlock() 190 fake.WaitStub = stub 191 } 192 193 func (fake *FakeIO) Invocations() map[string][][]interface{} { 194 fake.invocationsMutex.RLock() 195 defer fake.invocationsMutex.RUnlock() 196 fake.cancelMutex.RLock() 197 defer fake.cancelMutex.RUnlock() 198 fake.closeMutex.RLock() 199 defer fake.closeMutex.RUnlock() 200 fake.configMutex.RLock() 201 defer fake.configMutex.RUnlock() 202 fake.waitMutex.RLock() 203 defer fake.waitMutex.RUnlock() 204 copiedInvocations := map[string][][]interface{}{} 205 for key, value := range fake.invocations { 206 copiedInvocations[key] = value 207 } 208 return copiedInvocations 209 } 210 211 func (fake *FakeIO) recordInvocation(key string, args []interface{}) { 212 fake.invocationsMutex.Lock() 213 defer fake.invocationsMutex.Unlock() 214 if fake.invocations == nil { 215 fake.invocations = map[string][][]interface{}{} 216 } 217 if fake.invocations[key] == nil { 218 fake.invocations[key] = [][]interface{}{} 219 } 220 fake.invocations[key] = append(fake.invocations[key], args) 221 } 222 223 var _ cio.IO = new(FakeIO)