Skip to content

Commit

Permalink
fix test isolation
Browse files Browse the repository at this point in the history
  • Loading branch information
simotw committed Nov 29, 2024
1 parent 1ae8a9b commit d76f389
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions ray-operator/test/e2eautoscaler/raycluster_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ var tests = map[string]struct {
}

func TestRayClusterAutoscaler(t *testing.T) {
test := With(t)
g := NewWithT(t)
for name, tc := range tests {
test := With(t)
g := NewWithT(t)

// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()
// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)

for name, tc := range tests {
test.T().Run(name, func(_ *testing.T) {
rayClusterSpecAC := rayv1ac.RayClusterSpec().
WithEnableInTreeAutoscaling(true).
Expand Down Expand Up @@ -98,20 +98,20 @@ func TestRayClusterAutoscaler(t *testing.T) {
}

func TestRayClusterAutoscalerWithFakeGPU(t *testing.T) {
test := With(t)
g := NewWithT(t)
for name, tc := range tests {

// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()
test := With(t)
g := NewWithT(t)

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()

for name, tc := range tests {
// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)

test.T().Run(name, func(_ *testing.T) {
rayClusterSpecAC := rayv1ac.RayClusterSpec().
Expand Down Expand Up @@ -160,20 +160,20 @@ func TestRayClusterAutoscalerWithFakeGPU(t *testing.T) {
}

func TestRayClusterAutoscalerWithCustomResource(t *testing.T) {
test := With(t)
g := NewWithT(t)
for name, tc := range tests {

// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()
test := With(t)
g := NewWithT(t)

// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)
// Create a namespace
namespace := test.NewTestNamespace()
test.StreamKubeRayOperatorLogs()

for name, tc := range tests {
// Scripts for creating and terminating detached actors to trigger autoscaling
scriptsAC := newConfigMap(namespace.Name, "scripts", files(test, "create_detached_actor.py", "terminate_detached_actor.py"))
scripts, err := test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Apply(test.Ctx(), scriptsAC, TestApplyOptions)
g.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created ConfigMap %s/%s successfully", scripts.Namespace, scripts.Name)

test.T().Run(name, func(_ *testing.T) {
groupName := "custom-resource-group"
Expand Down

0 comments on commit d76f389

Please sign in to comment.