Deploys some valid config files and checks that the deployments work.
(serve_instance)
| 178 | |
| 179 | @pytest.mark.skipif(sys.platform == "win32", reason="File path incorrect on Windows.") |
| 180 | def 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"), |
nothing calls this directly
no test coverage detected
searching dependent graphs…