Skip to content

Commit 772d499

Browse files
committed
Add verifyTraffic for multiport InfPool e2e test
1 parent 9ba982f commit 772d499

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

test/e2e/epp/e2e_suite_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ func createInferExt(testConfig *testutils.TestConfig, filePath string) {
320320

321321
// This image needs to be updated to open multiple ports and respond.
322322
inManifests := testutils.ReadYaml(filePath) // Modify inference-pool.yaml
323-
ginkgo.GinkgoWriter.Print("Deployment: %s", filePath)
324323
ginkgo.By("Replacing placeholders with environment variables")
325324
outManifests := []string{}
326325
replacer := strings.NewReplacer(

test/e2e/epp/e2e_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
518517
func 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
}

test/utils/utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ func ExecCommandInPod(testConfig *TestConfig, podName, containerName string, cmd
339339
parameterCodec := runtime.NewParameterCodec(testConfig.Scheme)
340340

341341
// construct REST request to the API server.
342-
// fmt.Printf("Pod Name: %s", podName)
343342
// podName is curl, that is where this is being sent.
344343
req := testConfig.KubeCli.CoreV1().RESTClient().
345344
Post().

0 commit comments

Comments
 (0)