|
|
@ -5,10 +5,6 @@ from src.main.python.ddadevops.c4k_build import C4kBuild, add_c4k_mixin_config
|
|
|
|
from .domain.test_helper import devops_config
|
|
|
|
from .domain.test_helper import devops_config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MyC4kBuild(C4kBuild):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_c4k_mixin(tmp_path):
|
|
|
|
def test_c4k_mixin(tmp_path):
|
|
|
|
build_dir = "build"
|
|
|
|
build_dir = "build"
|
|
|
|
project_name = "testing-project"
|
|
|
|
project_name = "testing-project"
|
|
|
@ -16,7 +12,7 @@ def test_c4k_mixin(tmp_path):
|
|
|
|
tmp_path_str = str(tmp_path)
|
|
|
|
tmp_path_str = str(tmp_path)
|
|
|
|
|
|
|
|
|
|
|
|
project = Project(tmp_path_str, name=project_name)
|
|
|
|
project = Project(tmp_path_str, name=project_name)
|
|
|
|
sut = MyC4kBuild(
|
|
|
|
sut = C4kBuild(
|
|
|
|
project,
|
|
|
|
project,
|
|
|
|
devops_config(
|
|
|
|
devops_config(
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -25,27 +21,18 @@ def test_c4k_mixin(tmp_path):
|
|
|
|
"module": "c4k-test",
|
|
|
|
"module": "c4k-test",
|
|
|
|
"c4k_config": {"a": 1, "b": 2},
|
|
|
|
"c4k_config": {"a": 1, "b": 2},
|
|
|
|
"c4k_auth": {"c": 3, "d": 4},
|
|
|
|
"c4k_auth": {"c": 3, "d": 4},
|
|
|
|
"grafana_cloud_user": "user",
|
|
|
|
"c4k_grafana_cloud_user": "user",
|
|
|
|
"grafana_cloud_password": "password",
|
|
|
|
"c4k_grafana_cloud_password": "password",
|
|
|
|
'grafana_cloud_url': "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sut.initialize_build_dir()
|
|
|
|
sut.initialize_build_dir()
|
|
|
|
assert (
|
|
|
|
assert sut.build_path() == f"{tmp_path_str}/target/name/c4k-test"
|
|
|
|
sut.build_path() == f"{tmp_path_str}/target/mybuild/c4k-test"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: mv this to domain test
|
|
|
|
|
|
|
|
# sut.update_runtime_config(DnsRecord("test.de", ipv6="1::"))
|
|
|
|
|
|
|
|
# assert "fqdn" in sut.specialized_builds[BuildType.C4K].config()
|
|
|
|
|
|
|
|
# assert "mon-cfg" in sut.specialized_builds[BuildType.C4K].config()
|
|
|
|
|
|
|
|
# assert "mon-auth" in sut.specialized_builds[BuildType.C4K].c4k_mixin_auth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sut.update_runtime_config(DnsRecord("test.de", ipv6="::1"))
|
|
|
|
sut.write_c4k_config()
|
|
|
|
sut.write_c4k_config()
|
|
|
|
assert os.path.exists(f"{mixin.build_path()}/out_c4k_config.yaml")
|
|
|
|
assert os.path.exists(f"{sut.build_path()}/out_c4k_config.yaml")
|
|
|
|
|
|
|
|
|
|
|
|
sut.write_c4k_auth()
|
|
|
|
sut.write_c4k_auth()
|
|
|
|
assert os.path.exists(f"{mixin.build_path()}/out_c4k_auth.yaml")
|
|
|
|
assert os.path.exists(f"{sut.build_path()}/out_c4k_auth.yaml")
|
|
|
|