mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #64777 from HotelsDotCom/bug/failing-test-events
Automatic merge from submit-queue (batch tested with PRs 63322, 64718, 64708, 64775, 64777). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Remove event handler to satisfy alpha tests **What this PR does / why we need it**: An original assumption of time out did not fix issue. The events look masked by lubelet flags so reducing test **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #64578 /cc @msau42 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -19,7 +19,6 @@ package common
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"k8s.io/api/core/v1"
 | 
						"k8s.io/api/core/v1"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/fields"
 | 
					 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/uuid"
 | 
						"k8s.io/apimachinery/pkg/util/uuid"
 | 
				
			||||||
	"k8s.io/kubernetes/test/e2e/framework"
 | 
						"k8s.io/kubernetes/test/e2e/framework"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -255,13 +254,13 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Pod should fail
 | 
							// Pod should fail
 | 
				
			||||||
		testPodFailSubpath(f, pod, "SubPath `..`: must not contain '..'")
 | 
							testPodFailSubpath(f, pod)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
		    Testname: var-expansion-subpath-with-absolute-path
 | 
							    Testname: var-expansion-subpath-with-absolute-path
 | 
				
			||||||
		    Description: Make sure a container's subpath can not be set using an
 | 
							    Description: Make sure a container's subpath can not be set using an
 | 
				
			||||||
			expansion of environment variables when absoluete path is supplied.
 | 
								expansion of environment variables when absolute path is supplied.
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	It("should fail substituting values in a volume subpath with absolute path [Feature:VolumeSubpathEnvExpansion][NodeAlphaFeature:VolumeSubpathEnvExpansion][Slow]", func() {
 | 
						It("should fail substituting values in a volume subpath with absolute path [Feature:VolumeSubpathEnvExpansion][NodeAlphaFeature:VolumeSubpathEnvExpansion][Slow]", func() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -304,11 +303,11 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Pod should fail
 | 
							// Pod should fail
 | 
				
			||||||
		testPodFailSubpath(f, pod, "SubPath `/tmp` must not be an absolute path")
 | 
							testPodFailSubpath(f, pod)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func testPodFailSubpath(f *framework.Framework, pod *v1.Pod, errorText string) {
 | 
					func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
 | 
						pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
 | 
				
			||||||
	Expect(err).ToNot(HaveOccurred(), "while creating pod")
 | 
						Expect(err).ToNot(HaveOccurred(), "while creating pod")
 | 
				
			||||||
@@ -319,17 +318,4 @@ func testPodFailSubpath(f *framework.Framework, pod *v1.Pod, errorText string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
 | 
						err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
 | 
				
			||||||
	Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
 | 
						Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
 | 
				
			||||||
 | 
					 | 
				
			||||||
	selector := fields.Set{
 | 
					 | 
				
			||||||
		"involvedObject.kind":      "Pod",
 | 
					 | 
				
			||||||
		"involvedObject.name":      pod.Name,
 | 
					 | 
				
			||||||
		"involvedObject.namespace": f.Namespace.Name,
 | 
					 | 
				
			||||||
		"reason":                   "Failed",
 | 
					 | 
				
			||||||
	}.AsSelector().String()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	options := metav1.ListOptions{FieldSelector: selector}
 | 
					 | 
				
			||||||
	events, err := f.ClientSet.CoreV1().Events(f.Namespace.Name).List(options)
 | 
					 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred(), "while getting pod events")
 | 
					 | 
				
			||||||
	Expect(len(events.Items)).NotTo(Equal(0), "no events found")
 | 
					 | 
				
			||||||
	Expect(events.Items[0].Message).To(ContainSubstring(errorText), "subpath error not found")
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user