@@ -383,6 +383,33 @@ func TestSyncEndpointsProtocolTCP(t *testing.T) {
383
383
endpointsHandler .ValidateRequest (t , "/api/v1/namespaces/" + ns + "/endpoints/foo" , "PUT" , & data )
384
384
}
385
385
386
+ func TestSyncEndpointsHeadlessServiceLabel (t * testing.T ) {
387
+ ns := metav1 .NamespaceDefault
388
+ testServer , endpointsHandler := makeTestServer (t , ns )
389
+ defer testServer .Close ()
390
+ endpoints := newController (testServer .URL , 0 * time .Second )
391
+ endpoints .endpointsStore .Add (& v1.Endpoints {
392
+ ObjectMeta : metav1.ObjectMeta {
393
+ Name : "foo" ,
394
+ Namespace : ns ,
395
+ ResourceVersion : "1" ,
396
+ Labels : map [string ]string {
397
+ v1 .IsHeadlessService : "" ,
398
+ },
399
+ },
400
+ Subsets : []v1.EndpointSubset {},
401
+ })
402
+ endpoints .serviceStore .Add (& v1.Service {
403
+ ObjectMeta : metav1.ObjectMeta {Name : "foo" , Namespace : ns },
404
+ Spec : v1.ServiceSpec {
405
+ Selector : map [string ]string {"foo" : "bar" },
406
+ Ports : []v1.ServicePort {{Port : 80 }},
407
+ },
408
+ })
409
+ endpoints .syncService (ns + "/foo" )
410
+ endpointsHandler .ValidateRequestCount (t , 0 )
411
+ }
412
+
386
413
func TestSyncEndpointsProtocolUDP (t * testing.T ) {
387
414
ns := "other"
388
415
testServer , endpointsHandler := makeTestServer (t , ns )
0 commit comments