File tree 3 files changed +48
-2
lines changed
3 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ py_test(
231
231
deps = [":serve_lib" ],
232
232
)
233
233
234
+ py_test (
235
+ name = "test_cli" ,
236
+ size = "small" ,
237
+ srcs = serve_tests_srcs ,
238
+ tags = ["exclusive" ],
239
+ deps = [":serve_lib" ],
240
+ )
241
+
234
242
# Runs test_api and test_failure with injected failures in the controller.
235
243
# TODO(simon): Tests are disabled until #11683 is fixed.
236
244
# py_test(
Original file line number Diff line number Diff line change 18
18
type = str ,
19
19
help = "Address of the running Ray cluster to connect to. "
20
20
"Defaults to \" auto\" ." )
21
- def cli (address ):
22
- ray .init (address = address )
21
+ @click .option (
22
+ "--namespace" ,
23
+ "-n" ,
24
+ default = "serve" ,
25
+ required = False ,
26
+ type = str ,
27
+ help = "Ray namespace to connect to. Defaults to \" serve\" ." )
28
+ def cli (address , namespace ):
29
+ ray .init (address = address , namespace = namespace )
23
30
24
31
25
32
@cli .command (help = "Start a detached Serve instance on the Ray cluster." )
Original file line number Diff line number Diff line change
1
+ import subprocess
2
+ import sys
3
+
4
+ import pytest
5
+
6
+
7
+ @pytest .fixture
8
+ def ray_start_stop ():
9
+ subprocess .check_output (["ray" , "start" , "--head" ])
10
+ yield
11
+ subprocess .check_output (["ray" , "stop" , "--force" ])
12
+
13
+
14
+ def test_start_shutdown (ray_start_stop ):
15
+ with pytest .raises (subprocess .CalledProcessError ):
16
+ subprocess .check_output (["serve" , "shutdown" ])
17
+
18
+ subprocess .check_output (["serve" , "start" ])
19
+ subprocess .check_output (["serve" , "shutdown" ])
20
+
21
+
22
+ def test_start_shutdown_in_namespace (ray_start_stop ):
23
+ with pytest .raises (subprocess .CalledProcessError ):
24
+ subprocess .check_output (["serve" , "-n" , "test" , "shutdown" ])
25
+
26
+ subprocess .check_output (["serve" , "-n" , "test" , "start" ])
27
+ subprocess .check_output (["serve" , "-n" , "test" , "shutdown" ])
28
+
29
+
30
+ if __name__ == "__main__" :
31
+ sys .exit (pytest .main (["-v" , "-s" , __file__ ]))
You can’t perform that action at this time.
0 commit comments