Merge pull request #122823 from pohly/e2e-deadcode-removal

e2e: remove dead code
This commit is contained in:
Kubernetes Prow Robot 2024-01-17 22:42:51 +01:00 committed by GitHub
commit 2624e93d55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1 additions and 61 deletions

View File

@ -38,7 +38,6 @@ import (
"time"
compute "google.golang.org/api/compute/v1"
"k8s.io/klog/v2"
netutils "k8s.io/utils/net"
appsv1 "k8s.io/api/apps/v1"
@ -125,19 +124,6 @@ type TestLogger interface {
Errorf(format string, args ...interface{})
}
// GLogger is test logger.
type GLogger struct{}
// Infof outputs log with info level.
func (l *GLogger) Infof(format string, args ...interface{}) {
klog.Infof(format, args...)
}
// Errorf outputs log with error level.
func (l *GLogger) Errorf(format string, args ...interface{}) {
klog.Errorf(format, args...)
}
// E2ELogger is test logger.
type E2ELogger struct{}

View File

@ -518,11 +518,6 @@ func WaitForPodSuccessInNamespace(ctx context.Context, c clientset.Interface, po
return WaitForPodSuccessInNamespaceTimeout(ctx, c, podName, namespace, podStartTimeout)
}
// WaitForPodSuccessInNamespaceSlow returns nil if the pod reached state success, or an error if it reached failure or until slowPodStartupTimeout.
func WaitForPodSuccessInNamespaceSlow(ctx context.Context, c clientset.Interface, podName string, namespace string) error {
return WaitForPodSuccessInNamespaceTimeout(ctx, c, podName, namespace, slowPodStartTimeout)
}
// WaitForPodNotFoundInNamespace returns an error if it takes too long for the pod to fully terminate.
// Unlike `waitForPodTerminatedInNamespace`, the pod's Phase and Reason are ignored. If the pod Get
// api returns IsNotFound then the wait stops and nil is returned. If the Get api returns an error other

View File

@ -22,13 +22,10 @@ import (
"github.com/onsi/ginkgo/v2"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
utilversion "k8s.io/apimachinery/pkg/util/version"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/component-base/featuregate"
"k8s.io/kubernetes/test/e2e/framework"
@ -85,34 +82,6 @@ func SkipUnlessFeatureGateEnabled(gate featuregate.Feature) {
}
}
// SkipIfFeatureGateEnabled skips if the feature is enabled.
//
// Beware that this only works in test suites that have a --feature-gate
// parameter and call InitFeatureGates. In test/e2e, the `Feature: XYZ` tag
// has to be used instead and invocations have to make sure that they
// only run tests that work with the given test cluster.
func SkipIfFeatureGateEnabled(gate featuregate.Feature) {
if featureGate == nil {
framework.Failf("Feature gate checking is not enabled, don't use SkipFeatureGateEnabled(%v). Instead use the Feature tag.", gate)
}
if featureGate.Enabled(gate) {
skipInternalf(1, "Only supported when %v feature is disabled", gate)
}
}
// SkipIfMissingResource skips if the gvr resource is missing.
func SkipIfMissingResource(ctx context.Context, dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
_, err := resourceClient.List(ctx, 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.
func SkipUnlessNodeCountIsAtLeast(minNodeCount int) {
if framework.TestContext.CloudConfig.NumNodes < minNodeCount {
@ -230,16 +199,6 @@ func SkipIfAppArmorNotSupported() {
SkipUnlessNodeOSDistroIs(AppArmorDistros...)
}
// RunIfSystemSpecNameIs runs if the system spec name is included in the names.
func RunIfSystemSpecNameIs(names ...string) {
for _, name := range names {
if name == framework.TestContext.SystemSpecName {
return
}
}
skipInternalf(1, "Skipped because system spec name %q is not in %v", framework.TestContext.SystemSpecName, names)
}
// SkipUnlessComponentRunsAsPodsAndClientCanDeleteThem run if the component run as pods and client can delete them
func SkipUnlessComponentRunsAsPodsAndClientCanDeleteThem(ctx context.Context, componentName string, c clientset.Interface, ns string, labelSet labels.Set) {
// verify if component run as pod

View File

@ -162,7 +162,7 @@ func main() {
// Setting up a localized scale test framework.
f := scale.NewIngressScaleFramework(cs, ns.Name, cloudConfig)
f.Logger = &e2eingress.GLogger{}
f.Logger = &e2eingress.E2ELogger{}
// Customizing scale test.
f.EnableTLS = enableTLS
f.OutputFile = outputFile