From ac626f8abcb3b041494db61ce0bfa5313c900d9d Mon Sep 17 00:00:00 2001 From: kidddddddddddddddddddddd <1062602710@qq.com> Date: Wed, 15 Mar 2023 09:47:10 +0800 Subject: [PATCH] remove test in strategy_test --- .../networking/ingress/strategy_test.go | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/pkg/registry/networking/ingress/strategy_test.go b/pkg/registry/networking/ingress/strategy_test.go index 082eda85487..2fd552ae0fe 100644 --- a/pkg/registry/networking/ingress/strategy_test.go +++ b/pkg/registry/networking/ingress/strategy_test.go @@ -17,14 +17,11 @@ limitations under the License. package ingress import ( - "fmt" "testing" - "github.com/google/go-cmp/cmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/kubernetes/pkg/apis/networking" - utilpointer "k8s.io/utils/pointer" ) func newIngress() networking.Ingress { @@ -141,62 +138,3 @@ func TestIngressStatusStrategy(t *testing.T) { t.Errorf("Unexpected error %v", errs) } } - -func TestWarningsOnCreate(t *testing.T) { - ctx := genericapirequest.NewDefaultContext() - if !StatusStrategy.NamespaceScoped() { - t.Errorf("Ingress must be namespace scoped") - } - if StatusStrategy.AllowCreateOnUpdate() { - t.Errorf("Ingress should not allow create on update") - } - - serviceBackend := &networking.IngressServiceBackend{ - Name: "defaultbackend", - Port: networking.ServiceBackendPort{ - Number: 80, - }, - } - defaultBackend := networking.IngressBackend{ - Service: serviceBackend, - } - baseIngress := &networking.Ingress{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test123", - Namespace: "test123", - ResourceVersion: "1234", - }, - Spec: networking.IngressSpec{ - DefaultBackend: &defaultBackend, - Rules: []networking.IngressRule{}, - }, - } - - testCases := map[string]struct { - tweakIngress func(ingress *networking.Ingress) - expectedWarnings []string - }{ - "ingressClass annotation set, IngressClassName not set": { - tweakIngress: func(ingress *networking.Ingress) { - ingress.Annotations = map[string]string{annotationIngressClass: "foo"} - }, - expectedWarnings: []string{fmt.Sprintf("annotation %q is deprecated, please use 'spec.ingressClassName' instead", annotationIngressClass)}, - }, - "IngressClassName set": { - tweakIngress: func(ingress *networking.Ingress) { - ingress.Spec.IngressClassName = utilpointer.String("foo") - }, - }, - } - - for name, testCase := range testCases { - t.Run(name, func(t *testing.T) { - newIngress := baseIngress.DeepCopy() - testCase.tweakIngress(newIngress) - warnings := Strategy.WarningsOnCreate(ctx, newIngress) - if diff := cmp.Diff(warnings, testCase.expectedWarnings); diff != "" { - t.Errorf("warings does not match (-want,+got):\n%s", diff) - } - }) - } -}