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

test: Extend "Checks service on same node" test case #10687

Merged
merged 1 commit into from Mar 24, 2020
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
13 changes: 11 additions & 2 deletions test/k8sT/Services.go
Expand Up @@ -202,14 +202,17 @@ var _ = Describe("K8sServicesTest", func() {
"cluster-ip-same-node.log")
defer monitorStop()

httpSVCURL := fmt.Sprintf("http://%s/", clusterIP)
tftpSVCURL := fmt.Sprintf("tftp://%s/hello", clusterIP)

k8s1Name, _ := getNodeInfo(helpers.K8s1)
status, err := kubectl.ExecInHostNetNS(context.TODO(), k8s1Name,
helpers.CurlFail("http://%s/", clusterIP))
helpers.CurlFail(httpSVCURL))
Expect(err).To(BeNil(), "Cannot run curl in host netns")
status.ExpectSuccess("cannot curl to service IP from host")

status, err = kubectl.ExecInHostNetNS(context.TODO(), k8s1Name,
helpers.CurlFail("tftp://%s/hello", clusterIP))
helpers.CurlFail(tftpSVCURL))
Expect(err).To(BeNil(), "Cannot run curl in host netns")
status.ExpectSuccess("cannot curl to service IP from host")
ciliumPods, err := kubectl.GetCiliumPods(helpers.CiliumNamespace)
Expand All @@ -219,6 +222,12 @@ var _ = Describe("K8sServicesTest", func() {
service.ExpectSuccess("Cannot retrieve services on cilium Pod")
service.ExpectContains(clusterIP, "ClusterIP is not present in the cilium service list")
}
for i := 0; i < 10; i++ {
// Send requests from "app2" pod which runs on the same node as
// "app1" pods
testCurlRequest("id=app2", httpSVCURL)
testCurlRequest("id=app2", tftpSVCURL)
}
}, 300)

It("Checks service accessing itself (hairpin flow)", func() {
Expand Down
2 changes: 2 additions & 0 deletions test/k8sT/manifests/demo.yaml
Expand Up @@ -87,6 +87,8 @@ spec:
command: [ "sleep" ]
args:
- "1000h"
# k8sT/Services.go:"Checks service on same node" requires the pod to be
# scheduled on the same node as app1
nodeSelector:
"cilium.io/ci-node": k8s1
---
Expand Down