Merge pull request #87358 from tanjunchen/use-e2eskipper-final

test/e2e/framework: remove skip.go and use e2eskipper subpackage
This commit is contained in:
Kubernetes Prow Robot 2020-02-05 19:47:33 -08:00 committed by GitHub
commit 641321c94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 219 additions and 268 deletions

View File

@ -17,7 +17,6 @@ go_library(
"psp.go", "psp.go",
"resource_usage_gatherer.go", "resource_usage_gatherer.go",
"size.go", "size.go",
"skip.go",
"test_context.go", "test_context.go",
"util.go", "util.go",
], ],
@ -27,7 +26,6 @@ go_library(
"//pkg/api/v1/pod:go_default_library", "//pkg/api/v1/pod:go_default_library",
"//pkg/client/conditions:go_default_library", "//pkg/client/conditions:go_default_library",
"//pkg/controller:go_default_library", "//pkg/controller:go_default_library",
"//pkg/features:go_default_library",
"//pkg/kubelet/apis/config:go_default_library", "//pkg/kubelet/apis/config:go_default_library",
"//pkg/kubelet/apis/stats/v1alpha1:go_default_library", "//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
"//pkg/kubelet/events:go_default_library", "//pkg/kubelet/events:go_default_library",
@ -49,11 +47,9 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/yaml:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library", "//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/discovery:go_default_library", "//staging/src/k8s.io/client-go/discovery:go_default_library",
"//staging/src/k8s.io/client-go/discovery/cached/memory:go_default_library", "//staging/src/k8s.io/client-go/discovery/cached/memory:go_default_library",
"//staging/src/k8s.io/client-go/dynamic:go_default_library", "//staging/src/k8s.io/client-go/dynamic:go_default_library",

View File

@ -1,185 +0,0 @@
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file will be removed after switching to use subpackage skipper.
package framework
import (
"fmt"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
utilversion "k8s.io/apimachinery/pkg/util/version"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/features"
// TODO: Remove the following imports (ref: https://github.com/kubernetes/kubernetes/issues/81245)
"k8s.io/kubernetes/test/e2e/framework/ginkgowrapper"
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
)
func skipInternalf(caller int, format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
log("INFO", msg)
ginkgowrapper.Skip(msg, caller+1)
}
// Skipf skips with information about why the test is being skipped.
func Skipf(format string, args ...interface{}) {
skipInternalf(1, format, args...)
}
// SkipUnlessAtLeast skips if the value is less than the minValue.
func SkipUnlessAtLeast(value int, minValue int, message string) {
if value < minValue {
skipInternalf(1, message)
}
}
// SkipUnlessLocalEphemeralStorageEnabled skips if the LocalStorageCapacityIsolation is not enabled.
func SkipUnlessLocalEphemeralStorageEnabled() {
if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
skipInternalf(1, "Only supported when %v feature is enabled", features.LocalStorageCapacityIsolation)
}
}
// SkipIfMissingResource skips if the gvr resource is missing.
func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
_, err := resourceClient.List(metav1.ListOptions{})
if err != nil {
// not all resources support list, so we ignore those
if apierrors.IsMethodNotSupported(err) || apierrors.IsNotFound(err) || apierrors.IsForbidden(err) {
skipInternalf(1, "Could not find %s resource, skipping test: %#v", gvr, err)
}
Failf("Unexpected error getting %v: %v", gvr, err)
}
}
// SkipUnlessNodeCountIsAtLeast skips if the number of nodes is less than the minNodeCount.
func SkipUnlessNodeCountIsAtLeast(minNodeCount int) {
if TestContext.CloudConfig.NumNodes < minNodeCount {
skipInternalf(1, "Requires at least %d nodes (not %d)", minNodeCount, TestContext.CloudConfig.NumNodes)
}
}
// SkipUnlessNodeCountIsAtMost skips if the number of nodes is greater than the maxNodeCount.
func SkipUnlessNodeCountIsAtMost(maxNodeCount int) {
if TestContext.CloudConfig.NumNodes > maxNodeCount {
skipInternalf(1, "Requires at most %d nodes (not %d)", maxNodeCount, TestContext.CloudConfig.NumNodes)
}
}
// SkipIfProviderIs skips if the provider is included in the unsupportedProviders.
func SkipIfProviderIs(unsupportedProviders ...string) {
if ProviderIs(unsupportedProviders...) {
skipInternalf(1, "Not supported for providers %v (found %s)", unsupportedProviders, TestContext.Provider)
}
}
// SkipUnlessProviderIs skips if the provider is not included in the supportedProviders.
func SkipUnlessProviderIs(supportedProviders ...string) {
if !ProviderIs(supportedProviders...) {
skipInternalf(1, "Only supported for providers %v (not %s)", supportedProviders, TestContext.Provider)
}
}
// SkipUnlessMultizone skips if the cluster does not have multizone.
func SkipUnlessMultizone(c clientset.Interface) {
zones, err := GetClusterZones(c)
if err != nil {
skipInternalf(1, "Error listing cluster zones")
}
if zones.Len() <= 1 {
skipInternalf(1, "Requires more than one zone")
}
}
// SkipIfMultizone skips if the cluster has multizone.
func SkipIfMultizone(c clientset.Interface) {
zones, err := GetClusterZones(c)
if err != nil {
skipInternalf(1, "Error listing cluster zones")
}
if zones.Len() > 1 {
skipInternalf(1, "Requires at most one zone")
}
}
// SkipUnlessMasterOSDistroIs skips if the master OS distro is not included in the supportedMasterOsDistros.
func SkipUnlessMasterOSDistroIs(supportedMasterOsDistros ...string) {
if !MasterOSDistroIs(supportedMasterOsDistros...) {
skipInternalf(1, "Only supported for master OS distro %v (not %s)", supportedMasterOsDistros, TestContext.MasterOSDistro)
}
}
// SkipUnlessNodeOSDistroIs skips if the node OS distro is not included in the supportedNodeOsDistros.
func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) {
if !NodeOSDistroIs(supportedNodeOsDistros...) {
skipInternalf(1, "Only supported for node OS distro %v (not %s)", supportedNodeOsDistros, TestContext.NodeOSDistro)
}
}
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) {
if NodeOSDistroIs(unsupportedNodeOsDistros...) {
skipInternalf(1, "Not supported for node OS distro %v (is %s)", unsupportedNodeOsDistros, TestContext.NodeOSDistro)
}
}
// SkipUnlessServerVersionGTE skips if the server version is less than v.
func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) {
gte, err := serverVersionGTE(v, c)
if err != nil {
Failf("Failed to get server version: %v", err)
}
if !gte {
skipInternalf(1, "Not supported for server versions before %q", v)
}
}
// SkipUnlessSSHKeyPresent skips if no SSH key is found.
func SkipUnlessSSHKeyPresent() {
if _, err := e2essh.GetSigner(TestContext.Provider); err != nil {
skipInternalf(1, "No SSH Key for provider %s: '%v'", TestContext.Provider, err)
}
}
// serverVersionGTE returns true if v is greater than or equal to the server version.
func serverVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) (bool, error) {
serverVersion, err := c.ServerVersion()
if err != nil {
return false, fmt.Errorf("Unable to get server version: %v", err)
}
sv, err := utilversion.ParseSemantic(serverVersion.GitVersion)
if err != nil {
return false, fmt.Errorf("Unable to parse server version %q: %v", serverVersion.GitVersion, err)
}
return sv.AtLeast(v), nil
}
// AppArmorDistros are distros with AppArmor support
var AppArmorDistros = []string{"gci", "ubuntu"}
// SkipIfAppArmorNotSupported skips if the AppArmor is not supported by the node OS distro.
func SkipIfAppArmorNotSupported() {
SkipUnlessNodeOSDistroIs(AppArmorDistros...)
}

View File

@ -5,7 +5,20 @@ go_library(
srcs = ["skipper.go"], srcs = ["skipper.go"],
importpath = "k8s.io/kubernetes/test/e2e/framework/skipper", importpath = "k8s.io/kubernetes/test/e2e/framework/skipper",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//test/e2e/framework:go_default_library"], deps = [
"//pkg/features:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/discovery:go_default_library",
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/framework/ginkgowrapper:go_default_library",
"//test/e2e/framework/ssh:go_default_library",
],
) )
filegroup( filegroup(

View File

@ -17,57 +17,189 @@ limitations under the License.
package skipper package skipper
import ( import (
// TODO: Move function logic from framework after all callers switch to use this package "fmt"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
utilversion "k8s.io/apimachinery/pkg/util/version"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework/ginkgowrapper"
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
) )
// TestContext should be used by all tests to access common context data.
var TestContext framework.TestContextType
func skipInternalf(caller int, format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
framework.Logf("INFO", msg)
ginkgowrapper.Skip(msg, caller+1)
}
// Skipf skips with information about why the test is being skipped. // Skipf skips with information about why the test is being skipped.
var Skipf = framework.Skipf func Skipf(format string, args ...interface{}) {
skipInternalf(1, format, args...)
}
// SkipUnlessAtLeast skips if the value is less than the minValue. // SkipUnlessAtLeast skips if the value is less than the minValue.
var SkipUnlessAtLeast = framework.SkipUnlessAtLeast func SkipUnlessAtLeast(value int, minValue int, message string) {
if value < minValue {
skipInternalf(1, message)
}
}
// SkipUnlessLocalEphemeralStorageEnabled skips if the LocalStorageCapacityIsolation is not enabled. // SkipUnlessLocalEphemeralStorageEnabled skips if the LocalStorageCapacityIsolation is not enabled.
var SkipUnlessLocalEphemeralStorageEnabled = framework.SkipUnlessLocalEphemeralStorageEnabled func SkipUnlessLocalEphemeralStorageEnabled() {
if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
skipInternalf(1, "Only supported when %v feature is enabled", features.LocalStorageCapacityIsolation)
}
}
// SkipIfMissingResource skips if the gvr resource is missing. // SkipIfMissingResource skips if the gvr resource is missing.
var SkipIfMissingResource = framework.SkipIfMissingResource func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
_, err := resourceClient.List(metav1.ListOptions{})
if err != nil {
// not all resources support list, so we ignore those
if apierrors.IsMethodNotSupported(err) || apierrors.IsNotFound(err) || apierrors.IsForbidden(err) {
skipInternalf(1, "Could not find %s resource, skipping test: %#v", gvr, err)
}
framework.Failf("Unexpected error getting %v: %v", gvr, err)
}
}
// SkipUnlessNodeCountIsAtLeast skips if the number of nodes is less than the minNodeCount. // SkipUnlessNodeCountIsAtLeast skips if the number of nodes is less than the minNodeCount.
var SkipUnlessNodeCountIsAtLeast = framework.SkipUnlessNodeCountIsAtLeast func SkipUnlessNodeCountIsAtLeast(minNodeCount int) {
if TestContext.CloudConfig.NumNodes < minNodeCount {
skipInternalf(1, "Requires at least %d nodes (not %d)", minNodeCount, TestContext.CloudConfig.NumNodes)
}
}
// SkipUnlessNodeCountIsAtMost skips if the number of nodes is greater than the maxNodeCount. // SkipUnlessNodeCountIsAtMost skips if the number of nodes is greater than the maxNodeCount.
var SkipUnlessNodeCountIsAtMost = framework.SkipUnlessNodeCountIsAtMost func SkipUnlessNodeCountIsAtMost(maxNodeCount int) {
if TestContext.CloudConfig.NumNodes > maxNodeCount {
skipInternalf(1, "Requires at most %d nodes (not %d)", maxNodeCount, TestContext.CloudConfig.NumNodes)
}
}
// SkipIfProviderIs skips if the provider is included in the unsupportedProviders. // SkipIfProviderIs skips if the provider is included in the unsupportedProviders.
var SkipIfProviderIs = framework.SkipIfProviderIs func SkipIfProviderIs(unsupportedProviders ...string) {
if framework.ProviderIs(unsupportedProviders...) {
skipInternalf(1, "Not supported for providers %v (found %s)", unsupportedProviders, TestContext.Provider)
}
}
// SkipUnlessProviderIs skips if the provider is not included in the supportedProviders. // SkipUnlessProviderIs skips if the provider is not included in the supportedProviders.
var SkipUnlessProviderIs = framework.SkipUnlessProviderIs func SkipUnlessProviderIs(supportedProviders ...string) {
if !framework.ProviderIs(supportedProviders...) {
skipInternalf(1, "Only supported for providers %v (not %s)", supportedProviders, TestContext.Provider)
}
}
// SkipUnlessMultizone skips if the cluster does not have multizone. // SkipUnlessMultizone skips if the cluster does not have multizone.
var SkipUnlessMultizone = framework.SkipUnlessMultizone func SkipUnlessMultizone(c clientset.Interface) {
zones, err := framework.GetClusterZones(c)
if err != nil {
skipInternalf(1, "Error listing cluster zones")
}
if zones.Len() <= 1 {
skipInternalf(1, "Requires more than one zone")
}
}
// SkipIfMultizone skips if the cluster has multizone. // SkipIfMultizone skips if the cluster has multizone.
var SkipIfMultizone = framework.SkipIfMultizone func SkipIfMultizone(c clientset.Interface) {
zones, err := framework.GetClusterZones(c)
if err != nil {
skipInternalf(1, "Error listing cluster zones")
}
if zones.Len() > 1 {
skipInternalf(1, "Requires at most one zone")
}
}
// SkipUnlessMasterOSDistroIs skips if the master OS distro is not included in the supportedMasterOsDistros. // SkipUnlessMasterOSDistroIs skips if the master OS distro is not included in the supportedMasterOsDistros.
var SkipUnlessMasterOSDistroIs = framework.SkipUnlessMasterOSDistroIs func SkipUnlessMasterOSDistroIs(supportedMasterOsDistros ...string) {
if !framework.MasterOSDistroIs(supportedMasterOsDistros...) {
skipInternalf(1, "Only supported for master OS distro %v (not %s)", supportedMasterOsDistros, TestContext.MasterOSDistro)
}
}
// SkipUnlessNodeOSDistroIs skips if the node OS distro is not included in the supportedNodeOsDistros. // SkipUnlessNodeOSDistroIs skips if the node OS distro is not included in the supportedNodeOsDistros.
var SkipUnlessNodeOSDistroIs = framework.SkipUnlessNodeOSDistroIs func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) {
if !framework.NodeOSDistroIs(supportedNodeOsDistros...) {
skipInternalf(1, "Only supported for node OS distro %v (not %s)", supportedNodeOsDistros, TestContext.NodeOSDistro)
}
}
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros. // SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
var SkipIfNodeOSDistroIs = framework.SkipIfNodeOSDistroIs func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) {
if framework.NodeOSDistroIs(unsupportedNodeOsDistros...) {
skipInternalf(1, "Not supported for node OS distro %v (is %s)", unsupportedNodeOsDistros, TestContext.NodeOSDistro)
}
}
// SkipUnlessServerVersionGTE skips if the server version is less than v. // SkipUnlessServerVersionGTE skips if the server version is less than v.
var SkipUnlessServerVersionGTE = framework.SkipUnlessServerVersionGTE func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) {
gte, err := serverVersionGTE(v, c)
if err != nil {
framework.Failf("Failed to get server version: %v", err)
}
if !gte {
skipInternalf(1, "Not supported for server versions before %q", v)
}
}
// SkipUnlessSSHKeyPresent skips if no SSH key is found. // SkipUnlessSSHKeyPresent skips if no SSH key is found.
var SkipUnlessSSHKeyPresent = framework.SkipUnlessSSHKeyPresent func SkipUnlessSSHKeyPresent() {
if _, err := e2essh.GetSigner(TestContext.Provider); err != nil {
skipInternalf(1, "No SSH Key for provider %s: '%v'", TestContext.Provider, err)
}
}
// serverVersionGTE returns true if v is greater than or equal to the server version.
func serverVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) (bool, error) {
serverVersion, err := c.ServerVersion()
if err != nil {
return false, fmt.Errorf("Unable to get server version: %v", err)
}
sv, err := utilversion.ParseSemantic(serverVersion.GitVersion)
if err != nil {
return false, fmt.Errorf("Unable to parse server version %q: %v", serverVersion.GitVersion, err)
}
return sv.AtLeast(v), nil
}
// AppArmorDistros are distros with AppArmor support // AppArmorDistros are distros with AppArmor support
var AppArmorDistros = framework.AppArmorDistros var AppArmorDistros = []string{"gci", "ubuntu"}
// SkipIfAppArmorNotSupported skips if the AppArmor is not supported by the node OS distro. // SkipIfAppArmorNotSupported skips if the AppArmor is not supported by the node OS distro.
var SkipIfAppArmorNotSupported = framework.SkipIfAppArmorNotSupported func SkipIfAppArmorNotSupported() {
SkipUnlessNodeOSDistroIs(AppArmorDistros...)
}
// RunIfContainerRuntimeIs runs if the container runtime is included in the runtimes.
func RunIfContainerRuntimeIs(runtimes ...string) {
for _, containerRuntime := range runtimes {
if containerRuntime == TestContext.ContainerRuntime {
return
}
}
skipInternalf(1, "Skipped because container runtime %q is not in %s", TestContext.ContainerRuntime, runtimes)
}
// RunIfSystemSpecNameIs runs if the system spec name is included in the names.
func RunIfSystemSpecNameIs(names ...string) {
for _, name := range names {
if name == TestContext.SystemSpecName {
return
}
}
skipInternalf(1, "Skipped because system spec name %q is not in %v", TestContext.SystemSpecName, names)
}

View File

@ -204,26 +204,6 @@ func GetMasterHost() string {
return masterURL.Hostname() return masterURL.Hostname()
} }
// RunIfContainerRuntimeIs runs if the container runtime is included in the runtimes.
func RunIfContainerRuntimeIs(runtimes ...string) {
for _, containerRuntime := range runtimes {
if containerRuntime == TestContext.ContainerRuntime {
return
}
}
skipInternalf(1, "Skipped because container runtime %q is not in %s", TestContext.ContainerRuntime, runtimes)
}
// RunIfSystemSpecNameIs runs if the system spec name is included in the names.
func RunIfSystemSpecNameIs(names ...string) {
for _, name := range names {
if name == TestContext.SystemSpecName {
return
}
}
skipInternalf(1, "Skipped because system spec name %q is not in %v", TestContext.SystemSpecName, names)
}
// ProviderIs returns true if the provider is included is the providers. Otherwise false. // ProviderIs returns true if the provider is included is the providers. Otherwise false.
func ProviderIs(providers ...string) bool { func ProviderIs(providers ...string) bool {
for _, provider := range providers { for _, provider := range providers {

View File

@ -22,9 +22,6 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1 "k8s.io/api/scheduling/v1"
@ -32,14 +29,17 @@ import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos" v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos"
"k8s.io/kubernetes/pkg/apis/scheduling" "k8s.io/kubernetes/pkg/apis/scheduling"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
"k8s.io/kubernetes/test/e2e/framework/replicaset" "k8s.io/kubernetes/test/e2e/framework/replicaset"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -223,7 +223,7 @@ var _ = SIGDescribe("SchedulerPreemption [Serial]", func() {
framework.Logf("Created pod: %v", pods[i].Name) framework.Logf("Created pod: %v", pods[i].Name)
} }
if len(pods) < 2 { if len(pods) < 2 {
framework.Skipf("We need at least two pods to be created but" + e2eskipper.Skipf("We need at least two pods to be created but" +
"all nodes are already heavily utilized, so preemption tests cannot be run") "all nodes are already heavily utilized, so preemption tests cannot be run")
} }
ginkgo.By("Wait for pods to be scheduled.") ginkgo.By("Wait for pods to be scheduled.")

View File

@ -574,7 +574,7 @@ func ensureTopologyRequirements(nodeSelection *e2epod.NodeSelection, nodes *v1.N
} }
} }
if len(suitableTopologies) == 0 { if len(suitableTopologies) == 0 {
framework.Skipf("No topology with at least %d nodes found - skipping", minCount) e2eskipper.Skipf("No topology with at least %d nodes found - skipping", minCount)
} }
// Take the first suitable topology // Take the first suitable topology
e2epod.SetNodeAffinityTopologyRequirement(nodeSelection, suitableTopologies[0]) e2epod.SetNodeAffinityTopologyRequirement(nodeSelection, suitableTopologies[0])

View File

@ -28,7 +28,7 @@ import (
// TestDriver represents an interface for a driver to be tested in TestSuite. // TestDriver represents an interface for a driver to be tested in TestSuite.
// Except for GetDriverInfo, all methods will be called at test runtime and thus // Except for GetDriverInfo, all methods will be called at test runtime and thus
// can use framework.Skipf, framework.Fatal, Gomega assertions, etc. // can use e2eskipper.Skipf, framework.Fatal, Gomega assertions, etc.
type TestDriver interface { type TestDriver interface {
// GetDriverInfo returns DriverInfo for the TestDriver. This must be static // GetDriverInfo returns DriverInfo for the TestDriver. This must be static
// information. // information.

View File

@ -41,6 +41,7 @@ go_library(
"//test/e2e/framework/node:go_default_library", "//test/e2e/framework/node:go_default_library",
"//test/e2e/framework/security:go_default_library", "//test/e2e/framework/security:go_default_library",
"//test/e2e/framework/service:go_default_library", "//test/e2e/framework/service:go_default_library",
"//test/e2e/framework/skipper:go_default_library",
"//test/e2e/framework/statefulset:go_default_library", "//test/e2e/framework/statefulset:go_default_library",
"//test/e2e/framework/testfiles:go_default_library", "//test/e2e/framework/testfiles:go_default_library",
"//test/e2e/scheduling:go_default_library", "//test/e2e/scheduling:go_default_library",

View File

@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl" e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl"
e2esecurity "k8s.io/kubernetes/test/e2e/framework/security" e2esecurity "k8s.io/kubernetes/test/e2e/framework/security"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -39,7 +40,7 @@ func (AppArmorUpgradeTest) Name() string { return "apparmor-upgrade" }
// Skip returns true when this test can be skipped. // Skip returns true when this test can be skipped.
func (AppArmorUpgradeTest) Skip(upgCtx UpgradeContext) bool { func (AppArmorUpgradeTest) Skip(upgCtx UpgradeContext) bool {
supportedImages := make(map[string]bool) supportedImages := make(map[string]bool)
for _, d := range framework.AppArmorDistros { for _, d := range e2eskipper.AppArmorDistros {
supportedImages[d] = true supportedImages[d] = true
} }

View File

@ -194,6 +194,7 @@ go_test(
"//test/e2e/framework/metrics:go_default_library", "//test/e2e/framework/metrics:go_default_library",
"//test/e2e/framework/node:go_default_library", "//test/e2e/framework/node:go_default_library",
"//test/e2e/framework/pod:go_default_library", "//test/e2e/framework/pod:go_default_library",
"//test/e2e/framework/skipper:go_default_library",
"//test/e2e/framework/testfiles:go_default_library", "//test/e2e/framework/testfiles:go_default_library",
"//test/e2e/framework/volume:go_default_library", "//test/e2e/framework/volume:go_default_library",
"//test/e2e_node/perf/workloads:go_default_library", "//test/e2e_node/perf/workloads:go_default_library",

View File

@ -27,6 +27,7 @@ import (
kubelogs "k8s.io/kubernetes/pkg/kubelet/logs" kubelogs "k8s.io/kubernetes/pkg/kubelet/logs"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types" kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -45,7 +46,7 @@ var _ = framework.KubeDescribe("ContainerLogRotation [Slow] [Serial] [Disruptive
ginkgo.Context("when a container generates a lot of log", func() { ginkgo.Context("when a container generates a lot of log", func() {
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
if framework.TestContext.ContainerRuntime != kubetypes.RemoteContainerRuntime { if framework.TestContext.ContainerRuntime != kubetypes.RemoteContainerRuntime {
framework.Skipf("Skipping ContainerLogRotation test since the container runtime is not remote") e2eskipper.Skipf("Skipping ContainerLogRotation test since the container runtime is not remote")
} }
}) })

View File

@ -34,6 +34,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -257,7 +258,7 @@ func runCPUManagerTests(f *framework.Framework) {
// Skip CPU Manager tests altogether if the CPU capacity < 2. // Skip CPU Manager tests altogether if the CPU capacity < 2.
if cpuCap < 2 { if cpuCap < 2 {
framework.Skipf("Skipping CPU Manager tests since the CPU capacity < 2") e2eskipper.Skipf("Skipping CPU Manager tests since the CPU capacity < 2")
} }
// Enable CPU Manager in the kubelet. // Enable CPU Manager in the kubelet.
@ -359,7 +360,7 @@ func runCPUManagerTests(f *framework.Framework) {
// Skip rest of the tests if CPU capacity < 3. // Skip rest of the tests if CPU capacity < 3.
if cpuCap < 3 { if cpuCap < 3 {
framework.Skipf("Skipping rest of the CPU Manager tests since CPU capacity < 3") e2eskipper.Skipf("Skipping rest of the CPU Manager tests since CPU capacity < 3")
} }
ginkgo.By("running a Gu pod requesting multiple CPUs") ginkgo.By("running a Gu pod requesting multiple CPUs")

View File

@ -27,6 +27,7 @@ import (
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
kubelettypes "k8s.io/kubernetes/pkg/kubelet/types" kubelettypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
@ -52,7 +53,7 @@ var _ = framework.KubeDescribe("CriticalPod [Serial] [Disruptive] [NodeFeature:C
configEnabled, err := isKubeletConfigEnabled(f) configEnabled, err := isKubeletConfigEnabled(f)
framework.ExpectNoError(err) framework.ExpectNoError(err)
if !configEnabled { if !configEnabled {
framework.Skipf("unable to run test without dynamic kubelet config enabled.") e2eskipper.Skipf("unable to run test without dynamic kubelet config enabled.")
} }
// because adminssion Priority enable, If the priority class is not found, the Pod is rejected. // because adminssion Priority enable, If the priority class is not found, the Pod is rejected.
node := getNodeName(f) node := getNodeName(f)

View File

@ -24,6 +24,7 @@ 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/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
@ -34,7 +35,7 @@ var _ = framework.KubeDescribe("Docker features [Feature:Docker][Legacy:Docker]"
f := framework.NewDefaultFramework("docker-feature-test") f := framework.NewDefaultFramework("docker-feature-test")
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
framework.RunIfContainerRuntimeIs("docker") e2eskipper.RunIfContainerRuntimeIs("docker")
}) })
ginkgo.Context("when live-restore is enabled [Serial] [Slow] [Disruptive]", func() { ginkgo.Context("when live-restore is enabled [Serial] [Slow] [Disruptive]", func() {
@ -47,12 +48,12 @@ var _ = framework.KubeDescribe("Docker features [Feature:Docker][Legacy:Docker]"
isSupported, err := isDockerLiveRestoreSupported() isSupported, err := isDockerLiveRestoreSupported()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if !isSupported { if !isSupported {
framework.Skipf("Docker live-restore is not supported.") e2eskipper.Skipf("Docker live-restore is not supported.")
} }
isEnabled, err := isDockerLiveRestoreEnabled() isEnabled, err := isDockerLiveRestoreEnabled()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if !isEnabled { if !isEnabled {
framework.Skipf("Docker live-restore is not enabled.") e2eskipper.Skipf("Docker live-restore is not enabled.")
} }
ginkgo.By("Create the test pod.") ginkgo.By("Create the test pod.")

View File

@ -26,14 +26,16 @@ import (
"strings" "strings"
"time" "time"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"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/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
) )
const ( const (
@ -47,7 +49,7 @@ var _ = SIGDescribe("Dockershim [Serial] [Disruptive] [Feature:Docker][Legacy:Do
f := framework.NewDefaultFramework("dockerhism-checkpoint-test") f := framework.NewDefaultFramework("dockerhism-checkpoint-test")
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
framework.RunIfContainerRuntimeIs("docker") e2eskipper.RunIfContainerRuntimeIs("docker")
}) })
ginkgo.It("should clean up pod sandbox checkpoint after pod deletion", func() { ginkgo.It("should clean up pod sandbox checkpoint after pod deletion", func() {

View File

@ -36,6 +36,7 @@ import (
kubeletmetrics "k8s.io/kubernetes/pkg/kubelet/metrics" kubeletmetrics "k8s.io/kubernetes/pkg/kubelet/metrics"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types" kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
testutils "k8s.io/kubernetes/test/utils" testutils "k8s.io/kubernetes/test/utils"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
@ -76,7 +77,7 @@ var _ = framework.KubeDescribe("InodeEviction [Slow] [Serial] [Disruptive][NodeF
summary := eventuallyGetSummary() summary := eventuallyGetSummary()
inodesFree := *summary.Node.Fs.InodesFree inodesFree := *summary.Node.Fs.InodesFree
if inodesFree <= inodesConsumed { if inodesFree <= inodesConsumed {
framework.Skipf("Too few inodes free on the host for the InodeEviction test to run") e2eskipper.Skipf("Too few inodes free on the host for the InodeEviction test to run")
} }
initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsInodesFree): fmt.Sprintf("%d", inodesFree-inodesConsumed)} initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsInodesFree): fmt.Sprintf("%d", inodesFree-inodesConsumed)}
initialConfig.EvictionMinimumReclaim = map[string]string{} initialConfig.EvictionMinimumReclaim = map[string]string{}
@ -112,7 +113,7 @@ var _ = framework.KubeDescribe("ImageGCNoEviction [Slow] [Serial] [Disruptive][N
summary := eventuallyGetSummary() summary := eventuallyGetSummary()
inodesFree := *summary.Node.Fs.InodesFree inodesFree := *summary.Node.Fs.InodesFree
if inodesFree <= inodesConsumed { if inodesFree <= inodesConsumed {
framework.Skipf("Too few inodes free on the host for the InodeEviction test to run") e2eskipper.Skipf("Too few inodes free on the host for the InodeEviction test to run")
} }
initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsInodesFree): fmt.Sprintf("%d", inodesFree-inodesConsumed)} initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsInodesFree): fmt.Sprintf("%d", inodesFree-inodesConsumed)}
initialConfig.EvictionMinimumReclaim = map[string]string{} initialConfig.EvictionMinimumReclaim = map[string]string{}
@ -203,7 +204,7 @@ var _ = framework.KubeDescribe("LocalStorageSoftEviction [Slow] [Serial] [Disrup
summary := eventuallyGetSummary() summary := eventuallyGetSummary()
availableBytes := *(summary.Node.Fs.AvailableBytes) availableBytes := *(summary.Node.Fs.AvailableBytes)
if availableBytes <= uint64(diskConsumed.Value()) { if availableBytes <= uint64(diskConsumed.Value()) {
framework.Skipf("Too little disk free on the host for the LocalStorageSoftEviction test to run") e2eskipper.Skipf("Too little disk free on the host for the LocalStorageSoftEviction test to run")
} }
initialConfig.EvictionSoft = map[string]string{string(evictionapi.SignalNodeFsAvailable): fmt.Sprintf("%d", availableBytes-uint64(diskConsumed.Value()))} initialConfig.EvictionSoft = map[string]string{string(evictionapi.SignalNodeFsAvailable): fmt.Sprintf("%d", availableBytes-uint64(diskConsumed.Value()))}
initialConfig.EvictionSoftGracePeriod = map[string]string{string(evictionapi.SignalNodeFsAvailable): "1m"} initialConfig.EvictionSoftGracePeriod = map[string]string{string(evictionapi.SignalNodeFsAvailable): "1m"}
@ -295,7 +296,7 @@ var _ = framework.KubeDescribe("PriorityMemoryEvictionOrdering [Slow] [Serial] [
summary := eventuallyGetSummary() summary := eventuallyGetSummary()
availableBytes := *(summary.Node.Memory.AvailableBytes) availableBytes := *(summary.Node.Memory.AvailableBytes)
if availableBytes <= uint64(memoryConsumed.Value()) { if availableBytes <= uint64(memoryConsumed.Value()) {
framework.Skipf("Too little memory free on the host for the PriorityMemoryEvictionOrdering test to run") e2eskipper.Skipf("Too little memory free on the host for the PriorityMemoryEvictionOrdering test to run")
} }
initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalMemoryAvailable): fmt.Sprintf("%d", availableBytes-uint64(memoryConsumed.Value()))} initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalMemoryAvailable): fmt.Sprintf("%d", availableBytes-uint64(memoryConsumed.Value()))}
initialConfig.EvictionMinimumReclaim = map[string]string{} initialConfig.EvictionMinimumReclaim = map[string]string{}
@ -352,7 +353,7 @@ var _ = framework.KubeDescribe("PriorityLocalStorageEvictionOrdering [Slow] [Ser
summary := eventuallyGetSummary() summary := eventuallyGetSummary()
availableBytes := *(summary.Node.Fs.AvailableBytes) availableBytes := *(summary.Node.Fs.AvailableBytes)
if availableBytes <= uint64(diskConsumed.Value()) { if availableBytes <= uint64(diskConsumed.Value()) {
framework.Skipf("Too little disk free on the host for the PriorityLocalStorageEvictionOrdering test to run") e2eskipper.Skipf("Too little disk free on the host for the PriorityLocalStorageEvictionOrdering test to run")
} }
initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsAvailable): fmt.Sprintf("%d", availableBytes-uint64(diskConsumed.Value()))} initialConfig.EvictionHard = map[string]string{string(evictionapi.SignalNodeFsAvailable): fmt.Sprintf("%d", availableBytes-uint64(diskConsumed.Value()))}
initialConfig.EvictionMinimumReclaim = map[string]string{} initialConfig.EvictionMinimumReclaim = map[string]string{}

View File

@ -27,6 +27,7 @@ import (
"strings" "strings"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/blang/semver" "github.com/blang/semver"
@ -321,7 +322,7 @@ func checkDockerStorageDriver() error {
var _ = framework.KubeDescribe("GKE system requirements [NodeConformance][Feature:GKEEnv][NodeFeature:GKEEnv]", func() { var _ = framework.KubeDescribe("GKE system requirements [NodeConformance][Feature:GKEEnv][NodeFeature:GKEEnv]", func() {
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
framework.RunIfSystemSpecNameIs("gke") e2eskipper.RunIfSystemSpecNameIs("gke")
}) })
ginkgo.It("The required processes should be running", func() { ginkgo.It("The required processes should be running", func() {
@ -345,21 +346,21 @@ var _ = framework.KubeDescribe("GKE system requirements [NodeConformance][Featur
framework.ExpectNoError(checkPublicGCR()) framework.ExpectNoError(checkPublicGCR())
}) })
ginkgo.It("The docker configuration validation should pass", func() { ginkgo.It("The docker configuration validation should pass", func() {
framework.RunIfContainerRuntimeIs("docker") e2eskipper.RunIfContainerRuntimeIs("docker")
framework.ExpectNoError(checkDockerConfig()) framework.ExpectNoError(checkDockerConfig())
}) })
ginkgo.It("The docker container network should work", func() { ginkgo.It("The docker container network should work", func() {
framework.RunIfContainerRuntimeIs("docker") e2eskipper.RunIfContainerRuntimeIs("docker")
framework.ExpectNoError(checkDockerNetworkServer()) framework.ExpectNoError(checkDockerNetworkServer())
framework.ExpectNoError(checkDockerNetworkClient()) framework.ExpectNoError(checkDockerNetworkClient())
}) })
ginkgo.It("The docker daemon should support AppArmor and seccomp", func() { ginkgo.It("The docker daemon should support AppArmor and seccomp", func() {
framework.RunIfContainerRuntimeIs("docker") e2eskipper.RunIfContainerRuntimeIs("docker")
framework.ExpectNoError(checkDockerAppArmor()) framework.ExpectNoError(checkDockerAppArmor())
framework.ExpectNoError(checkDockerSeccomp()) framework.ExpectNoError(checkDockerSeccomp())
}) })
ginkgo.It("The docker storage driver should work", func() { ginkgo.It("The docker storage driver should work", func() {
framework.Skipf("GKE does not currently require overlay") e2eskipper.Skipf("GKE does not currently require overlay")
framework.ExpectNoError(checkDockerStorageDriver()) framework.ExpectNoError(checkDockerStorageDriver())
}) })
}) })

View File

@ -28,10 +28,10 @@ import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/pkg/kubelet/cm" "k8s.io/kubernetes/pkg/kubelet/cm"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
@ -187,7 +187,7 @@ var _ = SIGDescribe("HugePages [Serial] [Feature:HugePages][NodeFeature:HugePage
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
ginkgo.By("verifying hugepages are supported") ginkgo.By("verifying hugepages are supported")
if !isHugePageSupported() { if !isHugePageSupported() {
framework.Skipf("skipping test because hugepages are not supported") e2eskipper.Skipf("skipping test because hugepages are not supported")
return return
} }
ginkgo.By("configuring the host to reserve a number of pre-allocated hugepages") ginkgo.By("configuring the host to reserve a number of pre-allocated hugepages")

View File

@ -17,7 +17,6 @@ limitations under the License.
package e2enode package e2enode
import ( import (
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1" 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/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
@ -25,6 +24,9 @@ import (
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo"
) )
const ( const (
@ -113,7 +115,7 @@ var _ = framework.KubeDescribe("ContainerLogPath [NodeConformance]", func() {
d, err := getDockerLoggingDriver() d, err := getDockerLoggingDriver()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if d != "json-file" { if d != "json-file" {
framework.Skipf("Skipping because Docker daemon is using a logging driver other than \"json-file\": %s", d) e2eskipper.Skipf("Skipping because Docker daemon is using a logging driver other than \"json-file\": %s", d)
} }
// Even if JSON logging is in use, this test fails if SELinux support // Even if JSON logging is in use, this test fails if SELinux support
// is enabled, since the isolation provided by the SELinux policy // is enabled, since the isolation provided by the SELinux policy
@ -126,7 +128,7 @@ var _ = framework.KubeDescribe("ContainerLogPath [NodeConformance]", func() {
e, err := isDockerSELinuxSupportEnabled() e, err := isDockerSELinuxSupportEnabled()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if e { if e {
framework.Skipf("Skipping because Docker daemon is running with SELinux support enabled") e2eskipper.Skipf("Skipping because Docker daemon is running with SELinux support enabled")
} }
} }

View File

@ -21,9 +21,6 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/onsi/ginkgo"
"k8s.io/utils/mount"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -31,7 +28,11 @@ import (
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
"k8s.io/kubernetes/pkg/volume/util/fsquota" "k8s.io/kubernetes/pkg/volume/util/fsquota"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"k8s.io/utils/mount"
"github.com/onsi/ginkgo"
) )
const ( const (
@ -61,7 +62,7 @@ func runOneQuotaTest(f *framework.Framework, quotasRequested bool) {
if quotasRequested && !supportsQuotas("/var/lib/kubelet") { if quotasRequested && !supportsQuotas("/var/lib/kubelet") {
// No point in running this as a positive test if quotas are not // No point in running this as a positive test if quotas are not
// enabled on the underlying filesystem. // enabled on the underlying filesystem.
framework.Skipf("Cannot run LocalStorageCapacityIsolationQuotaMonitoring on filesystem without project quota enabled") e2eskipper.Skipf("Cannot run LocalStorageCapacityIsolationQuotaMonitoring on filesystem without project quota enabled")
} }
// setting a threshold to 0% disables; non-empty map overrides default value (necessary due to omitempty) // setting a threshold to 0% disables; non-empty map overrides default value (necessary due to omitempty)
initialConfig.EvictionHard = map[string]string{"memory.available": "0%"} initialConfig.EvictionHard = map[string]string{"memory.available": "0%"}

View File

@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
@ -75,7 +76,7 @@ var _ = framework.KubeDescribe("Security Context", func() {
isEnabled, err := isSharedPIDNamespaceSupported() isEnabled, err := isSharedPIDNamespaceSupported()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if !isEnabled { if !isEnabled {
framework.Skipf("Skipped because shared PID namespace is not supported by this docker version.") e2eskipper.Skipf("Skipped because shared PID namespace is not supported by this docker version.")
} }
ginkgo.By("Create a pod with shared PID namespace.") ginkgo.By("Create a pod with shared PID namespace.")

View File

@ -21,15 +21,15 @@ import (
"time" "time"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"
"k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "k8s.io/kubernetes/pkg/kubelet/cm/cpuset"
"k8s.io/kubernetes/pkg/kubelet/cm/topologymanager" "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -232,7 +232,7 @@ func runTopologyManagerSuiteTests(f *framework.Framework) {
// Skip rest of the tests if CPU capacity < 3. // Skip rest of the tests if CPU capacity < 3.
if cpuCap < 3 { if cpuCap < 3 {
framework.Skipf("Skipping rest of the CPU Manager tests since CPU capacity < 3") e2eskipper.Skipf("Skipping rest of the CPU Manager tests since CPU capacity < 3")
} }
ginkgo.By("running a Gu pod requesting multiple CPUs") ginkgo.By("running a Gu pod requesting multiple CPUs")