mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
plugin/kubernetes: implement HasSynced() (#1155)
* plugin/kubernetes: wait until api is ready Wait for HasSynced before allowing startup to avoid startup race. Also do a small refactor in findServices() to pull a check out of the loop - only needs to be done once. * sigh
This commit is contained in:
@@ -4,7 +4,6 @@ package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/test"
|
||||
|
||||
@@ -36,9 +35,6 @@ func TestKubernetesAPIFallthrough(t *testing.T) {
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Work-around for timing condition that results in no-data being returned in test environment.
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
for _, tc := range tests {
|
||||
|
||||
c := new(dns.Client)
|
||||
|
||||
@@ -4,7 +4,6 @@ package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/test"
|
||||
|
||||
@@ -42,9 +41,6 @@ func TestKubernetesNSExposed(t *testing.T) {
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Work-around for timing condition that results in no-data being returned in test environment.
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
for _, tc := range dnsTestCasesAllNSExposed {
|
||||
|
||||
c := new(dns.Client)
|
||||
|
||||
@@ -4,7 +4,6 @@ package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/test"
|
||||
|
||||
@@ -30,11 +29,11 @@ var dnsTestCasesPodsInsecure = []test.Case{
|
||||
|
||||
func TestKubernetesPodsInsecure(t *testing.T) {
|
||||
corefile := `.:0 {
|
||||
kubernetes cluster.local 0.0.10.in-addr.arpa {
|
||||
endpoint http://localhost:8080
|
||||
namespaces test-1
|
||||
pods insecure
|
||||
}
|
||||
kubernetes cluster.local 0.0.10.in-addr.arpa {
|
||||
endpoint http://localhost:8080
|
||||
namespaces test-1
|
||||
pods insecure
|
||||
}
|
||||
`
|
||||
|
||||
server, udp, _, err := CoreDNSServerAndPorts(corefile)
|
||||
@@ -43,9 +42,6 @@ func TestKubernetesPodsInsecure(t *testing.T) {
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Work-around for timing condition that results in no-data being returned in test environment.
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
for _, tc := range dnsTestCasesPodsInsecure {
|
||||
|
||||
c := new(dns.Client)
|
||||
@@ -92,9 +88,6 @@ func TestKubernetesPodsVerified(t *testing.T) {
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Work-around for timing condition that results in no-data being returned in test environment.
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
for _, tc := range dnsTestCasesPodsVerified {
|
||||
|
||||
c := new(dns.Client)
|
||||
|
||||
@@ -279,8 +279,7 @@ func doIntegrationTests(t *testing.T, corefile string, testCases []test.Case) {
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Work-around for timing condition that results in no-data being returned in test environment.
|
||||
time.Sleep(3 * time.Second)
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user