| 231 | |
| 232 | |
| 233 | def create_test(scenario_def): |
| 234 | def run_scenario(self): |
| 235 | c = create_mock_topology(scenario_def["uri"]) |
| 236 | |
| 237 | for i, phase in enumerate(scenario_def["phases"]): |
| 238 | # Including the phase description makes failures easier to debug. |
| 239 | description = phase.get("description", str(i)) |
| 240 | with assertion_context(f"phase: {description}"): |
| 241 | for response in phase.get("responses", []): |
| 242 | got_hello(c, common.partition_node(response[0]), response[1]) |
| 243 | |
| 244 | for app_error in phase.get("applicationErrors", []): |
| 245 | got_app_error(c, app_error) |
| 246 | |
| 247 | check_outcome(self, c, phase["outcome"]) |
| 248 | |
| 249 | return run_scenario |
| 250 | |
| 251 | |
| 252 | def create_tests(): |