@@ -223,6 +223,28 @@ func TestCollectServiceNodePorts(t *testing.T) {
223
223
},
224
224
expected : []int {111 , 112 , 113 },
225
225
},
226
+ {
227
+ name : "duplicated nodePort with TCP protocol" ,
228
+ serviceSpec : corev1.ServiceSpec {
229
+ Ports : []corev1.ServicePort {
230
+ {NodePort : 111 , Protocol : corev1 .ProtocolTCP },
231
+ {NodePort : 111 , Protocol : corev1 .ProtocolTCP },
232
+ {NodePort : 112 , Protocol : corev1 .ProtocolUDP },
233
+ },
234
+ },
235
+ expected : []int {111 , 111 , 112 },
236
+ },
237
+ {
238
+ name : "duplicated nodePort with UDP protocol" ,
239
+ serviceSpec : corev1.ServiceSpec {
240
+ Ports : []corev1.ServicePort {
241
+ {NodePort : 111 , Protocol : corev1 .ProtocolUDP },
242
+ {NodePort : 111 , Protocol : corev1 .ProtocolUDP },
243
+ {NodePort : 112 , Protocol : corev1 .ProtocolTCP },
244
+ },
245
+ },
246
+ expected : []int {111 , 111 , 112 },
247
+ },
226
248
{
227
249
name : "duplicated nodePort with different protocol" ,
228
250
serviceSpec : corev1.ServiceSpec {
@@ -257,7 +279,7 @@ func TestCollectServiceNodePorts(t *testing.T) {
257
279
expected : []int {111 , 112 },
258
280
},
259
281
{
260
- name : "nodePort has same protocol with duplicated health check port" ,
282
+ name : "nodePort has same protocol as duplicated health check port" ,
261
283
serviceSpec : corev1.ServiceSpec {
262
284
Ports : []corev1.ServicePort {
263
285
{NodePort : 111 , Protocol : corev1 .ProtocolUDP },
0 commit comments