Skip to content

Commit 01fccf2

Browse files
committed
fix
Signed-off-by: Kuromesi <[email protected]>
1 parent 6e51c02 commit 01fccf2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/integration/hermetic_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func TestKubeInferenceModelRequest(t *testing.T) {
343343

344344
for _, test := range tests {
345345
t.Run(test.name, func(t *testing.T) {
346-
client, cleanup := setUpHermeticServer(test.pods)
346+
client, cleanup := setUpHermeticServer(t, test.pods)
347347
t.Cleanup(cleanup)
348348
want := &extProcPb.ProcessingResponse{
349349
Response: &extProcPb.ProcessingResponse_RequestBody{
@@ -389,7 +389,7 @@ func TestKubeInferenceModelRequest(t *testing.T) {
389389
}
390390
}
391391

392-
func setUpHermeticServer(podMetrics []*datastore.PodMetrics) (client extProcPb.ExternalProcessor_ProcessClient, cleanup func()) {
392+
func setUpHermeticServer(t *testing.T, podMetrics []*datastore.PodMetrics) (client extProcPb.ExternalProcessor_ProcessClient, cleanup func()) {
393393
pms := make(map[types.NamespacedName]*datastore.PodMetrics)
394394
for _, pm := range podMetrics {
395395
pms[pm.NamespacedName] = pm
@@ -430,8 +430,10 @@ func setUpHermeticServer(podMetrics []*datastore.PodMetrics) (client extProcPb.E
430430
}
431431
}()
432432

433-
// sleep 5 seconds to wait for datastore to be synced
434-
time.Sleep(5 * time.Second)
433+
// check if all pods are synced to datastore
434+
assert.EventuallyWithT(t, func(t *assert.CollectT) {
435+
assert.Len(t, serverRunner.Datastore.PodGetAll(), len(podMetrics), "Datastore not synced")
436+
}, 10*time.Second, time.Second)
435437

436438
address := fmt.Sprintf("localhost:%v", port)
437439
// Create a grpc connection

0 commit comments

Comments
 (0)