statuswriter.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // Code generated by counterfeiter. DO NOT EDIT.
  2. package fakes
  3. import (
  4. "context"
  5. "sync"
  6. "sigs.k8s.io/controller-runtime/pkg/client"
  7. )
  8. type StatusWriter struct {
  9. PatchStub func(context.Context, client.Object, client.Patch, ...client.PatchOption) error
  10. patchMutex sync.RWMutex
  11. patchArgsForCall []struct {
  12. arg1 context.Context
  13. arg2 client.Object
  14. arg3 client.Patch
  15. arg4 []client.PatchOption
  16. }
  17. patchReturns struct {
  18. result1 error
  19. }
  20. patchReturnsOnCall map[int]struct {
  21. result1 error
  22. }
  23. UpdateStub func(context.Context, client.Object, ...client.UpdateOption) error
  24. updateMutex sync.RWMutex
  25. updateArgsForCall []struct {
  26. arg1 context.Context
  27. arg2 client.Object
  28. arg3 []client.UpdateOption
  29. }
  30. updateReturns struct {
  31. result1 error
  32. }
  33. updateReturnsOnCall map[int]struct {
  34. result1 error
  35. }
  36. invocations map[string][][]interface{}
  37. invocationsMutex sync.RWMutex
  38. }
  39. func (fake *StatusWriter) Patch(arg1 context.Context, arg2 client.Object, arg3 client.Patch, arg4 ...client.PatchOption) error {
  40. fake.patchMutex.Lock()
  41. ret, specificReturn := fake.patchReturnsOnCall[len(fake.patchArgsForCall)]
  42. fake.patchArgsForCall = append(fake.patchArgsForCall, struct {
  43. arg1 context.Context
  44. arg2 client.Object
  45. arg3 client.Patch
  46. arg4 []client.PatchOption
  47. }{arg1, arg2, arg3, arg4})
  48. stub := fake.PatchStub
  49. fakeReturns := fake.patchReturns
  50. fake.recordInvocation("Patch", []interface{}{arg1, arg2, arg3, arg4})
  51. fake.patchMutex.Unlock()
  52. if stub != nil {
  53. return stub(arg1, arg2, arg3, arg4...)
  54. }
  55. if specificReturn {
  56. return ret.result1
  57. }
  58. return fakeReturns.result1
  59. }
  60. func (fake *StatusWriter) PatchCallCount() int {
  61. fake.patchMutex.RLock()
  62. defer fake.patchMutex.RUnlock()
  63. return len(fake.patchArgsForCall)
  64. }
  65. func (fake *StatusWriter) PatchCalls(stub func(context.Context, client.Object, client.Patch, ...client.PatchOption) error) {
  66. fake.patchMutex.Lock()
  67. defer fake.patchMutex.Unlock()
  68. fake.PatchStub = stub
  69. }
  70. func (fake *StatusWriter) PatchArgsForCall(i int) (context.Context, client.Object, client.Patch, []client.PatchOption) {
  71. fake.patchMutex.RLock()
  72. defer fake.patchMutex.RUnlock()
  73. argsForCall := fake.patchArgsForCall[i]
  74. return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
  75. }
  76. func (fake *StatusWriter) PatchReturns(result1 error) {
  77. fake.patchMutex.Lock()
  78. defer fake.patchMutex.Unlock()
  79. fake.PatchStub = nil
  80. fake.patchReturns = struct {
  81. result1 error
  82. }{result1}
  83. }
  84. func (fake *StatusWriter) PatchReturnsOnCall(i int, result1 error) {
  85. fake.patchMutex.Lock()
  86. defer fake.patchMutex.Unlock()
  87. fake.PatchStub = nil
  88. if fake.patchReturnsOnCall == nil {
  89. fake.patchReturnsOnCall = make(map[int]struct {
  90. result1 error
  91. })
  92. }
  93. fake.patchReturnsOnCall[i] = struct {
  94. result1 error
  95. }{result1}
  96. }
  97. func (fake *StatusWriter) Update(arg1 context.Context, arg2 client.Object, arg3 ...client.UpdateOption) error {
  98. fake.updateMutex.Lock()
  99. ret, specificReturn := fake.updateReturnsOnCall[len(fake.updateArgsForCall)]
  100. fake.updateArgsForCall = append(fake.updateArgsForCall, struct {
  101. arg1 context.Context
  102. arg2 client.Object
  103. arg3 []client.UpdateOption
  104. }{arg1, arg2, arg3})
  105. stub := fake.UpdateStub
  106. fakeReturns := fake.updateReturns
  107. fake.recordInvocation("Update", []interface{}{arg1, arg2, arg3})
  108. fake.updateMutex.Unlock()
  109. if stub != nil {
  110. return stub(arg1, arg2, arg3...)
  111. }
  112. if specificReturn {
  113. return ret.result1
  114. }
  115. return fakeReturns.result1
  116. }
  117. func (fake *StatusWriter) UpdateCallCount() int {
  118. fake.updateMutex.RLock()
  119. defer fake.updateMutex.RUnlock()
  120. return len(fake.updateArgsForCall)
  121. }
  122. func (fake *StatusWriter) UpdateCalls(stub func(context.Context, client.Object, ...client.UpdateOption) error) {
  123. fake.updateMutex.Lock()
  124. defer fake.updateMutex.Unlock()
  125. fake.UpdateStub = stub
  126. }
  127. func (fake *StatusWriter) UpdateArgsForCall(i int) (context.Context, client.Object, []client.UpdateOption) {
  128. fake.updateMutex.RLock()
  129. defer fake.updateMutex.RUnlock()
  130. argsForCall := fake.updateArgsForCall[i]
  131. return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
  132. }
  133. func (fake *StatusWriter) UpdateReturns(result1 error) {
  134. fake.updateMutex.Lock()
  135. defer fake.updateMutex.Unlock()
  136. fake.UpdateStub = nil
  137. fake.updateReturns = struct {
  138. result1 error
  139. }{result1}
  140. }
  141. func (fake *StatusWriter) UpdateReturnsOnCall(i int, result1 error) {
  142. fake.updateMutex.Lock()
  143. defer fake.updateMutex.Unlock()
  144. fake.UpdateStub = nil
  145. if fake.updateReturnsOnCall == nil {
  146. fake.updateReturnsOnCall = make(map[int]struct {
  147. result1 error
  148. })
  149. }
  150. fake.updateReturnsOnCall[i] = struct {
  151. result1 error
  152. }{result1}
  153. }
  154. func (fake *StatusWriter) Invocations() map[string][][]interface{} {
  155. fake.invocationsMutex.RLock()
  156. defer fake.invocationsMutex.RUnlock()
  157. fake.patchMutex.RLock()
  158. defer fake.patchMutex.RUnlock()
  159. fake.updateMutex.RLock()
  160. defer fake.updateMutex.RUnlock()
  161. copiedInvocations := map[string][][]interface{}{}
  162. for key, value := range fake.invocations {
  163. copiedInvocations[key] = value
  164. }
  165. return copiedInvocations
  166. }
  167. func (fake *StatusWriter) recordInvocation(key string, args []interface{}) {
  168. fake.invocationsMutex.Lock()
  169. defer fake.invocationsMutex.Unlock()
  170. if fake.invocations == nil {
  171. fake.invocations = map[string][][]interface{}{}
  172. }
  173. if fake.invocations[key] == nil {
  174. fake.invocations[key] = [][]interface{}{}
  175. }
  176. fake.invocations[key] = append(fake.invocations[key], args)
  177. }
  178. var _ client.StatusWriter = new(StatusWriter)