diff --git a/Makefile b/Makefile index 7434d33ea..23086e7e3 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,7 @@ test_docker: .PHONY: test_coverage test_coverage: @echo ----- Testing code coverage ----- - coverage run --source=kapitan --omit="*reclass*" -m unittest discover - coverage report --fail-under=65 -m + python tests/vault_server.py .PHONY: test_formatting test_formatting: diff --git a/kapitan/inventory/omegaconf.py b/kapitan/inventory/omegaconf_inv.py similarity index 98% rename from kapitan/inventory/omegaconf.py rename to kapitan/inventory/omegaconf_inv.py index ddec9032c..625afb494 100644 --- a/kapitan/inventory/omegaconf.py +++ b/kapitan/inventory/omegaconf_inv.py @@ -380,4 +380,9 @@ def load_config(self, path: str): return [], {} classes = OmegaConf.create(config.get("classes", [])) parameters = OmegaConf.create(config.get("parameters", {})) + + # add metadata to nodes + filename = os.path.splitext(os.path.split(path)[1])[0] + parameters._set_flag(["filename", "path"], [filename, path], recursive=True) + return classes, parameters diff --git a/kapitan/resources.py b/kapitan/resources.py index 0b8e6536e..d52de2339 100644 --- a/kapitan/resources.py +++ b/kapitan/resources.py @@ -22,7 +22,7 @@ import kapitan.cached as cached from kapitan import __file__ as kapitan_install_path from kapitan.errors import CompileError, InventoryError, KapitanError -from kapitan.inventory.omegaconf import OmegaConfBackend +from kapitan.inventory.omegaconf_inv import OmegaConfBackend from kapitan.inventory.reclass import ReclassBackend from kapitan.utils import ( PrettyDumper, diff --git a/tests/test_omegaconf.py b/tests/test_omegaconf.py index cebb6c0a7..7e30c3fb9 100644 --- a/tests/test_omegaconf.py +++ b/tests/test_omegaconf.py @@ -8,7 +8,7 @@ import yaml -from kapitan.inventory.omegaconf import OmegaConfBackend +from kapitan.inventory.omegaconf_inv import OmegaConfBackend class OmegaConfMigrationTest(unittest.TestCase): diff --git a/tests/vault_server.py b/tests/vault_server.py index d642c55d2..528510c84 100644 --- a/tests/vault_server.py +++ b/tests/vault_server.py @@ -141,3 +141,19 @@ def get_policy(self): } """ return test_policy + + +try: + server = VaultServer("", "test_vaultkv") + server.setup_vault() +except Exception as e: + print("logs:") + for log in server.container.logs().decode().split("\n"): + print(log) + raise e +finally: + server.container.stop() + server.docker_client.close() + +# coverage run --source=kapitan --omit="*reclass*" -m unittest discover +# coverage report --fail-under=65 -m