machine: add dvc machine ssh (#6501)

* machine: add naive asyncssh shell client

* machine: add `dvc machine ssh` command

* add ssh requirements to terraform install extras

* update asyncssh comments

* fix py <3.7

* fix async mocking in py<3.8

* use mock instead of unittest.mock
This commit is contained in:
Peter Rowlands (변기호)
2021-09-01 16:20:13 +09:00
committed by GitHub
parent b5fe9b4596
commit 9fc4c60749
7 changed files with 108 additions and 4 deletions
+14
View File
@@ -6,6 +6,7 @@ from dvc.command.machine import (
CmdMachineCreate,
CmdMachineDestroy,
CmdMachineRemove,
CmdMachineSsh,
)
@@ -64,3 +65,16 @@ def test_destroy(tmp_dir, dvc, mocker):
assert cmd.run() == 0
m.assert_called_once_with("foo")
def test_ssh(tmp_dir, dvc, mocker):
cli_args = parse_args(["machine", "ssh", "foo"])
assert cli_args.func == CmdMachineSsh
cmd = cli_args.func(cli_args)
m = mocker.patch.object(
cmd.repo.machine, "run_shell", autospec=True, return_value=0
)
assert cmd.run() == 0
m.assert_called_once_with("foo")