@@ -235,6 +235,7 @@ func TestValidateEndpointSlice(t *testing.T) {
235
235
Addresses : generateIPAddresses (1 ),
236
236
Hints : & discovery.EndpointHints {
237
237
ForZones : []discovery.ForZone {{Name : "zone-a" }},
238
+ ForNodes : []discovery.ForNode {{Name : "node-1" }},
238
239
},
239
240
}},
240
241
},
@@ -518,7 +519,7 @@ func TestValidateEndpointSlice(t *testing.T) {
518
519
}},
519
520
},
520
521
},
521
- "invalid-hints " : {
522
+ "invalid-zone-hint " : {
522
523
expectedErrors : 1 ,
523
524
endpointSlice : & discovery.EndpointSlice {
524
525
ObjectMeta : standardMeta ,
@@ -535,7 +536,7 @@ func TestValidateEndpointSlice(t *testing.T) {
535
536
}},
536
537
},
537
538
},
538
- "overlapping-hints" : {
539
+ "overlapping-zone- hints" : {
539
540
expectedErrors : 1 ,
540
541
endpointSlice : & discovery.EndpointSlice {
541
542
ObjectMeta : standardMeta ,
@@ -556,7 +557,7 @@ func TestValidateEndpointSlice(t *testing.T) {
556
557
}},
557
558
},
558
559
},
559
- "too-many-hints" : {
560
+ "too-many-zone- hints" : {
560
561
expectedErrors : 1 ,
561
562
endpointSlice : & discovery.EndpointSlice {
562
563
ObjectMeta : standardMeta ,
@@ -583,6 +584,74 @@ func TestValidateEndpointSlice(t *testing.T) {
583
584
}},
584
585
},
585
586
},
587
+ "invalid-node-hints" : {
588
+ expectedErrors : 2 ,
589
+ endpointSlice : & discovery.EndpointSlice {
590
+ ObjectMeta : standardMeta ,
591
+ AddressType : discovery .AddressTypeIPv4 ,
592
+ Ports : []discovery.EndpointPort {{
593
+ Name : ptr .To ("http" ),
594
+ Protocol : ptr .To (api .ProtocolTCP ),
595
+ }},
596
+ Endpoints : []discovery.Endpoint {{
597
+ Addresses : generateIPAddresses (1 ),
598
+ Hints : & discovery.EndpointHints {
599
+ ForNodes : []discovery.ForNode {
600
+ {Name : "!@#$!@" },
601
+ {Name : "" },
602
+ },
603
+ },
604
+ }},
605
+ },
606
+ },
607
+ "overlapping-node-hints" : {
608
+ expectedErrors : 1 ,
609
+ endpointSlice : & discovery.EndpointSlice {
610
+ ObjectMeta : standardMeta ,
611
+ AddressType : discovery .AddressTypeIPv4 ,
612
+ Ports : []discovery.EndpointPort {{
613
+ Name : ptr .To ("http" ),
614
+ Protocol : ptr .To (api .ProtocolTCP ),
615
+ }},
616
+ Endpoints : []discovery.Endpoint {{
617
+ Addresses : generateIPAddresses (1 ),
618
+ Hints : & discovery.EndpointHints {
619
+ ForNodes : []discovery.ForNode {
620
+ {Name : "node-1" },
621
+ {Name : "node-2" },
622
+ {Name : "node-1" },
623
+ },
624
+ },
625
+ }},
626
+ },
627
+ },
628
+ "too-many-node-hints" : {
629
+ expectedErrors : 1 ,
630
+ endpointSlice : & discovery.EndpointSlice {
631
+ ObjectMeta : standardMeta ,
632
+ AddressType : discovery .AddressTypeIPv4 ,
633
+ Ports : []discovery.EndpointPort {{
634
+ Name : ptr .To ("http" ),
635
+ Protocol : ptr .To (api .ProtocolTCP ),
636
+ }},
637
+ Endpoints : []discovery.Endpoint {{
638
+ Addresses : generateIPAddresses (1 ),
639
+ Hints : & discovery.EndpointHints {
640
+ ForNodes : []discovery.ForNode {
641
+ {Name : "node-1" },
642
+ {Name : "node-2" },
643
+ {Name : "node-3" },
644
+ {Name : "node-4" },
645
+ {Name : "node-5" },
646
+ {Name : "node-6" },
647
+ {Name : "node-7" },
648
+ {Name : "node-8" },
649
+ {Name : "node-9" },
650
+ },
651
+ },
652
+ }},
653
+ },
654
+ },
586
655
"empty-everything" : {
587
656
expectedErrors : 3 ,
588
657
endpointSlice : & discovery.EndpointSlice {},
0 commit comments