-
Notifications
You must be signed in to change notification settings - Fork 12
/
node-dns_test.go
34 lines (29 loc) · 1.02 KB
/
node-dns_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package dctest
import (
"encoding/json"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
)
func testNodeDNS() {
It("should resolve Service domain names", func() {
By("getting a Node address")
pods := &corev1.PodList{}
stdout := execSafeAt(bootServers[0], "kubectl", "-n", "kube-system", "get", "pods", "-o", "json")
err := json.Unmarshal(stdout, pods)
Expect(err).NotTo(HaveOccurred(), "data=%s", stdout)
Expect(pods.Items).NotTo(BeEmpty())
nodeAddr := pods.Items[0].Spec.NodeName
By("resolving kubernetes.default.svc on " + nodeAddr)
execSafeAt(bootServers[0], "ckecli", "ssh", "cybozu@"+nodeAddr, "--",
"curl", "-k", "https://kubernetes.default.svc")
})
It("should run kube-proxy on boot servers", func() {
By("running curl over squid.internet-egress.svc")
Eventually(func() error {
_, _, err := execAt(bootServers[0], "env", "https_proxy=http://squid.internet-egress.svc:3128",
"curl", "-fs", "https://www.cybozu.com/")
return err
}).Should(Succeed())
})
}