mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
* executor: move local specific git initialization out of base * machine: return kwargs for executor init instead of executor object * executor: add initial ssh executor * ssh-executor: disable strict host checking for dvc-machine instances * initial tests for ssh executor * drop GIT_SSH_COMMAND usage * push: accept destination odb as a parameter * separate cache initialization into executor.init_cache * add test for ssh executor cache init * remove dead code * machine: fixture-ize default test scenarios * test SSHExecutor.from_machine * tpi: return default SSH port for constructing executors
54 lines
1.2 KiB
Python
54 lines
1.2 KiB
Python
import textwrap
|
|
|
|
import pytest
|
|
|
|
BASIC_CONFIG = textwrap.dedent(
|
|
"""\
|
|
[feature]
|
|
machine = true
|
|
['machine "foo"']
|
|
cloud = aws
|
|
"""
|
|
)
|
|
|
|
TEST_INSTANCE = {
|
|
"aws_security_group": None,
|
|
"cloud": "aws",
|
|
"id": "iterative-2jyhw8j9ieov6",
|
|
"image": "ubuntu-bionic-18.04-amd64-server-20210818",
|
|
"instance_gpu": None,
|
|
"instance_hdd_size": 35,
|
|
"instance_ip": "123.123.123.123",
|
|
"instance_launch_time": "2021-08-25T07:13:03Z",
|
|
"instance_type": "m",
|
|
"name": "test-resource",
|
|
"region": "us-west",
|
|
"spot": False,
|
|
"spot_price": -1,
|
|
"ssh_name": None,
|
|
"ssh_private": "-----BEGIN RSA PRIVATE KEY-----\\n",
|
|
"startup_script": "IyEvYmluL2Jhc2g=",
|
|
"timeouts": None,
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def machine_config(tmp_dir):
|
|
(tmp_dir / ".dvc" / "config").write_text(BASIC_CONFIG)
|
|
yield BASIC_CONFIG
|
|
|
|
|
|
@pytest.fixture
|
|
def machine_instance(tmp_dir, dvc, mocker):
|
|
from tpi.terraform import TerraformBackend
|
|
|
|
with dvc.config.edit() as conf:
|
|
conf["machine"]["foo"] = {"cloud": "aws"}
|
|
mocker.patch.object(
|
|
TerraformBackend,
|
|
"instances",
|
|
autospec=True,
|
|
return_value=[TEST_INSTANCE],
|
|
)
|
|
yield TEST_INSTANCE
|