Spaces:
Sleeping
Sleeping
| # ===================================================== | |
| # Apckeyl Framework | |
| # Version 1.6 | |
| # run_control_plane_tests.py | |
| # ===================================================== | |
| """ | |
| Unified Control Plane Test Runner. | |
| Version 1.6 | |
| Запускает все текущие тесты Control Plane, | |
| Compute Plane и Compute Provider Registry. | |
| """ | |
| import importlib | |
| import inspect | |
| import traceback | |
| # ===================================================== | |
| # Test Modules | |
| # ===================================================== | |
| TEST_MODULES = [ | |
| "test_orchestrator_core", | |
| "test_module_registry", | |
| "test_control_plane", | |
| "test_task_manager", | |
| "test_dispatcher", | |
| "test_compute_adapter", | |
| "test_compute_module", | |
| "test_example_compute_provider", | |
| "test_compute_provider_registry", | |
| ] | |
| # ===================================================== | |
| # Test Discovery | |
| # ===================================================== | |
| def discover_tests(): | |
| tests = [] | |
| for module_name in TEST_MODULES: | |
| try: | |
| module = importlib.import_module( | |
| module_name | |
| ) | |
| except Exception as error: | |
| tests.append( | |
| { | |
| "module": module_name, | |
| "name": "__import__", | |
| "function": None, | |
| "error": error, | |
| } | |
| ) | |
| continue | |
| for name, function in inspect.getmembers( | |
| module, | |
| inspect.isfunction, | |
| ): | |
| if name.startswith("test_"): | |
| tests.append( | |
| { | |
| "module": module_name, | |
| "name": name, | |
| "function": function, | |
| "error": None, | |
| } | |
| ) | |
| return tests | |
| # ===================================================== | |
| # Run Tests | |
| # ===================================================== | |
| def main(): | |
| tests = discover_tests() | |
| total = len(tests) | |
| passed = 0 | |
| failed = 0 | |
| results = [] | |
| print("=" * 60) | |
| print("APCKEYL FRAMEWORK") | |
| print("Unified Control Plane Test Suite") | |
| print("Version 1.6") | |
| print("=" * 60) | |
| print() | |
| for test in tests: | |
| module_name = test["module"] | |
| test_name = test["name"] | |
| function = test["function"] | |
| import_error = test["error"] | |
| full_name = ( | |
| f"{module_name}.{test_name}" | |
| ) | |
| try: | |
| if import_error is not None: | |
| raise import_error | |
| function() | |
| print( | |
| f"[PASS] {full_name}" | |
| ) | |
| passed += 1 | |
| results.append( | |
| { | |
| "module": module_name, | |
| "test": test_name, | |
| "status": "PASSED", | |
| "error": None, | |
| } | |
| ) | |
| except Exception as error: | |
| print( | |
| f"[FAIL] {full_name}" | |
| ) | |
| print( | |
| f" Error: {error}" | |
| ) | |
| failed += 1 | |
| results.append( | |
| { | |
| "module": module_name, | |
| "test": test_name, | |
| "status": "FAILED", | |
| "error": str(error), | |
| } | |
| ) | |
| print() | |
| print("=" * 60) | |
| print("TEST SUMMARY") | |
| print("=" * 60) | |
| print( | |
| f"Total: {total}" | |
| ) | |
| print( | |
| f"Passed: {passed}" | |
| ) | |
| print( | |
| f"Failed: {failed}" | |
| ) | |
| print("=" * 60) | |
| if failed == 0: | |
| print( | |
| "RESULT: PASSED" | |
| ) | |
| return { | |
| "status": "PASSED", | |
| "total": total, | |
| "passed": passed, | |
| "failed": failed, | |
| "results": results, | |
| } | |
| print( | |
| "RESULT: FAILED" | |
| ) | |
| return { | |
| "status": "FAILED", | |
| "total": total, | |
| "passed": passed, | |
| "failed": failed, | |
| "results": results, | |
| } | |
| # ===================================================== | |
| # Direct Execution | |
| # ===================================================== | |
| if __name__ == "__main__": | |
| report = main() | |
| if report["status"] != "PASSED": | |
| raise SystemExit(1) | |
| # ===================================================== | |
| # End of File | |
| # ===================================================== |