Files
getDomain/domain-api/tests/test_ops_service_execution_modes.py
2026-04-18 23:52:51 +08:00

25 lines
844 B
Python

import unittest
from app.core.config import settings
from app.services.ops_service import _recommend_driver_execution_mode_for_supported_modes
class OpsServiceExecutionModeRecommendationTests(unittest.TestCase):
def test_recommend_driver_execution_mode_prefers_local_runtime_for_current_node(self) -> None:
result = _recommend_driver_execution_mode_for_supported_modes(
[settings.node_code],
supported_modes=["remote-agent", "local-runtime", "ssh"],
default_mode="remote-agent",
)
self.assertEqual("local-runtime", result["execution_mode"])
self.assertIn("local-runtime", result["reason"])
self.assertEqual(
["remote-agent", "local-runtime", "ssh"],
result["supported_modes"],
)
if __name__ == "__main__":
unittest.main()