|
|
|
@ -42,11 +42,11 @@ def test_validate_with_reason():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_c4k_build_should_update_fqdn(tmp_path):
|
|
|
|
|
project = Project(str(tmp_path), name='test-project')
|
|
|
|
|
project = Project(str(tmp_path), name="test-project")
|
|
|
|
|
project_config = {
|
|
|
|
|
"stage": "test",
|
|
|
|
|
"project_root_path": str(tmp_path),
|
|
|
|
|
"module": 'module',
|
|
|
|
|
"module": "module",
|
|
|
|
|
"build_dir_name": "target",
|
|
|
|
|
}
|
|
|
|
|
config = {"issuer": "staging"}
|
|
|
|
@ -63,21 +63,74 @@ def test_c4k_build_should_update_fqdn(tmp_path):
|
|
|
|
|
grafana_cloud_password="password",
|
|
|
|
|
)
|
|
|
|
|
sut = C4kBuild(Build(project, project_config), project, project_config)
|
|
|
|
|
sut.update_runtime_config('test.de', None, None)
|
|
|
|
|
sut.update_runtime_config("test.de", None, None)
|
|
|
|
|
|
|
|
|
|
assert {
|
|
|
|
|
"issuer": "staging",
|
|
|
|
|
'fqdn': 'test.de',
|
|
|
|
|
"fqdn": "test.de",
|
|
|
|
|
"mon-cfg": {
|
|
|
|
|
"cluster-name": "module",
|
|
|
|
|
"cluster-stage": "test",
|
|
|
|
|
"grafana-cloud-url": "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
|
|
|
|
|
},
|
|
|
|
|
} == sut.config()
|
|
|
|
|
assert {'jicofo-auth-password': 'pw2',
|
|
|
|
|
'jicofo-component-secret': 'pw3',
|
|
|
|
|
'jvb-auth-password': 'pw1',
|
|
|
|
|
'mon-auth': {'grafana-cloud-password': 'password',
|
|
|
|
|
'grafana-cloud-user': 'user'}} == sut.c4k_mixin_auth
|
|
|
|
|
assert {
|
|
|
|
|
"jicofo-auth-password": "pw2",
|
|
|
|
|
"jicofo-component-secret": "pw3",
|
|
|
|
|
"jvb-auth-password": "pw1",
|
|
|
|
|
"mon-auth": {
|
|
|
|
|
"grafana-cloud-password": "password",
|
|
|
|
|
"grafana-cloud-user": "user",
|
|
|
|
|
},
|
|
|
|
|
} == sut.c4k_mixin_auth
|
|
|
|
|
|
|
|
|
|
sut.update_runtime_config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_c4k_build_should_calculate_command(tmp_path):
|
|
|
|
|
project = Project(str(tmp_path), name="test-project")
|
|
|
|
|
project_config = {
|
|
|
|
|
"stage": "test",
|
|
|
|
|
"project_root_path": "",
|
|
|
|
|
"module": "module",
|
|
|
|
|
"build_dir_name": "target",
|
|
|
|
|
}
|
|
|
|
|
add_c4k_mixin_config(
|
|
|
|
|
project_config,
|
|
|
|
|
{},
|
|
|
|
|
{},
|
|
|
|
|
grafana_cloud_user="user",
|
|
|
|
|
grafana_cloud_password="password",
|
|
|
|
|
)
|
|
|
|
|
sut = C4kBuild(Build(project, project_config), project, project_config)
|
|
|
|
|
assert (
|
|
|
|
|
"c4k-module-standalone.jar "
|
|
|
|
|
+ "/target/test-project/module/out_c4k_config.yaml "
|
|
|
|
|
+ "/target/test-project/module/out_c4k_auth.yaml > "
|
|
|
|
|
+ "/target/test-project/module/out_module.yaml"
|
|
|
|
|
== sut.command()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
project_config = {
|
|
|
|
|
"stage": "test",
|
|
|
|
|
"project_root_path": "",
|
|
|
|
|
"module": "module",
|
|
|
|
|
"build_dir_name": "target",
|
|
|
|
|
}
|
|
|
|
|
add_c4k_mixin_config(
|
|
|
|
|
project_config,
|
|
|
|
|
{},
|
|
|
|
|
{},
|
|
|
|
|
executabel_name = "executabel_name",
|
|
|
|
|
grafana_cloud_user="user",
|
|
|
|
|
grafana_cloud_password="password",
|
|
|
|
|
)
|
|
|
|
|
sut = C4kBuild(Build(project, project_config), project, project_config)
|
|
|
|
|
assert (
|
|
|
|
|
"c4k-executabel_name-standalone.jar "
|
|
|
|
|
+ "/target/test-project/module/out_c4k_config.yaml "
|
|
|
|
|
+ "/target/test-project/module/out_c4k_auth.yaml > "
|
|
|
|
|
+ "/target/test-project/module/out_module.yaml"
|
|
|
|
|
== sut.command()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|