mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Remove unused endpointSlicesEnabled fields
This commit is contained in:
parent
91338c13df
commit
07de59ab60
@ -35,36 +35,32 @@ 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
|
namespaceParam string
|
||||||
namespaceParam string
|
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},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
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},
|
namespaceParam: "foo",
|
||||||
namespaceParam: "foo",
|
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},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
nameParam: "bar",
|
||||||
nameParam: "bar",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,49 +96,44 @@ 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
|
expectUpdate []runtime.Object
|
||||||
expectUpdate []runtime.Object
|
initialState []runtime.Object
|
||||||
initialState []runtime.Object
|
namespaceParam string
|
||||||
namespaceParam string
|
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},
|
initialState: []runtime.Object{},
|
||||||
initialState: []runtime.Object{},
|
namespaceParam: endpoints1.Namespace,
|
||||||
namespaceParam: endpoints1.Namespace,
|
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},
|
initialState: []runtime.Object{},
|
||||||
initialState: []runtime.Object{},
|
namespaceParam: endpoints2.Namespace,
|
||||||
namespaceParam: endpoints2.Namespace,
|
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},
|
initialState: []runtime.Object{},
|
||||||
initialState: []runtime.Object{},
|
namespaceParam: endpoints3.Namespace,
|
||||||
namespaceParam: endpoints3.Namespace,
|
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},
|
namespaceParam: endpoints1.Namespace,
|
||||||
namespaceParam: endpoints1.Namespace,
|
endpointsParam: endpoints1,
|
||||||
endpointsParam: endpoints1,
|
|
||||||
|
|
||||||
// We expect the create to be attempted, we just also expect it to fail
|
// We expect the create to be attempted, we just also expect it to fail
|
||||||
expectCreate: []runtime.Object{endpoints1},
|
expectCreate: []runtime.Object{endpoints1},
|
||||||
@ -186,34 +177,31 @@ 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
|
expectUpdate []runtime.Object
|
||||||
expectUpdate []runtime.Object
|
initialState []runtime.Object
|
||||||
initialState []runtime.Object
|
namespaceParam string
|
||||||
namespaceParam string
|
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},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
endpointsParam: endpoints1,
|
||||||
endpointsParam: endpoints1,
|
|
||||||
|
|
||||||
// Even though there's no change, we still expect Update() to be
|
// Even though there's no change, we still expect Update() to be
|
||||||
// called, because this unit test ALWAYS calls Update().
|
// called, because this unit test ALWAYS calls Update().
|
||||||
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},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
endpointsParam: endpoints4,
|
||||||
endpointsParam: endpoints4,
|
|
||||||
|
|
||||||
// When AddressType changes, we Delete+Create the EndpointSlice,
|
// When AddressType changes, we Delete+Create the EndpointSlice,
|
||||||
// so that shows up in expectCreate, not expectUpdate.
|
// so that shows up in expectCreate, not expectUpdate.
|
||||||
@ -221,21 +209,19 @@ 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},
|
initialState: []runtime.Object{endpoints1, epSlice1},
|
||||||
initialState: []runtime.Object{endpoints1, epSlice1},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
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},
|
namespaceParam: "testing",
|
||||||
namespaceParam: "testing",
|
endpointsParam: endpoints3,
|
||||||
endpointsParam: endpoints3,
|
|
||||||
|
|
||||||
// We expect the update to be attempted, we just also expect it to fail
|
// We expect the update to be attempted, we just also expect it to fail
|
||||||
expectUpdate: []runtime.Object{endpoints3},
|
expectUpdate: []runtime.Object{endpoints3},
|
||||||
@ -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{},
|
||||||
|
Loading…
Reference in New Issue
Block a user