Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions ray-operator/controllers/ray/suite_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"reflect"
"time"

"github.com/ray-project/kuberay/ray-operator/controllers/ray/common"

"github.com/onsi/gomega"
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
"github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"
Expand Down Expand Up @@ -206,14 +208,16 @@ func checkServiceHealth(ctx context.Context, rayService *rayv1.RayService) func(
// So Pods are created, but no controller updates them from Pending to Running.
// See https://book.kubebuilder.io/reference/envtest.html for more details.
func updateHeadPodToRunningAndReady(ctx context.Context, rayClusterName string) {
var instance rayv1.RayCluster
gomega.Eventually(
getResourceFunc(ctx, client.ObjectKey{Name: rayClusterName, Namespace: "default"}, &instance),
time.Second*3, time.Millisecond*500).Should(gomega.BeNil(), "RayCluster %v not found", rayClusterName)

headPods := corev1.PodList{}
headFilterLabels := client.MatchingLabels{
utils.RayClusterLabelKey: rayClusterName,
utils.RayNodeTypeLabelKey: string(rayv1.HeadNode),
}
headLabels := common.RayClusterHeadPodsAssociationOptions(&instance).ToListOptions()

gomega.Eventually(
listResourceFunc(ctx, &headPods, headFilterLabels, &client.ListOptions{Namespace: "default"}),
listResourceFunc(ctx, &headPods, headLabels...),
time.Second*15, time.Millisecond*500).Should(gomega.Equal(1), "Head pod list should have only 1 Pod = %v", headPods.Items)

headPod := headPods.Items[0]
Expand All @@ -231,6 +235,6 @@ func updateHeadPodToRunningAndReady(ctx context.Context, rayClusterName string)

// Make sure the head Pod is updated.
gomega.Eventually(
isAllPodsRunning(ctx, headPods, headFilterLabels, "default"),
isAllPodsRunningByFilters(ctx, headPods, headLabels...),
time.Second*15, time.Millisecond*500).Should(gomega.BeTrue(), "Head Pod should be running: %v", headPods.Items)
}