Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proxy_test.go file to avoid ChooseHostInterface #5400

Merged
merged 1 commit into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be a public symbol - createProxier() or newProxierInternal() please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thockin fixed it as part of #5497

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