Skip to content

Commit aceaadd

Browse files
committed
[serve] Add validation for 'proxy_location' and 'http_options' config parameters for the 'serve deploy' command
Signed-off-by: axreldable <aleksei.starikov.ax@gmail.com>
1 parent 48d1c0b commit aceaadd

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

python/ray/serve/tests/unit/test_cli.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ def deploy_applications(self, config: Dict):
5454

5555
def get_serve_details(self) -> Dict:
5656
return {
57-
"controller_info": ServeActorDetails(),
57+
"controller_info": ServeActorDetails().dict(),
5858
"proxies": {},
5959
"applications": {},
60-
"proxy_location": "EveryNode", # current default
60+
"proxy_location": ProxyLocation.EveryNode, # current default
61+
"http_options": HTTPOptionsSchema().dict(),
6162
}
6263

6364

@@ -164,7 +165,25 @@ def test_deploy_fails_on_proxy_location_changed(self, fake_serve_client, tmp_pat
164165
in str(result.exception)
165166
)
166167

167-
def test_deploy_success_if_proxy_location_empty_in_config(
168+
def test_deploy_fails_on_http_options_changed(self, fake_serve_client, tmp_path):
169+
runner = CliRunner()
170+
config_path = tmp_path / "config.yaml"
171+
config = {
172+
"http_options": {"host": "1.2.3.4"},
173+
"applications": [{"import_path": "my_module:my_app"}],
174+
}
175+
with open(config_path, "w") as f:
176+
yaml.dump(config, f)
177+
result = runner.invoke(deploy, [str(config_path)])
178+
assert result.exit_code != 0, result.output
179+
assert "Attempt to update `http_options` has been detected!" in str(
180+
result.exception
181+
)
182+
assert "'host': {'previous': '0.0.0.0', 'new': '1.2.3.4'}" in str(
183+
result.exception
184+
)
185+
186+
def test_deploy_success_if_proxy_location_and_http_options_empty_in_config(
168187
self, fake_serve_client, tmp_path
169188
):
170189
runner = CliRunner()

0 commit comments

Comments
 (0)