@@ -21,6 +21,7 @@ import (
2121 "errors"
2222 "fmt"
2323 "maps"
24+ "math"
2425 "strconv"
2526 "strings"
2627 "time"
@@ -122,12 +123,10 @@ var _ = ginkgo.Describe("InferencePool", func() {
122123 ginkgo .When ("The Inference Extension is running" , func () {
123124 ginkgo .It ("Should route traffic to target model servers" , func () {
124125 verifyTrafficRouting ()
125- // Likely needs to be modified
126126 })
127127
128128 ginkgo .It ("Should expose EPP metrics after generating traffic" , func () {
129- verifyMetrics ()
130- // Likely needs to be modified.
129+ verifyMetrics () // TODO(RyanRosario) Needs to be updated.
131130 })
132131 })
133132
@@ -265,7 +264,7 @@ func verifyTrafficRouting() {
265264 // Probability: need to compute estimate of number of batches to send to have high confidence of hitting all ports.
266265 // Using the Coupon Collector's Problem formula: n * H_n, where H_n is the nth harmonic number.
267266 // This gives us an expected number of trials to collect all coupons (ports).
268- batches := numPorts * harmonicNumber (numPorts )
267+ batches := int ( math . Ceil ( numPorts * harmonicNumber (numPorts )) )
269268 // Send curl requests to verify routing to all target ports in the InferencePool.
270269 gomega .Eventually (func () error {
271270 // Run a small batch per retry (e.g., 5) to keep the test active
@@ -518,7 +517,6 @@ func buildContainerPorts(start int, count int) []corev1.ContainerPort {
518517func buildTargetPorts (start int , count int ) []v1.Port {
519518 ports := make ([]v1.Port , count )
520519 for i := range count {
521- // v1.PortNumber is usually a typedef for int32 in these APIs.
522520 ports [i ] = v1.Port {
523521 Number : v1 .PortNumber (start + i ),
524522 }
@@ -598,10 +596,10 @@ func generateSequence(start int, count int) []int {
598596}
599597
600598// Calculates the nth harmonic number.
601- func harmonicNumber (n int ) int {
602- h := 0
599+ func harmonicNumber (n int ) float64 {
600+ h := float64 ( 0.0 )
603601 for i := 1 ; i <= n ; i ++ {
604- h += 1 / i
602+ h += 1 / float64 ( i )
605603 }
606604 return h
607605}
0 commit comments