MCPcopy
hub / github.com/coredns/coredns / TestEndpointsDisabled

Function TestEndpointsDisabled

plugin/kubernetes/controller_test.go:77–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

75}
76
77func TestEndpointsDisabled(t *testing.T) {
78 ctx := context.Background()
79 k := kubernetesWithFakeClient(ctx, "10.0.0.0/30", false, "headless")
80 k.opts.initEndpointsCache = false
81
82 go k.APIConn.Run()
83 defer k.APIConn.Stop()
84 for !k.APIConn.HasSynced() {
85 time.Sleep(time.Millisecond)
86 }
87
88 rw := &dnstest.Recorder{ResponseWriter: &test.ResponseWriter{}}
89 m := new(dns.Msg)
90 m.SetQuestion("svc2.testns.svc.cluster.local.", dns.TypeA)
91 k.ServeDNS(ctx, rw, m)
92 if rw.Msg.Rcode != dns.RcodeNameError {
93 t.Errorf("Expected NXDOMAIN, got %v", dns.RcodeToString[rw.Msg.Rcode])
94 }
95}
96
97func TestEndpointsEnabled(t *testing.T) {
98 ctx := context.Background()

Callers

nothing calls this directly

Calls 6

kubernetesWithFakeClientFunction · 0.85
RunMethod · 0.65
StopMethod · 0.65
HasSyncedMethod · 0.65
ServeDNSMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…