adding a windows nodeSelector for nodePort tests

jig modifier
This commit is contained in:
jayunit100 2021-01-07 06:42:59 -08:00
parent 84b4569390
commit 89120be5c3

View File

@ -56,16 +56,26 @@ var _ = SIGDescribe("Services", func() {
nodePort := int(svc.Spec.Ports[0].NodePort)
ginkgo.By("creating Pod to be part of service " + serviceName)
_, err = jig.Run(nil)
// tweak the Jig to use windows...
windowsNodeSelectorTweak := func(rc *v1.ReplicationController) {
rc.Spec.Template.Spec.NodeSelector = map[string]string{
"kubernetes.io/os": "windows",
}
}
_, err = jig.Run(windowsNodeSelectorTweak)
framework.ExpectNoError(err)
//using hybrid_network methods
ginkgo.By("creating Windows testing Pod")
windowsPod := createTestPod(f, windowsBusyBoximage, windowsOS)
windowsPod = f.PodClient().CreateSync(windowsPod)
testPod := createTestPod(f, windowsBusyBoximage, windowsOS)
testPod = f.PodClient().CreateSync(testPod)
ginkgo.By("verifying that pod has the correct nodeSelector")
// Admission controllers may sometimes do the wrong thing
framework.ExpectEqual(testPod.Spec.NodeSelector["kubernetes.io/os"], "windows")
ginkgo.By(fmt.Sprintf("checking connectivity Pod to curl http://%s:%d", nodeIP, nodePort))
assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s:%d", nodeIP, nodePort)))
assertConsistentConnectivity(f, testPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s:%d", nodeIP, nodePort)))
})