mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #99262 from JornShen/add_check_pod_for_e2etest_basic_endpoint
e2e test replace CreateSync in createPodOrFail
This commit is contained in:
		@@ -796,11 +796,11 @@ var _ = SIGDescribe("Services", func() {
 | 
			
		||||
		name1 := "pod1"
 | 
			
		||||
		name2 := "pod2"
 | 
			
		||||
 | 
			
		||||
		createPodOrFail(cs, ns, name1, jig.Labels, []v1.ContainerPort{{ContainerPort: 80}})
 | 
			
		||||
		createPodOrFail(f, ns, name1, jig.Labels, []v1.ContainerPort{{ContainerPort: 80}})
 | 
			
		||||
		names[name1] = true
 | 
			
		||||
		validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{name1: {80}})
 | 
			
		||||
 | 
			
		||||
		createPodOrFail(cs, ns, name2, jig.Labels, []v1.ContainerPort{{ContainerPort: 80}})
 | 
			
		||||
		createPodOrFail(f, ns, name2, jig.Labels, []v1.ContainerPort{{ContainerPort: 80}})
 | 
			
		||||
		names[name2] = true
 | 
			
		||||
		validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{name1: {80}, name2: {80}})
 | 
			
		||||
 | 
			
		||||
@@ -877,11 +877,11 @@ var _ = SIGDescribe("Services", func() {
 | 
			
		||||
		podname1 := "pod1"
 | 
			
		||||
		podname2 := "pod2"
 | 
			
		||||
 | 
			
		||||
		createPodOrFail(cs, ns, podname1, jig.Labels, containerPorts1)
 | 
			
		||||
		createPodOrFail(f, ns, podname1, jig.Labels, containerPorts1)
 | 
			
		||||
		names[podname1] = true
 | 
			
		||||
		validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{podname1: {port1}})
 | 
			
		||||
 | 
			
		||||
		createPodOrFail(cs, ns, podname2, jig.Labels, containerPorts2)
 | 
			
		||||
		createPodOrFail(f, ns, podname2, jig.Labels, containerPorts2)
 | 
			
		||||
		names[podname2] = true
 | 
			
		||||
		validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{podname1: {port1}, podname2: {port2}})
 | 
			
		||||
 | 
			
		||||
@@ -2431,18 +2431,14 @@ func createPausePodDeployment(cs clientset.Interface, name, ns string, replicas
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// createPodOrFail creates a pod with the specified containerPorts.
 | 
			
		||||
func createPodOrFail(c clientset.Interface, ns, name string, labels map[string]string, containerPorts []v1.ContainerPort) {
 | 
			
		||||
func createPodOrFail(f *framework.Framework, ns, name string, labels map[string]string, containerPorts []v1.ContainerPort) {
 | 
			
		||||
	ginkgo.By(fmt.Sprintf("Creating pod %s in namespace %s", name, ns))
 | 
			
		||||
	pod := e2epod.NewAgnhostPod(ns, name, nil, nil, containerPorts)
 | 
			
		||||
	pod.ObjectMeta.Labels = labels
 | 
			
		||||
	// Add a dummy environment variable to work around a docker issue.
 | 
			
		||||
	// https://github.com/docker/docker/issues/14203
 | 
			
		||||
	pod.Spec.Containers[0].Env = []v1.EnvVar{{Name: "FOO", Value: " "}}
 | 
			
		||||
 | 
			
		||||
	_, err := c.CoreV1().Pods(ns).Create(context.TODO(), pod, metav1.CreateOptions{})
 | 
			
		||||
	framework.ExpectNoError(err, "failed to create pod %s in namespace %s", name, ns)
 | 
			
		||||
	err = e2epod.WaitTimeoutForPodReadyInNamespace(c, name, ns, framework.PodStartTimeout)
 | 
			
		||||
	framework.ExpectNoError(err)
 | 
			
		||||
	f.PodClient().CreateSync(pod)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// launchHostExecPod launches a hostexec pod in the given namespace and waits
 | 
			
		||||
@@ -2664,7 +2660,7 @@ var _ = SIGDescribe("SCTP [Feature:SCTP] [LinuxOnly]", func() {
 | 
			
		||||
 | 
			
		||||
		name1 := "pod1"
 | 
			
		||||
 | 
			
		||||
		createPodOrFail(cs, ns, name1, jig.Labels, []v1.ContainerPort{{ContainerPort: 5060, Protocol: v1.ProtocolSCTP}})
 | 
			
		||||
		createPodOrFail(f, ns, name1, jig.Labels, []v1.ContainerPort{{ContainerPort: 5060, Protocol: v1.ProtocolSCTP}})
 | 
			
		||||
		names[name1] = true
 | 
			
		||||
		defer func() {
 | 
			
		||||
			for name := range names {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user