func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEndpoints, numSlices int) ([]discoveryv1beta1.EndpointSlice, bool) {
	listOptions := metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", discoveryv1beta1.LabelServiceName, svcName)}
	esList, err := cs.DiscoveryV1beta1().EndpointSlices(ns).List(context.TODO(), listOptions)
	framework.ExpectNoError(err, "Error fetching EndpointSlice for Service %s/%s", ns, svcName)

	if len(esList.Items) == 0 {
		framework.Logf("EndpointSlice for Service %s/%s not found", ns, svcName)
		return []discoveryv1beta1.EndpointSlice{}, false
	}
	if len(esList.Items) != numSlices {
		framework.Logf("Expected %d EndpointSlices for Service %s/%s, got %d", numSlices, ns, svcName, len(esList.Items))
		return []discoveryv1beta1.EndpointSlice{}, false
	}

	actualNumEndpoints := 0
	for _, endpointSlice := range esList.Items {
		actualNumEndpoints += len(endpointSlice.Endpoints)
	}
	if actualNumEndpoints != numEndpoints {
		framework.Logf("EndpointSlices for %s/%s Service have %d/%d endpoints", ns, svcName, actualNumEndpoints, numEndpoints)
		return []discoveryv1beta1.EndpointSlice{}, false
	}

	return esList.Items, true
}
// hasMatchingEndpointSlices returns any EndpointSlices that match the
// conditions along with a boolean indicating if all the conditions have been
// met.
hasMatchingEndpointSlices returns any EndpointSlices that match the
conditions along with a boolean indicating if all the conditions have been
met.
// hasMatchingEndpointSlices returns any EndpointSlices that match the // conditions along with a boolean indicating if all the conditions have been // met .
func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEndpoints, numSlices int) ([]discoveryv1beta1.EndpointSlice, bool) {
	listOptions := metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", discoveryv1beta1.LabelServiceName, svcName)}
	esList, err := cs.DiscoveryV1beta1().EndpointSlices(ns).List(context.TODO(), listOptions)
	framework.ExpectNoError(err, "Error fetching EndpointSlice for Service %s/%s", ns, svcName)
	if len(esList.Items) == 0 {
		framework.Logf("EndpointSlice for Service %s/%s not found", ns, svcName)
		return []discoveryv1beta1.EndpointSlice{}, false
	}
	if len(esList.Items) != numSlices {
		framework.Logf("Expected %d EndpointSlices for Service %s/%s, got %d", numSlices, ns, svcName, len(esList.Items))
		return []discoveryv1beta1.EndpointSlice{}, false
	}
	actualNumEndpoints := 0
	for _, endpointSlice := range esList.Items {
		actualNumEndpoints += len(endpointSlice.Endpoints)
	}
	if actualNumEndpoints != numEndpoints {
		framework.Logf("EndpointSlices for %s/%s Service have %d/%d endpoints", ns, svcName, actualNumEndpoints, numEndpoints)
		return []discoveryv1beta1.EndpointSlice{}, false
	}
	return esList.Items, true
}
func hasMatchingEndpointSlices ( cs clientset . Interface , ns , svcName string , numEndpoints , numSlices int ) ( [ ] discoveryv1beta1 . EndpointSlice , bool ) { listOptions := metav1 . ListOptions { LabelSelector : fmt . Sprintf ( " " , discoveryv1beta1 . LabelServiceName , svcName ) } esList , err := cs . DiscoveryV1beta1 ( ) . EndpointSlices ( ns ) . List ( context . TODO ( ) , listOptions ) framework . ExpectNoError ( err , " " , ns , svcName ) if len ( esList . Items ) == 0 { framework . Logf ( " " , ns , svcName ) return [ ] discoveryv1beta1 . EndpointSlice { } , false } if len ( esList . Items ) != numSlices { framework . Logf ( " " , numSlices , ns , svcName , len ( esList . Items ) ) return [ ] discoveryv1beta1 . EndpointSlice { } , false } actualNumEndpoints := 0 for _ , endpointSlice := range esList . Items { actualNumEndpoints += len ( endpointSlice . Endpoints ) } if actualNumEndpoints != numEndpoints { framework . Logf ( " " , ns , svcName , actualNumEndpoints , numEndpoints ) return [ ] discoveryv1beta1 . EndpointSlice { } , false } return esList . Items , true }
hasMatchingEndpointSlices returns any EndpointSlices that match the
conditions along with a boolean indicating if all the conditions have been
met.
hasMatchingEndpointSlices returns any EndpointSlices that match the conditions along with a boolean indicating if all the conditions have been met .