Skip test when depending on feature
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
		@@ -32,6 +32,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/test/e2e/framework"
 | 
						"k8s.io/kubernetes/test/e2e/framework"
 | 
				
			||||||
	e2eevents "k8s.io/kubernetes/test/e2e/framework/events"
 | 
						e2eevents "k8s.io/kubernetes/test/e2e/framework/events"
 | 
				
			||||||
	e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
 | 
						e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
 | 
				
			||||||
 | 
						e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
 | 
				
			||||||
	testutils "k8s.io/kubernetes/test/utils"
 | 
						testutils "k8s.io/kubernetes/test/utils"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/onsi/ginkgo"
 | 
						"github.com/onsi/ginkgo"
 | 
				
			||||||
@@ -214,6 +215,9 @@ var _ = SIGDescribe("Probing container", func() {
 | 
				
			|||||||
		Description: A Pod is created with liveness probe with a Exec action on the Pod. If the liveness probe call does not return within the timeout specified, liveness probe MUST restart the Pod.
 | 
							Description: A Pod is created with liveness probe with a Exec action on the Pod. If the liveness probe call does not return within the timeout specified, liveness probe MUST restart the Pod.
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	ginkgo.It("should be restarted with an exec liveness probe with timeout [NodeConformance]", func() {
 | 
						ginkgo.It("should be restarted with an exec liveness probe with timeout [NodeConformance]", func() {
 | 
				
			||||||
 | 
							// The ExecProbeTimeout feature gate exists to allow backwards-compatibility with pre-1.20 cluster behaviors, where livenessProbe timeouts were ignored
 | 
				
			||||||
 | 
							// If ExecProbeTimeout feature gate is disabled, timeout enforcement for exec livenessProbes is disabled, so we should skip this test
 | 
				
			||||||
 | 
							e2eskipper.SkipUnlessExecProbeTimeoutEnabled()
 | 
				
			||||||
		cmd := []string{"/bin/sh", "-c", "sleep 600"}
 | 
							cmd := []string{"/bin/sh", "-c", "sleep 600"}
 | 
				
			||||||
		livenessProbe := &v1.Probe{
 | 
							livenessProbe := &v1.Probe{
 | 
				
			||||||
			Handler:             execHandler([]string{"/bin/sh", "-c", "sleep 10"}),
 | 
								Handler:             execHandler([]string{"/bin/sh", "-c", "sleep 10"}),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,10 @@ import (
 | 
				
			|||||||
// New local storage types to support local storage capacity isolation
 | 
					// New local storage types to support local storage capacity isolation
 | 
				
			||||||
var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation"
 | 
					var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages"
 | 
					var (
 | 
				
			||||||
 | 
						downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages"
 | 
				
			||||||
 | 
						execProbeTimeout     featuregate.Feature = "ExecProbeTimeout"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func skipInternalf(caller int, format string, args ...interface{}) {
 | 
					func skipInternalf(caller int, format string, args ...interface{}) {
 | 
				
			||||||
	msg := fmt.Sprintf(format, args...)
 | 
						msg := fmt.Sprintf(format, args...)
 | 
				
			||||||
@@ -145,6 +148,12 @@ func SkipUnlessDownwardAPIHugePagesEnabled() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func SkipUnlessExecProbeTimeoutEnabled() {
 | 
				
			||||||
 | 
						if !utilfeature.DefaultFeatureGate.Enabled(execProbeTimeout) {
 | 
				
			||||||
 | 
							skipInternalf(1, "Only supported when %v feature is enabled", execProbeTimeout)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SkipIfMissingResource skips if the gvr resource is missing.
 | 
					// SkipIfMissingResource skips if the gvr resource is missing.
 | 
				
			||||||
func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
 | 
					func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
 | 
				
			||||||
	resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
 | 
						resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user