@@ -84,7 +84,7 @@ func TestEndpointSliceMirroring(t *testing.T) {
84
84
testCases := []struct {
85
85
testName string
86
86
service * corev1.Service
87
- endpoints * corev1.Endpoints
87
+ customEndpoints * corev1.Endpoints
88
88
expectEndpointSlice bool
89
89
expectEndpointSliceManagedBy string
90
90
}{{
@@ -102,11 +102,6 @@ func TestEndpointSliceMirroring(t *testing.T) {
102
102
},
103
103
},
104
104
},
105
- endpoints : & corev1.Endpoints {
106
- ObjectMeta : metav1.ObjectMeta {
107
- Name : "test-123" ,
108
- },
109
- },
110
105
expectEndpointSlice : true ,
111
106
expectEndpointSliceManagedBy : "endpointslice-controller.k8s.io" ,
112
107
}, {
@@ -121,7 +116,7 @@ func TestEndpointSliceMirroring(t *testing.T) {
121
116
}},
122
117
},
123
118
},
124
- endpoints : & corev1.Endpoints {
119
+ customEndpoints : & corev1.Endpoints {
125
120
ObjectMeta : metav1.ObjectMeta {
126
121
Name : "test-123" ,
127
122
},
@@ -151,13 +146,13 @@ func TestEndpointSliceMirroring(t *testing.T) {
151
146
},
152
147
},
153
148
},
154
- endpoints : nil ,
149
+ customEndpoints : nil ,
155
150
expectEndpointSlice : true ,
156
151
expectEndpointSliceManagedBy : "endpointslice-controller.k8s.io" ,
157
152
}, {
158
153
testName : "Endpoints without Service" ,
159
154
service : nil ,
160
- endpoints : & corev1.Endpoints {
155
+ customEndpoints : & corev1.Endpoints {
161
156
ObjectMeta : metav1.ObjectMeta {
162
157
Name : "test-123" ,
163
158
},
@@ -180,10 +175,10 @@ func TestEndpointSliceMirroring(t *testing.T) {
180
175
}
181
176
}
182
177
183
- if tc .endpoints != nil {
184
- resourceName = tc .endpoints .Name
185
- tc .endpoints .Namespace = ns .Name
186
- _ , err = client .CoreV1 ().Endpoints (ns .Name ).Create (context .TODO (), tc .endpoints , metav1.CreateOptions {})
178
+ if tc .customEndpoints != nil {
179
+ resourceName = tc .customEndpoints .Name
180
+ tc .customEndpoints .Namespace = ns .Name
181
+ _ , err = client .CoreV1 ().Endpoints (ns .Name ).Create (context .TODO (), tc .customEndpoints , metav1.CreateOptions {})
187
182
if err != nil {
188
183
t .Fatalf ("Error creating endpoints: %v" , err )
189
184
}
0 commit comments