Remove unused endpointSlicesEnabled fields

This commit is contained in:
Dan Winship 2022-04-27 14:10:51 -04:00
parent 91338c13df
commit 07de59ab60

View File

@ -35,7 +35,6 @@ func TestEndpointsAdapterGet(t *testing.T) {
endpoints1, _ := generateEndpointsAndSlice("foo", "testing", []int{80, 443}, []string{"10.1.2.3", "10.1.2.4"}) endpoints1, _ := generateEndpointsAndSlice("foo", "testing", []int{80, 443}, []string{"10.1.2.3", "10.1.2.4"})
testCases := map[string]struct { testCases := map[string]struct {
endpointSlicesEnabled bool
expectedError error expectedError error
expectedEndpoints *corev1.Endpoints expectedEndpoints *corev1.Endpoints
initialState []runtime.Object initialState []runtime.Object
@ -43,7 +42,6 @@ func TestEndpointsAdapterGet(t *testing.T) {
nameParam string nameParam string
}{ }{
"single-existing-endpoints": { "single-existing-endpoints": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedEndpoints: endpoints1, expectedEndpoints: endpoints1,
initialState: []runtime.Object{endpoints1}, initialState: []runtime.Object{endpoints1},
@ -51,7 +49,6 @@ func TestEndpointsAdapterGet(t *testing.T) {
nameParam: "foo", nameParam: "foo",
}, },
"wrong-namespace": { "wrong-namespace": {
endpointSlicesEnabled: true,
expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "foo"), expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "foo"),
expectedEndpoints: nil, expectedEndpoints: nil,
initialState: []runtime.Object{endpoints1}, initialState: []runtime.Object{endpoints1},
@ -59,7 +56,6 @@ func TestEndpointsAdapterGet(t *testing.T) {
nameParam: "foo", nameParam: "foo",
}, },
"wrong-name": { "wrong-name": {
endpointSlicesEnabled: true,
expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "bar"), expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "bar"),
expectedEndpoints: nil, expectedEndpoints: nil,
initialState: []runtime.Object{endpoints1}, initialState: []runtime.Object{endpoints1},
@ -100,7 +96,6 @@ func TestEndpointsAdapterCreate(t *testing.T) {
epSlice3.AddressType = discovery.AddressTypeIPv6 epSlice3.AddressType = discovery.AddressTypeIPv6
testCases := map[string]struct { testCases := map[string]struct {
endpointSlicesEnabled bool
expectedError error expectedError error
expectedResult *corev1.Endpoints expectedResult *corev1.Endpoints
expectCreate []runtime.Object expectCreate []runtime.Object
@ -110,7 +105,6 @@ func TestEndpointsAdapterCreate(t *testing.T) {
endpointsParam *corev1.Endpoints endpointsParam *corev1.Endpoints
}{ }{
"single-endpoint": { "single-endpoint": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints1, expectedResult: endpoints1,
expectCreate: []runtime.Object{endpoints1, epSlice1}, expectCreate: []runtime.Object{endpoints1, epSlice1},
@ -119,7 +113,6 @@ func TestEndpointsAdapterCreate(t *testing.T) {
endpointsParam: endpoints1, endpointsParam: endpoints1,
}, },
"single-endpoint-partial-ipv6": { "single-endpoint-partial-ipv6": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints2, expectedResult: endpoints2,
expectCreate: []runtime.Object{endpoints2, epSlice2}, expectCreate: []runtime.Object{endpoints2, epSlice2},
@ -128,7 +121,6 @@ func TestEndpointsAdapterCreate(t *testing.T) {
endpointsParam: endpoints2, endpointsParam: endpoints2,
}, },
"single-endpoint-full-ipv6": { "single-endpoint-full-ipv6": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints3, expectedResult: endpoints3,
expectCreate: []runtime.Object{endpoints3, epSlice3}, expectCreate: []runtime.Object{endpoints3, epSlice3},
@ -137,7 +129,6 @@ func TestEndpointsAdapterCreate(t *testing.T) {
endpointsParam: endpoints3, endpointsParam: endpoints3,
}, },
"existing-endpoint": { "existing-endpoint": {
endpointSlicesEnabled: true,
expectedError: errors.NewAlreadyExists(schema.GroupResource{Group: "", Resource: "endpoints"}, "foo"), expectedError: errors.NewAlreadyExists(schema.GroupResource{Group: "", Resource: "endpoints"}, "foo"),
expectedResult: nil, expectedResult: nil,
initialState: []runtime.Object{endpoints1, epSlice1}, initialState: []runtime.Object{endpoints1, epSlice1},
@ -186,7 +177,6 @@ func TestEndpointsAdapterUpdate(t *testing.T) {
_, epSlice4IPv4 := generateEndpointsAndSlice("foo", "testing", []int{80}, []string{"10.1.2.7", "10.1.2.8"}) _, epSlice4IPv4 := generateEndpointsAndSlice("foo", "testing", []int{80}, []string{"10.1.2.7", "10.1.2.8"})
testCases := map[string]struct { testCases := map[string]struct {
endpointSlicesEnabled bool
expectedError error expectedError error
expectedResult *corev1.Endpoints expectedResult *corev1.Endpoints
expectCreate []runtime.Object expectCreate []runtime.Object
@ -196,7 +186,6 @@ func TestEndpointsAdapterUpdate(t *testing.T) {
endpointsParam *corev1.Endpoints endpointsParam *corev1.Endpoints
}{ }{
"single-existing-endpoints-no-change": { "single-existing-endpoints-no-change": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints1, expectedResult: endpoints1,
initialState: []runtime.Object{endpoints1, epSlice1}, initialState: []runtime.Object{endpoints1, epSlice1},
@ -208,7 +197,6 @@ func TestEndpointsAdapterUpdate(t *testing.T) {
expectUpdate: []runtime.Object{endpoints1}, expectUpdate: []runtime.Object{endpoints1},
}, },
"existing-endpointslice-replaced-with-updated-ipv4-address-type": { "existing-endpointslice-replaced-with-updated-ipv4-address-type": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints4, expectedResult: endpoints4,
initialState: []runtime.Object{endpoints4, epSlice4IP}, initialState: []runtime.Object{endpoints4, epSlice4IP},
@ -221,7 +209,6 @@ func TestEndpointsAdapterUpdate(t *testing.T) {
expectCreate: []runtime.Object{epSlice4IPv4}, expectCreate: []runtime.Object{epSlice4IPv4},
}, },
"add-ports-and-ips": { "add-ports-and-ips": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedResult: endpoints2, expectedResult: endpoints2,
expectUpdate: []runtime.Object{endpoints2, epSlice2}, expectUpdate: []runtime.Object{endpoints2, epSlice2},
@ -230,7 +217,6 @@ func TestEndpointsAdapterUpdate(t *testing.T) {
endpointsParam: endpoints2, endpointsParam: endpoints2,
}, },
"missing-endpoints": { "missing-endpoints": {
endpointSlicesEnabled: true,
expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "bar"), expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "bar"),
expectedResult: nil, expectedResult: nil,
initialState: []runtime.Object{endpoints1, epSlice1}, initialState: []runtime.Object{endpoints1, epSlice1},
@ -316,7 +302,6 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) {
endpoints2, epSlice2 := generateEndpointsAndSlice("foo", "testing", []int{80, 443}, []string{"10.1.2.3", "10.1.2.4", "10.1.2.5"}) endpoints2, epSlice2 := generateEndpointsAndSlice("foo", "testing", []int{80, 443}, []string{"10.1.2.3", "10.1.2.4", "10.1.2.5"})
testCases := map[string]struct { testCases := map[string]struct {
endpointSlicesEnabled bool
expectedError error expectedError error
expectedEndpointSlice *discovery.EndpointSlice expectedEndpointSlice *discovery.EndpointSlice
initialState []runtime.Object initialState []runtime.Object
@ -324,7 +309,6 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) {
endpointsParam *corev1.Endpoints endpointsParam *corev1.Endpoints
}{ }{
"existing-endpointslice-no-change": { "existing-endpointslice-no-change": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedEndpointSlice: epSlice1, expectedEndpointSlice: epSlice1,
initialState: []runtime.Object{epSlice1}, initialState: []runtime.Object{epSlice1},
@ -332,7 +316,6 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) {
endpointsParam: endpoints1, endpointsParam: endpoints1,
}, },
"existing-endpointslice-change": { "existing-endpointslice-change": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedEndpointSlice: epSlice2, expectedEndpointSlice: epSlice2,
initialState: []runtime.Object{epSlice1}, initialState: []runtime.Object{epSlice1},
@ -340,7 +323,6 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) {
endpointsParam: endpoints2, endpointsParam: endpoints2,
}, },
"missing-endpointslice": { "missing-endpointslice": {
endpointSlicesEnabled: true,
expectedError: nil, expectedError: nil,
expectedEndpointSlice: epSlice1, expectedEndpointSlice: epSlice1,
initialState: []runtime.Object{}, initialState: []runtime.Object{},