github.com/operator-framework/operator-lifecycle-manager@v0.30.0/pkg/controller/bundle/bundlefakes/fake_unpacker.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package bundlefakes 3 4 import ( 5 "sync" 6 "time" 7 8 "github.com/operator-framework/api/pkg/operators/v1alpha1" 9 "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/bundle" 10 ) 11 12 type FakeUnpacker struct { 13 UnpackBundleStub func(*v1alpha1.BundleLookup, time.Duration, time.Duration) (*bundle.BundleUnpackResult, error) 14 unpackBundleMutex sync.RWMutex 15 unpackBundleArgsForCall []struct { 16 arg1 *v1alpha1.BundleLookup 17 arg2 time.Duration 18 arg3 time.Duration 19 } 20 unpackBundleReturns struct { 21 result1 *bundle.BundleUnpackResult 22 result2 error 23 } 24 unpackBundleReturnsOnCall map[int]struct { 25 result1 *bundle.BundleUnpackResult 26 result2 error 27 } 28 invocations map[string][][]interface{} 29 invocationsMutex sync.RWMutex 30 } 31 32 func (fake *FakeUnpacker) UnpackBundle(arg1 *v1alpha1.BundleLookup, arg2 time.Duration, arg3 time.Duration) (*bundle.BundleUnpackResult, error) { 33 fake.unpackBundleMutex.Lock() 34 ret, specificReturn := fake.unpackBundleReturnsOnCall[len(fake.unpackBundleArgsForCall)] 35 fake.unpackBundleArgsForCall = append(fake.unpackBundleArgsForCall, struct { 36 arg1 *v1alpha1.BundleLookup 37 arg2 time.Duration 38 arg3 time.Duration 39 }{arg1, arg2, arg3}) 40 stub := fake.UnpackBundleStub 41 fakeReturns := fake.unpackBundleReturns 42 fake.recordInvocation("UnpackBundle", []interface{}{arg1, arg2, arg3}) 43 fake.unpackBundleMutex.Unlock() 44 if stub != nil { 45 return stub(arg1, arg2, arg3) 46 } 47 if specificReturn { 48 return ret.result1, ret.result2 49 } 50 return fakeReturns.result1, fakeReturns.result2 51 } 52 53 func (fake *FakeUnpacker) UnpackBundleCallCount() int { 54 fake.unpackBundleMutex.RLock() 55 defer fake.unpackBundleMutex.RUnlock() 56 return len(fake.unpackBundleArgsForCall) 57 } 58 59 func (fake *FakeUnpacker) UnpackBundleCalls(stub func(*v1alpha1.BundleLookup, time.Duration, time.Duration) (*bundle.BundleUnpackResult, error)) { 60 fake.unpackBundleMutex.Lock() 61 defer fake.unpackBundleMutex.Unlock() 62 fake.UnpackBundleStub = stub 63 } 64 65 func (fake *FakeUnpacker) UnpackBundleArgsForCall(i int) (*v1alpha1.BundleLookup, time.Duration, time.Duration) { 66 fake.unpackBundleMutex.RLock() 67 defer fake.unpackBundleMutex.RUnlock() 68 argsForCall := fake.unpackBundleArgsForCall[i] 69 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 70 } 71 72 func (fake *FakeUnpacker) UnpackBundleReturns(result1 *bundle.BundleUnpackResult, result2 error) { 73 fake.unpackBundleMutex.Lock() 74 defer fake.unpackBundleMutex.Unlock() 75 fake.UnpackBundleStub = nil 76 fake.unpackBundleReturns = struct { 77 result1 *bundle.BundleUnpackResult 78 result2 error 79 }{result1, result2} 80 } 81 82 func (fake *FakeUnpacker) UnpackBundleReturnsOnCall(i int, result1 *bundle.BundleUnpackResult, result2 error) { 83 fake.unpackBundleMutex.Lock() 84 defer fake.unpackBundleMutex.Unlock() 85 fake.UnpackBundleStub = nil 86 if fake.unpackBundleReturnsOnCall == nil { 87 fake.unpackBundleReturnsOnCall = make(map[int]struct { 88 result1 *bundle.BundleUnpackResult 89 result2 error 90 }) 91 } 92 fake.unpackBundleReturnsOnCall[i] = struct { 93 result1 *bundle.BundleUnpackResult 94 result2 error 95 }{result1, result2} 96 } 97 98 func (fake *FakeUnpacker) Invocations() map[string][][]interface{} { 99 fake.invocationsMutex.RLock() 100 defer fake.invocationsMutex.RUnlock() 101 fake.unpackBundleMutex.RLock() 102 defer fake.unpackBundleMutex.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 *FakeUnpacker) 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 _ bundle.Unpacker = new(FakeUnpacker)