@@ -17,11 +17,6 @@ import (
17
17
. "github.com/ray-project/kuberay/ray-operator/test/support"
18
18
)
19
19
20
- const (
21
- redisPassword = "5241590000000000"
22
- redisAddress = "redis:6379"
23
- )
24
-
25
20
func TestRayClusterGCSFaultTolerance (t * testing.T ) {
26
21
test := With (t )
27
22
g := NewWithT (t )
@@ -33,14 +28,14 @@ func TestRayClusterGCSFaultTolerance(t *testing.T) {
33
28
g .Expect (err ).NotTo (HaveOccurred ())
34
29
35
30
test .T ().Run ("Test Detached Actor" , func (_ * testing.T ) {
36
- checkRedisDBSize := deployRedis (test , namespace .Name , redisPassword )
31
+ checkRedisDBSize := DeployRedis (test , namespace .Name , RedisPassword )
37
32
defer g .Eventually (checkRedisDBSize , time .Second * 30 , time .Second ).Should (BeEquivalentTo ("0" ))
38
33
39
34
rayClusterSpecAC := rayv1ac .RayClusterSpec ().
40
35
WithGcsFaultToleranceOptions (
41
36
rayv1ac .GcsFaultToleranceOptions ().
42
- WithRedisAddress (redisAddress ).
43
- WithRedisPassword (rayv1ac .RedisCredential ().WithValue (redisPassword )),
37
+ WithRedisAddress (RedisAddress ).
38
+ WithRedisPassword (rayv1ac .RedisCredential ().WithValue (RedisPassword )),
44
39
).
45
40
WithRayVersion (GetRayVersion ()).
46
41
WithHeadGroupSpec (rayv1ac .HeadGroupSpec ().
@@ -82,7 +77,7 @@ func TestRayClusterGCSFaultTolerance(t *testing.T) {
82
77
ExecPodCmd (test , headPod , common .RayHeadContainer , []string {"python" , "samples/test_detached_actor_1.py" , rayNamespace })
83
78
84
79
// [Test 1: Kill GCS process to "restart" the head Pod]
85
- // Assertion is implement in python, so no furthur handling needed here, and so are other ExecPodCmd
80
+ // Assertion is implement in python, so no further handling needed here, and so are other ExecPodCmd
86
81
stdout , stderr := ExecPodCmd (test , headPod , common .RayHeadContainer , []string {"pkill" , "gcs_server" })
87
82
LogWithTimestamp (test .T (), "pkill gcs_server output - stdout: %s, stderr: %s" , stdout .String (), stderr .String ())
88
83
@@ -145,49 +140,49 @@ func TestGcsFaultToleranceOptions(t *testing.T) {
145
140
return rayv1ac .RayCluster ("raycluster-gcsft" , namespace ).WithSpec (
146
141
newRayClusterSpec ().WithGcsFaultToleranceOptions (
147
142
rayv1ac .GcsFaultToleranceOptions ().
148
- WithRedisAddress (redisAddress ),
143
+ WithRedisAddress (RedisAddress ),
149
144
),
150
145
)
151
146
},
152
147
createSecret : false ,
153
148
},
154
149
{
155
150
name : "Redis Password" ,
156
- redisPassword : redisPassword ,
151
+ redisPassword : RedisPassword ,
157
152
rayClusterFn : func (namespace string ) * rayv1ac.RayClusterApplyConfiguration {
158
153
return rayv1ac .RayCluster ("raycluster-gcsft" , namespace ).WithSpec (
159
154
newRayClusterSpec ().WithGcsFaultToleranceOptions (
160
155
rayv1ac .GcsFaultToleranceOptions ().
161
- WithRedisAddress (redisAddress ).
162
- WithRedisPassword (rayv1ac .RedisCredential ().WithValue (redisPassword )),
156
+ WithRedisAddress (RedisAddress ).
157
+ WithRedisPassword (rayv1ac .RedisCredential ().WithValue (RedisPassword )),
163
158
),
164
159
)
165
160
},
166
161
createSecret : false ,
167
162
},
168
163
{
169
164
name : "Redis Password and Username" ,
170
- redisPassword : redisPassword ,
165
+ redisPassword : RedisPassword ,
171
166
rayClusterFn : func (namespace string ) * rayv1ac.RayClusterApplyConfiguration {
172
167
return rayv1ac .RayCluster ("raycluster-gcsft" , namespace ).WithSpec (
173
168
newRayClusterSpec ().WithGcsFaultToleranceOptions (
174
169
rayv1ac .GcsFaultToleranceOptions ().
175
- WithRedisAddress (redisAddress ).
170
+ WithRedisAddress (RedisAddress ).
176
171
WithRedisUsername (rayv1ac .RedisCredential ().WithValue ("default" )).
177
- WithRedisPassword (rayv1ac .RedisCredential ().WithValue (redisPassword )),
172
+ WithRedisPassword (rayv1ac .RedisCredential ().WithValue (RedisPassword )),
178
173
),
179
174
)
180
175
},
181
176
createSecret : false ,
182
177
},
183
178
{
184
179
name : "Redis Password In Secret" ,
185
- redisPassword : redisPassword ,
180
+ redisPassword : RedisPassword ,
186
181
rayClusterFn : func (namespace string ) * rayv1ac.RayClusterApplyConfiguration {
187
182
return rayv1ac .RayCluster ("raycluster-gcsft" , namespace ).WithSpec (
188
183
newRayClusterSpec ().WithGcsFaultToleranceOptions (
189
184
rayv1ac .GcsFaultToleranceOptions ().
190
- WithRedisAddress (redisAddress ).
185
+ WithRedisAddress (RedisAddress ).
191
186
WithRedisPassword (rayv1ac .RedisCredential ().
192
187
WithValueFrom (corev1.EnvVarSource {
193
188
SecretKeyRef : & corev1.SecretKeySelector {
@@ -209,7 +204,7 @@ func TestGcsFaultToleranceOptions(t *testing.T) {
209
204
return rayv1ac .RayCluster ("raycluster-with-a-very-long-name-exceeding-k8s-limit" , namespace ).WithSpec (
210
205
newRayClusterSpec ().WithGcsFaultToleranceOptions (
211
206
rayv1ac .GcsFaultToleranceOptions ().
212
- WithRedisAddress (redisAddress ),
207
+ WithRedisAddress (RedisAddress ),
213
208
),
214
209
)
215
210
},
@@ -223,7 +218,7 @@ func TestGcsFaultToleranceOptions(t *testing.T) {
223
218
g := NewWithT (t )
224
219
namespace := test .NewTestNamespace ()
225
220
226
- checkRedisDBSize := deployRedis (test , namespace .Name , tc .redisPassword )
221
+ checkRedisDBSize := DeployRedis (test , namespace .Name , tc .redisPassword )
227
222
defer g .Eventually (checkRedisDBSize , time .Second * 30 , time .Second ).Should (BeEquivalentTo ("0" ))
228
223
229
224
if tc .createSecret {
@@ -283,18 +278,18 @@ func TestGcsFaultToleranceAnnotations(t *testing.T) {
283
278
name : "GCS FT with redis password in ray start params" ,
284
279
storageNS : "" ,
285
280
redisPasswordEnv : "" ,
286
- redisPasswordInRayStartParams : redisPassword ,
281
+ redisPasswordInRayStartParams : RedisPassword ,
287
282
},
288
283
{
289
284
name : "GCS FT with redis password in ray start params referring to env" ,
290
285
storageNS : "" ,
291
- redisPasswordEnv : redisPassword ,
286
+ redisPasswordEnv : RedisPassword ,
292
287
redisPasswordInRayStartParams : "$REDIS_PASSWORD" ,
293
288
},
294
289
{
295
290
name : "GCS FT with storage namespace" ,
296
291
storageNS : "test-storage-ns" ,
297
- redisPasswordEnv : redisPassword ,
292
+ redisPasswordEnv : RedisPassword ,
298
293
redisPasswordInRayStartParams : "$REDIS_PASSWORD" ,
299
294
},
300
295
}
@@ -315,13 +310,13 @@ func TestGcsFaultToleranceAnnotations(t *testing.T) {
315
310
redisPassword = tc .redisPasswordInRayStartParams
316
311
}
317
312
318
- checkRedisDBSize := deployRedis (test , namespace .Name , redisPassword )
313
+ checkRedisDBSize := DeployRedis (test , namespace .Name , redisPassword )
319
314
defer g .Eventually (checkRedisDBSize , time .Second * 30 , time .Second ).Should (BeEquivalentTo ("0" ))
320
315
321
316
// Prepare RayCluster ApplyConfiguration
322
317
podTemplateAC := headPodTemplateApplyConfiguration ()
323
318
podTemplateAC .Spec .Containers [utils .RayContainerIndex ].WithEnv (
324
- corev1ac .EnvVar ().WithName ("RAY_REDIS_ADDRESS" ).WithValue (redisAddress ),
319
+ corev1ac .EnvVar ().WithName ("RAY_REDIS_ADDRESS" ).WithValue (RedisAddress ),
325
320
)
326
321
if tc .redisPasswordEnv != "" {
327
322
podTemplateAC .Spec .Containers [utils .RayContainerIndex ].WithEnv (
0 commit comments