Skip to content

Commit

Permalink
fix proxy_test.go file to avoid ChooseHostInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
sub-mod committed Mar 12, 2015
1 parent 4420e04 commit 269ad32
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions pkg/proxy/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ func NewProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables.In
return nil
}
glog.Infof("Setting Proxy IP to %v", hostIP)
return CreateProxier(loadBalancer, listenIP, iptables, hostIP)
}

func CreateProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables.Interface, hostIP net.IP) *Proxier {
glog.Infof("Initializing iptables")
// Clean up old messes. Ignore erors.
iptablesDeleteOld(iptables)
Expand Down
20 changes: 10 additions & 10 deletions pkg/proxy/proxier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func TestTCPProxy(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "TCP", 0, time.Second)
Expand All @@ -221,7 +221,7 @@ func TestUDPProxy(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "UDP", 0, time.Second)
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestTCPProxyStop(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "TCP", 0, time.Second)
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestUDPProxyStop(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "UDP", 0, time.Second)
Expand Down Expand Up @@ -312,7 +312,7 @@ func TestTCPProxyUpdateDelete(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "TCP", 0, time.Second)
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestUDPProxyUpdateDelete(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "UDP", 0, time.Second)
Expand Down Expand Up @@ -372,7 +372,7 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "TCP", 0, time.Second)
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "UDP", 0, time.Second)
Expand Down Expand Up @@ -450,7 +450,7 @@ func TestTCPProxyUpdatePort(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "TCP", 0, time.Second)
Expand Down Expand Up @@ -486,7 +486,7 @@ func TestUDPProxyUpdatePort(t *testing.T) {
},
})

p := NewProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{})
p := CreateProxier(lb, net.ParseIP("0.0.0.0"), &fakeIptables{}, net.ParseIP("127.0.0.1"))
waitForNumProxyLoops(t, p, 0)

svcInfo, err := p.addServiceOnPort("echo", "UDP", 0, time.Second)
Expand Down

0 comments on commit 269ad32

Please sign in to comment.