mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* tpi: add naive terraform-provider-iterative wrapper * executor: add naive backend/terraform wrapper * setup: add dvc[terraform] install extras * config: add feature.executor feature flag * fix named executor config sections * executor: add poc add/modify/remove/init/destroy commands * relax python-terraform requirement * ci: install terraform extras * tpi: support .tf.json format * s/executor/machine * terraform: use separate dirs per machine * s/init/create/ * reserve local machine name * add initial ssh skeleton * add initial machine unit tests * add initial machine command tests * add tests for add/remove * enable feature by default in test env * close temp pemfile object so it can be used on windows * cleanup pemfile syntax
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import pytest
|
|
|
|
|
|
def test_validate_name():
|
|
from dvc.exceptions import InvalidArgumentError
|
|
from dvc.machine import RESERVED_NAMES, validate_name
|
|
|
|
for name in RESERVED_NAMES:
|
|
with pytest.raises(InvalidArgumentError):
|
|
validate_name(name)
|
|
|
|
|
|
@pytest.mark.parametrize("cloud", ["aws", "azure"])
|
|
def test_get_config_and_backend(tmp_dir, dvc, cloud):
|
|
from dvc.machine.backend.terraform import TerraformBackend
|
|
|
|
name = "foo"
|
|
with dvc.config.edit() as conf:
|
|
conf["machine"][name] = {"cloud": cloud}
|
|
config, backend = dvc.machine.get_config_and_backend(name)
|
|
assert config == {"cloud": cloud, "name": name}
|
|
assert isinstance(backend, TerraformBackend)
|
|
|
|
|
|
def test_get_config_and_backend_nonexistent(tmp_dir, dvc):
|
|
from dvc.config import MachineNotFoundError
|
|
|
|
with pytest.raises(MachineNotFoundError):
|
|
dvc.machine.get_config_and_backend("foo")
|
|
|
|
|
|
def test_get_config_and_backend_default(tmp_dir, dvc):
|
|
from dvc.config import NoMachineError
|
|
|
|
with pytest.raises(NoMachineError):
|
|
dvc.machine.get_config_and_backend()
|