mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
middleware/kubernetes: cleanup (#818)
Drop the interfaceAddr interfaces and just use a function. Cleanup all fallout from that. Remove the use of global variables and cleanup the tests a bit.
This commit is contained in:
@@ -96,19 +96,13 @@ func (APIConnTest) EndpointsList() api.EndpointsList {
|
||||
|
||||
func (APIConnTest) GetNodeByName(name string) (api.Node, error) { return api.Node{}, nil }
|
||||
|
||||
type interfaceAddrsTest struct{}
|
||||
|
||||
func (i interfaceAddrsTest) interfaceAddrs() ([]net.Addr, error) {
|
||||
_, ipnet, _ := net.ParseCIDR("172.0.40.10/32")
|
||||
return []net.Addr{ipnet}, nil
|
||||
}
|
||||
|
||||
func TestDoCoreDNSRecord(t *testing.T) {
|
||||
|
||||
corednsRecord = dns.A{}
|
||||
k := Kubernetes{Zones: []string{"inter.webs.test"}}
|
||||
|
||||
k.interfaceAddrs = &interfaceAddrsTest{}
|
||||
k.interfaceAddrsFunc = func() net.IP { return net.ParseIP("172.0.40.10") }
|
||||
|
||||
k.APIConn = &APIConnTest{}
|
||||
|
||||
cdr := k.coreDNSRecord()
|
||||
|
||||
Reference in New Issue
Block a user