fix tests
This commit is contained in:
parent
1da73523d9
commit
e501525db2
1 changed files with 28 additions and 20 deletions
|
@ -5,10 +5,16 @@ from src.main.python.ddadevops.domain.common import (
|
||||||
DnsRecord,
|
DnsRecord,
|
||||||
Devops,
|
Devops,
|
||||||
)
|
)
|
||||||
from src.main.python.ddadevops.domain import Version, ReleaseType, Release, ReleaseContext
|
from src.main.python.ddadevops.domain import (
|
||||||
|
Version,
|
||||||
|
ReleaseType,
|
||||||
|
Release,
|
||||||
|
ReleaseContext,
|
||||||
|
)
|
||||||
from src.main.python.ddadevops.domain.image import Image
|
from src.main.python.ddadevops.domain.image import Image
|
||||||
from src.main.python.ddadevops.domain.c4k import C4k
|
from src.main.python.ddadevops.domain.c4k import C4k
|
||||||
from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config
|
from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config
|
||||||
|
from .test_helper import build_devops
|
||||||
|
|
||||||
|
|
||||||
class MockValidateable(Validateable):
|
class MockValidateable(Validateable):
|
||||||
|
@ -62,6 +68,7 @@ def test_should_validate_DnsRecord():
|
||||||
sut = DnsRecord("name", ipv6="1::")
|
sut = DnsRecord("name", ipv6="1::")
|
||||||
assert sut.is_valid()
|
assert sut.is_valid()
|
||||||
|
|
||||||
|
|
||||||
def test_c4k_build_should_update_fqdn():
|
def test_c4k_build_should_update_fqdn():
|
||||||
project_config = {
|
project_config = {
|
||||||
"stage": "test",
|
"stage": "test",
|
||||||
|
@ -108,7 +115,9 @@ def test_c4k_build_should_update_fqdn():
|
||||||
|
|
||||||
|
|
||||||
def test_c4k_build_should_calculate_command():
|
def test_c4k_build_should_calculate_command():
|
||||||
devops = Devops(stage="test", project_root_path="", module="module", name="name")
|
devops = build_devops(
|
||||||
|
{"project_root_path": ".", "module": "module", "name": "name"}
|
||||||
|
)
|
||||||
project_config = {
|
project_config = {
|
||||||
"stage": "test",
|
"stage": "test",
|
||||||
"name": "name",
|
"name": "name",
|
||||||
|
@ -126,9 +135,9 @@ def test_c4k_build_should_calculate_command():
|
||||||
sut = C4k(project_config)
|
sut = C4k(project_config)
|
||||||
assert (
|
assert (
|
||||||
"c4k-module-standalone.jar "
|
"c4k-module-standalone.jar "
|
||||||
+ "/target/name/module/out_c4k_config.yaml "
|
+ "./target/name/module/out_c4k_config.yaml "
|
||||||
+ "/target/name/module/out_c4k_auth.yaml > "
|
+ "./target/name/module/out_c4k_auth.yaml > "
|
||||||
+ "/target/name/module/out_module.yaml"
|
+ "./target/name/module/out_module.yaml"
|
||||||
== sut.command(devops)
|
== sut.command(devops)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -150,12 +159,13 @@ def test_c4k_build_should_calculate_command():
|
||||||
sut = C4k(project_config)
|
sut = C4k(project_config)
|
||||||
assert (
|
assert (
|
||||||
"c4k-executabel_name-standalone.jar "
|
"c4k-executabel_name-standalone.jar "
|
||||||
+ "/target/name/module/out_c4k_config.yaml "
|
+ "./target/name/module/out_c4k_config.yaml "
|
||||||
+ "/target/name/module/out_c4k_auth.yaml > "
|
+ "./target/name/module/out_c4k_auth.yaml > "
|
||||||
+ "/target/name/module/out_module.yaml"
|
+ "./target/name/module/out_module.yaml"
|
||||||
== sut.command(devops)
|
== sut.command(devops)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_version(tmp_path: Path):
|
def test_version(tmp_path: Path):
|
||||||
version = Version(tmp_path, [1, 2, 3])
|
version = Version(tmp_path, [1, 2, 3])
|
||||||
version.increment(ReleaseType.SNAPSHOT)
|
version.increment(ReleaseType.SNAPSHOT)
|
||||||
|
@ -187,31 +197,29 @@ def test_version(tmp_path: Path):
|
||||||
assert version.version_list == [2, 0, 0]
|
assert version.version_list == [2, 0, 0]
|
||||||
assert not version.is_snapshot
|
assert not version.is_snapshot
|
||||||
|
|
||||||
|
|
||||||
def test_release_context(tmp_path):
|
def test_release_context(tmp_path):
|
||||||
version = Version(tmp_path, [1, 2, 3])
|
version = Version(tmp_path, [1, 2, 3])
|
||||||
release = ReleaseContext(ReleaseType.MINOR, version, "main")
|
release = ReleaseContext(ReleaseType.MINOR, version, "main")
|
||||||
|
|
||||||
release_version = release.release_version()
|
release_version = release.release_version()
|
||||||
assert release_version.get_version_string() in '1.3.0'
|
assert release_version.get_version_string() in "1.3.0"
|
||||||
|
|
||||||
bump_version = release.bump_version()
|
bump_version = release.bump_version()
|
||||||
assert bump_version.get_version_string() in "1.3.1-SNAPSHOT"
|
assert bump_version.get_version_string() in "1.3.1-SNAPSHOT"
|
||||||
|
|
||||||
|
|
||||||
def test_release(tmp_path):
|
def test_release(tmp_path):
|
||||||
devops = Devops(stage="test", project_root_path="", module="module", name="name")
|
devops = build_devops({})
|
||||||
sut = Release(devops, "main", "config_file.json")
|
sut = Release(devops, "main", "config_file.json")
|
||||||
assert not sut.is_valid()
|
assert not sut.is_valid()
|
||||||
|
|
||||||
sut.set_release_context(ReleaseContext(ReleaseType.MINOR, Version("id", [1,2,3]), "main"))
|
sut.set_release_context(
|
||||||
|
ReleaseContext(ReleaseType.MINOR, Version("id", [1, 2, 3]), "main")
|
||||||
|
)
|
||||||
assert sut.is_valid()
|
assert sut.is_valid()
|
||||||
|
|
||||||
|
|
||||||
def test_devops_build_commons_path():
|
def test_devops_build_commons_path():
|
||||||
devops = Devops(
|
sut = build_devops({})
|
||||||
stage="test", project_root_path="../../..", module="cloud", name="meissa"
|
assert "docker/" == sut.specialized_build.docker_build_commons_path()
|
||||||
)
|
|
||||||
sut = Image(
|
|
||||||
dockerhub_user="user",
|
|
||||||
dockerhub_password="password",
|
|
||||||
devops = devops,
|
|
||||||
)
|
|
||||||
assert "docker/" == sut.docker_build_commons_path()
|
|
||||||
|
|
Loading…
Reference in a new issue