def test__args_run(self): args, _ = main._args(["exec", "--verb", "RUN", "command1"]) self.assertDictEqual( vars(args), { "config_file": "/etc/directord/config.yaml", "check": False, "datastore": "memory", "debug": False, "driver": "grpcd", "job_port": 5555, "backend_port": 5556, "heartbeat_interval": 60, "identity": None, "socket_group": "0", "socket_path": "/var/run/directord.sock", "stream": False, "cache_path": "/var/cache/directord", "mode": "exec", "verb": "RUN", "wait": False, "target": None, "exec": ["command1"], "force_async": False, "poll": False, }, )
def test__args_orchestrate(self): args, _ = main._args(["orchestrate", "file1 file2"]) self.assertDictEqual( vars(args), { "config_file": "/etc/directord/config.yaml", "check": False, "datastore": "memory", "debug": False, "driver": "grpcd", "finger_print": False, "force_async": False, "job_port": 5555, "backend_port": 5556, "ignore_cache": False, "heartbeat_interval": 60, "identity": None, "socket_group": "0", "socket_path": "/var/run/directord.sock", "stream": False, "cache_path": "/var/cache/directord", "mode": "orchestrate", "wait": False, "target": None, "orchestrate_files": ["file1 file2"], "poll": False, "restrict": None, }, )
def test__args_manage_export_nodes(self): args, _ = main._args(["manage", "--export-nodes", "xxxx"]) self.assertDictEqual( vars(args), { "config_file": "/etc/directord/config.yaml", "datastore": "memory", "debug": False, "driver": "grpcd", "dump_cache": False, "export_jobs": None, "export_nodes": "xxxx", "filter": None, "job_info": None, "job_port": 5555, "analyze_job": None, "analyze_parent": None, "analyze_all": False, "backend_port": 5556, "heartbeat_interval": 60, "identity": None, "socket_group": "0", "socket_path": "/var/run/directord.sock", "cache_path": "/var/cache/directord", "list_jobs": False, "list_nodes": False, "mode": "manage", "purge_jobs": False, "purge_nodes": False, }, )
def test__args_server(self): args, _ = main._args(["server"]) self.assertDictEqual( vars(args), { "config_file": "/etc/directord/config.yaml", "datastore": "memory", "debug": False, "driver": "grpcd", "job_port": 5555, "backend_port": 5556, "heartbeat_interval": 60, "identity": None, "socket_group": "0", "socket_path": "/var/run/directord.sock", "cache_path": "/var/cache/directord", "mode": "server", }, )
def test__args_manage_bootstrap(self): m = unittest.mock.mock_open(read_data=tests.TEST_CATALOG.encode()) with patch("builtins.open", m): args, _ = main._args(["bootstrap", "--catalog", "file"]) self.assertDictEqual( vars(args), { "catalog": mock.ANY, "config_file": "/etc/directord/config.yaml", "datastore": "memory", "debug": False, "driver": "grpcd", "job_port": 5555, "key_file": None, "backend_port": 5556, "heartbeat_interval": 60, "identity": None, "socket_group": "0", "socket_path": "/var/run/directord.sock", "threads": 10, "cache_path": "/var/cache/directord", "mode": "bootstrap", }, )