This commit is contained in:
Michael Jerger 2023-05-25 14:51:49 +02:00
parent 20edebf61c
commit b24288976e
5 changed files with 20 additions and 11 deletions

View file

@ -27,7 +27,9 @@ class DevopsFactory:
if BuildType.TERRAFORM in build_types:
specialized_builds[BuildType.TERRAFORM] = TerraformDomain(inp)
if BuildType.DIGITALOCEAN_TERRAFORM in build_types:
specialized_builds[BuildType.DIGITALOCEAN_TERRAFORM] = DigitaloceanTerraform(inp)
specialized_builds[
BuildType.DIGITALOCEAN_TERRAFORM
] = DigitaloceanTerraform(inp)
mixins: Dict[MixinType, Validateable] = {}
if MixinType.RELEASE in mixin_types:

View file

@ -19,4 +19,3 @@ class DigitaloceanTerraform(Validateable):
result += self.__validate_is_not_empty__("do_spaces_access_id")
result += self.__validate_is_not_empty__("do_spaces_secret_key")
return result

View file

@ -36,7 +36,6 @@ def devops_config(overrides: dict) -> dict:
"do_api_key": "api_key",
"do_spaces_access_id": "spaces_id",
"do_spaces_secret_key": "spaces_secret",
"release_type": "NONE",
"release_main_branch": "main",
"release_current_branch": "my_feature",

View file

@ -1,6 +1,9 @@
import pytest
from src.main.python.ddadevops.domain import (
DevopsFactory, Version, BuildType, MixinType
DevopsFactory,
Version,
BuildType,
MixinType,
)
@ -42,7 +45,7 @@ def test_devops_factory():
"c4k_grafana_cloud_user": "user",
"c4k_grafana_cloud_password": "password",
},
Version.from_str("1.0.0")
Version.from_str("1.0.0"),
)
assert sut is not None
assert sut.specialized_builds[BuildType.C4K] is not None
@ -59,7 +62,7 @@ def test_devops_factory():
"do_spaces_access_id": "spaces_id",
"do_spaces_secret_key": "spaces_secret",
},
Version.from_str("1.0.0")
Version.from_str("1.0.0"),
)
assert sut is not None
assert sut.specialized_builds[BuildType.DIGITALOCEAN_TERRAFORM] is not None
@ -77,7 +80,7 @@ def test_devops_factory():
"release_current_branch": "my_feature",
"release_config_file": "project.clj",
},
Version.from_str("1.0.0")
Version.from_str("1.0.0"),
)
assert sut is not None
assert sut.mixins[MixinType.RELEASE] is not None

View file

@ -1,15 +1,21 @@
from pybuilder.core import Project
from pathlib import Path
from src.main.python.ddadevops.domain import (
BuildType,
BuildType,
DigitaloceanTerraform,
)
from .helper import devops_config
def test_digitalocean_terraform():
sut = DigitaloceanTerraform(devops_config({'do_api_key': 'api_key',
'do_spaces_access_id': 'spaces_id',
'do_spaces_secret_key': 'spaces_secret'}))
sut = DigitaloceanTerraform(
devops_config(
{
"do_api_key": "api_key",
"do_spaces_access_id": "spaces_id",
"do_spaces_secret_key": "spaces_secret",
}
)
)
assert sut is not None
assert sut.is_valid()