Skip to content

Commit

Permalink
Defer retrieving GetRayJobId in test
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar committed Aug 22, 2023
1 parent 4816d9d commit 1498a3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/integration/ray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestRayCluster(t *testing.T) {
dashboardHostname := dashboard.Status.Ingress[0].Host

rayClient := support.NewRayClusterClient(url.URL{Scheme: "http", Host: dashboardHostname})
defer support.WriteRayJobAPILogs(test, rayClient, support.GetRayJobId(test, rayJob.Namespace, rayJob.Name))
defer writeRayJobAPILogs(test, rayClient, rayJob.Namespace, rayJob.Name)

test.T().Logf("Waiting for RayJob %s/%s to complete", rayJob.Namespace, rayJob.Name)
test.Eventually(support.RayJob(test, rayJob.Namespace, rayJob.Name), support.TestTimeoutLong).
Expand All @@ -123,6 +123,11 @@ func TestRayCluster(t *testing.T) {
To(WithTransform(support.RayJobStatus, Equal(rayv1alpha1.JobStatusSucceeded)))
}

func writeRayJobAPILogs(test support.Test, rayClient support.RayClusterClient, rayJobNamespace string, rayJobName string) {
// Stored in a separate function so GetRayJobId call is also deferred
support.WriteRayJobAPILogs(test, rayClient, support.GetRayJobId(test, rayJobNamespace, rayJobName))
}

func TestRayJobSubmissionRest(t *testing.T) {
test := support.With(t)
test.T().Parallel()
Expand Down

0 comments on commit 1498a3c

Please sign in to comment.