MCPcopy
hub / github.com/ray-project/ray / test_deploy_multi_app_basic

Function test_deploy_multi_app_basic

python/ray/serve/tests/test_cli.py:180–281  ·  view source on GitHub ↗

Deploys some valid config files and checks that the deployments work.

(serve_instance)

Source from the content-addressed store, hash-verified

178
179@pytest.mark.skipif(sys.platform == "win32", reason="File path incorrect on Windows.")
180def test_deploy_multi_app_basic(serve_instance):
181 """Deploys some valid config files and checks that the deployments work."""
182 # Create absolute file names to YAML config files
183 two_pizzas = os.path.join(
184 os.path.dirname(__file__), "test_config_files", "two_pizzas.yaml"
185 )
186 pizza_world = os.path.join(
187 os.path.dirname(__file__), "test_config_files", "pizza_world.yaml"
188 )
189
190 success_message_fragment = b"Sent deploy request successfully."
191
192 # Ensure the CLI is idempotent
193 num_iterations = 2
194 for iteration in range(1, num_iterations + 1):
195 print(f"*** Starting Iteration {iteration}/{num_iterations} ***\n")
196
197 print("Deploying two pizzas config.")
198 deploy_response = subprocess.check_output(["serve", "deploy", two_pizzas])
199 assert success_message_fragment in deploy_response
200 print("Deploy request sent successfully.")
201
202 # Test add and mul for each of the two apps
203 wait_for_condition(
204 lambda: httpx.post(
205 f"{get_application_url(app_name='app1')}", json=["ADD", 2]
206 ).text
207 == "3 pizzas please!",
208 timeout=15,
209 )
210 wait_for_condition(
211 lambda: httpx.post(
212 f"{get_application_url(app_name='app1')}", json=["MUL", 2]
213 ).text
214 == "2 pizzas please!",
215 timeout=15,
216 )
217 print('Application "app1" is reachable over HTTP.')
218 wait_for_condition(
219 lambda: httpx.post(
220 f"{get_application_url(app_name='app2')}", json=["ADD", 2]
221 ).text
222 == "5 pizzas please!",
223 timeout=15,
224 )
225 wait_for_condition(
226 lambda: httpx.post(
227 f"{get_application_url(app_name='app2')}", json=["MUL", 2]
228 ).text
229 == "4 pizzas please!",
230 timeout=15,
231 )
232 print('Application "app2" is reachable over HTTP.')
233
234 deployment_names = [
235 DeploymentID(name="Router", app_name="app1"),
236 DeploymentID(name="Multiplier", app_name="app1"),
237 DeploymentID(name="Adder", app_name="app1"),

Callers

nothing calls this directly

Calls 9

wait_for_conditionFunction · 0.90
get_application_urlFunction · 0.90
DeploymentIDClass · 0.90
printFunction · 0.85
assert_deployments_liveFunction · 0.85
check_outputMethod · 0.80
rangeFunction · 0.50
joinMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…