github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/linux_container/fake_iptables_manager/fake_iptables_manager.go (about) 1 // This file was generated by counterfeiter 2 package fake_iptables_manager 3 4 import ( 5 "net" 6 "sync" 7 8 "github.com/cloudfoundry-incubator/garden-linux/linux_container" 9 ) 10 11 type FakeIPTablesManager struct { 12 ContainerSetupStub func(containerID, bridgeName string, ip net.IP, network *net.IPNet) error 13 containerSetupMutex sync.RWMutex 14 containerSetupArgsForCall []struct { 15 containerID string 16 bridgeName string 17 ip net.IP 18 network *net.IPNet 19 } 20 containerSetupReturns struct { 21 result1 error 22 } 23 ContainerTeardownStub func(containerID string) error 24 containerTeardownMutex sync.RWMutex 25 containerTeardownArgsForCall []struct { 26 containerID string 27 } 28 containerTeardownReturns struct { 29 result1 error 30 } 31 } 32 33 func (fake *FakeIPTablesManager) ContainerSetup(containerID string, bridgeName string, ip net.IP, network *net.IPNet) error { 34 fake.containerSetupMutex.Lock() 35 fake.containerSetupArgsForCall = append(fake.containerSetupArgsForCall, struct { 36 containerID string 37 bridgeName string 38 ip net.IP 39 network *net.IPNet 40 }{containerID, bridgeName, ip, network}) 41 fake.containerSetupMutex.Unlock() 42 if fake.ContainerSetupStub != nil { 43 return fake.ContainerSetupStub(containerID, bridgeName, ip, network) 44 } else { 45 return fake.containerSetupReturns.result1 46 } 47 } 48 49 func (fake *FakeIPTablesManager) ContainerSetupCallCount() int { 50 fake.containerSetupMutex.RLock() 51 defer fake.containerSetupMutex.RUnlock() 52 return len(fake.containerSetupArgsForCall) 53 } 54 55 func (fake *FakeIPTablesManager) ContainerSetupArgsForCall(i int) (string, string, net.IP, *net.IPNet) { 56 fake.containerSetupMutex.RLock() 57 defer fake.containerSetupMutex.RUnlock() 58 return fake.containerSetupArgsForCall[i].containerID, fake.containerSetupArgsForCall[i].bridgeName, fake.containerSetupArgsForCall[i].ip, fake.containerSetupArgsForCall[i].network 59 } 60 61 func (fake *FakeIPTablesManager) ContainerSetupReturns(result1 error) { 62 fake.ContainerSetupStub = nil 63 fake.containerSetupReturns = struct { 64 result1 error 65 }{result1} 66 } 67 68 func (fake *FakeIPTablesManager) ContainerTeardown(containerID string) error { 69 fake.containerTeardownMutex.Lock() 70 fake.containerTeardownArgsForCall = append(fake.containerTeardownArgsForCall, struct { 71 containerID string 72 }{containerID}) 73 fake.containerTeardownMutex.Unlock() 74 if fake.ContainerTeardownStub != nil { 75 return fake.ContainerTeardownStub(containerID) 76 } else { 77 return fake.containerTeardownReturns.result1 78 } 79 } 80 81 func (fake *FakeIPTablesManager) ContainerTeardownCallCount() int { 82 fake.containerTeardownMutex.RLock() 83 defer fake.containerTeardownMutex.RUnlock() 84 return len(fake.containerTeardownArgsForCall) 85 } 86 87 func (fake *FakeIPTablesManager) ContainerTeardownArgsForCall(i int) string { 88 fake.containerTeardownMutex.RLock() 89 defer fake.containerTeardownMutex.RUnlock() 90 return fake.containerTeardownArgsForCall[i].containerID 91 } 92 93 func (fake *FakeIPTablesManager) ContainerTeardownReturns(result1 error) { 94 fake.ContainerTeardownStub = nil 95 fake.containerTeardownReturns = struct { 96 result1 error 97 }{result1} 98 } 99 100 var _ linux_container.IPTablesManager = new(FakeIPTablesManager)