Test schema validator
()
| 201 | |
| 202 | |
| 203 | def main(): |
| 204 | """Test schema validator""" |
| 205 | import sys |
| 206 | |
| 207 | if len(sys.argv) < 2: |
| 208 | print("Usage: python rpc_schema_validator.py <port>") |
| 209 | sys.exit(1) |
| 210 | |
| 211 | port = sys.argv[1] |
| 212 | |
| 213 | try: |
| 214 | validator = RpcSchemaValidator(port) |
| 215 | |
| 216 | print("\n📋 Available methods:") |
| 217 | for method in validator.list_methods(): |
| 218 | info = validator.get_method_schema(method) |
| 219 | params = ", ".join(f"{p.name}:{p.type}" for p in info.params) |
| 220 | print(f" - {method}({params}) -> {info.returnType}") |
| 221 | |
| 222 | print("\n✅ Schema validator ready") |
| 223 | |
| 224 | # Example validation |
| 225 | print("\n🧪 Testing validation:") |
| 226 | try: |
| 227 | validator.validate_request( |
| 228 | "runSingleTest", |
| 229 | {"driver": "PARLIO", "laneSizes": [10], "iterations": 1}, |
| 230 | ) |
| 231 | print(" ✅ Valid request") |
| 232 | except ValidationError as e: |
| 233 | print(f" ❌ Invalid request: {e}") |
| 234 | |
| 235 | except KeyboardInterrupt as ki: |
| 236 | handle_keyboard_interrupt(ki) |
| 237 | print("\n⚠️ Interrupted by user") |
| 238 | sys.exit(130) |
| 239 | except Exception as e: |
| 240 | print(f"❌ Error: {e}") |
| 241 | sys.exit(1) |
| 242 | |
| 243 | |
| 244 | if __name__ == "__main__": |
no test coverage detected