advancedxy commented on code in PR #530:
URL: https://github.com/apache/incubator-uniffle/pull/530#discussion_r1096919384


##########
deploy/kubernetes/operator/pkg/controller/sync/coordinator/coordinator_test.go:
##########
@@ -210,3 +211,62 @@ func TestGenerateDeploy(t *testing.T) {
                })
        }
 }
+
+// generateServiceCuntMap generates a map with service type and its 
corresponding count. The headless svc is treated
+//   differently: the service type for headless is treated as an empty service.
+func generateServiceCountMap(services []*corev1.Service) 
map[corev1.ServiceType]int {
+       result := make(map[corev1.ServiceType]int)
+       var empty corev1.ServiceType = ""
+       for _, service := range services {
+               sType := service.Spec.Type
+               if (sType == corev1.ServiceTypeClusterIP || sType == empty) && 
service.Spec.ClusterIP == corev1.ClusterIPNone {
+                       result[empty]++
+               } else {
+                       result[service.Spec.Type]++
+               }
+       }
+       return result
+}
+
+func TestGenerateSvcForCoordinator(t *testing.T) {
+       for _, tt := range []struct {
+               name          string
+               rss           *uniffleapi.RemoteShuffleService
+               serviceCntMap map[corev1.ServiceType]int
+       }{
+               {
+                       name: "with RPCNodePort",
+                       rss:  buildRssWithLabels(),
+                       serviceCntMap: map[corev1.ServiceType]int{
+                               "":                         2, // defaults to 
headless service

Review Comment:
   Thought about it. But this is used in the unit test and have different 
semantics with original `ServiceType`. I don't want to introduce a 
variable/constant to bring confusion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to