github.com/chenbh/concourse/v6@v6.4.2/worker/runtime/iptables/iptablesfakes/fake_iptables.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package iptablesfakes 3 4 import ( 5 "sync" 6 7 "github.com/chenbh/concourse/v6/worker/runtime/iptables" 8 ) 9 10 type FakeIptables struct { 11 AppendRuleStub func(string, string, ...string) error 12 appendRuleMutex sync.RWMutex 13 appendRuleArgsForCall []struct { 14 arg1 string 15 arg2 string 16 arg3 []string 17 } 18 appendRuleReturns struct { 19 result1 error 20 } 21 appendRuleReturnsOnCall map[int]struct { 22 result1 error 23 } 24 CreateChainOrFlushIfExistsStub func(string, string) error 25 createChainOrFlushIfExistsMutex sync.RWMutex 26 createChainOrFlushIfExistsArgsForCall []struct { 27 arg1 string 28 arg2 string 29 } 30 createChainOrFlushIfExistsReturns struct { 31 result1 error 32 } 33 createChainOrFlushIfExistsReturnsOnCall map[int]struct { 34 result1 error 35 } 36 invocations map[string][][]interface{} 37 invocationsMutex sync.RWMutex 38 } 39 40 func (fake *FakeIptables) AppendRule(arg1 string, arg2 string, arg3 ...string) error { 41 fake.appendRuleMutex.Lock() 42 ret, specificReturn := fake.appendRuleReturnsOnCall[len(fake.appendRuleArgsForCall)] 43 fake.appendRuleArgsForCall = append(fake.appendRuleArgsForCall, struct { 44 arg1 string 45 arg2 string 46 arg3 []string 47 }{arg1, arg2, arg3}) 48 fake.recordInvocation("AppendRule", []interface{}{arg1, arg2, arg3}) 49 fake.appendRuleMutex.Unlock() 50 if fake.AppendRuleStub != nil { 51 return fake.AppendRuleStub(arg1, arg2, arg3...) 52 } 53 if specificReturn { 54 return ret.result1 55 } 56 fakeReturns := fake.appendRuleReturns 57 return fakeReturns.result1 58 } 59 60 func (fake *FakeIptables) AppendRuleCallCount() int { 61 fake.appendRuleMutex.RLock() 62 defer fake.appendRuleMutex.RUnlock() 63 return len(fake.appendRuleArgsForCall) 64 } 65 66 func (fake *FakeIptables) AppendRuleCalls(stub func(string, string, ...string) error) { 67 fake.appendRuleMutex.Lock() 68 defer fake.appendRuleMutex.Unlock() 69 fake.AppendRuleStub = stub 70 } 71 72 func (fake *FakeIptables) AppendRuleArgsForCall(i int) (string, string, []string) { 73 fake.appendRuleMutex.RLock() 74 defer fake.appendRuleMutex.RUnlock() 75 argsForCall := fake.appendRuleArgsForCall[i] 76 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 77 } 78 79 func (fake *FakeIptables) AppendRuleReturns(result1 error) { 80 fake.appendRuleMutex.Lock() 81 defer fake.appendRuleMutex.Unlock() 82 fake.AppendRuleStub = nil 83 fake.appendRuleReturns = struct { 84 result1 error 85 }{result1} 86 } 87 88 func (fake *FakeIptables) AppendRuleReturnsOnCall(i int, result1 error) { 89 fake.appendRuleMutex.Lock() 90 defer fake.appendRuleMutex.Unlock() 91 fake.AppendRuleStub = nil 92 if fake.appendRuleReturnsOnCall == nil { 93 fake.appendRuleReturnsOnCall = make(map[int]struct { 94 result1 error 95 }) 96 } 97 fake.appendRuleReturnsOnCall[i] = struct { 98 result1 error 99 }{result1} 100 } 101 102 func (fake *FakeIptables) CreateChainOrFlushIfExists(arg1 string, arg2 string) error { 103 fake.createChainOrFlushIfExistsMutex.Lock() 104 ret, specificReturn := fake.createChainOrFlushIfExistsReturnsOnCall[len(fake.createChainOrFlushIfExistsArgsForCall)] 105 fake.createChainOrFlushIfExistsArgsForCall = append(fake.createChainOrFlushIfExistsArgsForCall, struct { 106 arg1 string 107 arg2 string 108 }{arg1, arg2}) 109 fake.recordInvocation("CreateChainOrFlushIfExists", []interface{}{arg1, arg2}) 110 fake.createChainOrFlushIfExistsMutex.Unlock() 111 if fake.CreateChainOrFlushIfExistsStub != nil { 112 return fake.CreateChainOrFlushIfExistsStub(arg1, arg2) 113 } 114 if specificReturn { 115 return ret.result1 116 } 117 fakeReturns := fake.createChainOrFlushIfExistsReturns 118 return fakeReturns.result1 119 } 120 121 func (fake *FakeIptables) CreateChainOrFlushIfExistsCallCount() int { 122 fake.createChainOrFlushIfExistsMutex.RLock() 123 defer fake.createChainOrFlushIfExistsMutex.RUnlock() 124 return len(fake.createChainOrFlushIfExistsArgsForCall) 125 } 126 127 func (fake *FakeIptables) CreateChainOrFlushIfExistsCalls(stub func(string, string) error) { 128 fake.createChainOrFlushIfExistsMutex.Lock() 129 defer fake.createChainOrFlushIfExistsMutex.Unlock() 130 fake.CreateChainOrFlushIfExistsStub = stub 131 } 132 133 func (fake *FakeIptables) CreateChainOrFlushIfExistsArgsForCall(i int) (string, string) { 134 fake.createChainOrFlushIfExistsMutex.RLock() 135 defer fake.createChainOrFlushIfExistsMutex.RUnlock() 136 argsForCall := fake.createChainOrFlushIfExistsArgsForCall[i] 137 return argsForCall.arg1, argsForCall.arg2 138 } 139 140 func (fake *FakeIptables) CreateChainOrFlushIfExistsReturns(result1 error) { 141 fake.createChainOrFlushIfExistsMutex.Lock() 142 defer fake.createChainOrFlushIfExistsMutex.Unlock() 143 fake.CreateChainOrFlushIfExistsStub = nil 144 fake.createChainOrFlushIfExistsReturns = struct { 145 result1 error 146 }{result1} 147 } 148 149 func (fake *FakeIptables) CreateChainOrFlushIfExistsReturnsOnCall(i int, result1 error) { 150 fake.createChainOrFlushIfExistsMutex.Lock() 151 defer fake.createChainOrFlushIfExistsMutex.Unlock() 152 fake.CreateChainOrFlushIfExistsStub = nil 153 if fake.createChainOrFlushIfExistsReturnsOnCall == nil { 154 fake.createChainOrFlushIfExistsReturnsOnCall = make(map[int]struct { 155 result1 error 156 }) 157 } 158 fake.createChainOrFlushIfExistsReturnsOnCall[i] = struct { 159 result1 error 160 }{result1} 161 } 162 163 func (fake *FakeIptables) Invocations() map[string][][]interface{} { 164 fake.invocationsMutex.RLock() 165 defer fake.invocationsMutex.RUnlock() 166 fake.appendRuleMutex.RLock() 167 defer fake.appendRuleMutex.RUnlock() 168 fake.createChainOrFlushIfExistsMutex.RLock() 169 defer fake.createChainOrFlushIfExistsMutex.RUnlock() 170 copiedInvocations := map[string][][]interface{}{} 171 for key, value := range fake.invocations { 172 copiedInvocations[key] = value 173 } 174 return copiedInvocations 175 } 176 177 func (fake *FakeIptables) recordInvocation(key string, args []interface{}) { 178 fake.invocationsMutex.Lock() 179 defer fake.invocationsMutex.Unlock() 180 if fake.invocations == nil { 181 fake.invocations = map[string][][]interface{}{} 182 } 183 if fake.invocations[key] == nil { 184 fake.invocations[key] = [][]interface{}{} 185 } 186 fake.invocations[key] = append(fake.invocations[key], args) 187 } 188 189 var _ iptables.Iptables = new(FakeIptables)