Skip to content

Commit

Permalink
Update files
Browse files Browse the repository at this point in the history
  • Loading branch information
raminqaf committed May 24, 2024
1 parent 07b06fe commit 3fa68f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion kpops/api/kpops_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class KpopsResources(str, Enum):
PIPELINE = "pipeline"
DEFAULT = "default"
DEFAULTS = "defaults"
CONFIG = "config"

def as_yaml_file(self, suffix: str = "", prefix: str = "") -> str:
Expand Down
2 changes: 1 addition & 1 deletion kpops/utils/cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ def init_project(path: Path, conf_incl_opt: bool):
"""
create_config(KpopsResources.CONFIG.value, path, conf_incl_opt)
Path(path / KpopsResources.PIPELINE.as_yaml_file()).touch(exist_ok=False)
Path(path / KpopsResources.DEFAULT.as_yaml_file()).touch(exist_ok=False)
Path(path / KpopsResources.DEFAULTS.as_yaml_file()).touch(exist_ok=False)
29 changes: 17 additions & 12 deletions tests/components/test_base_defaults_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pydantic
import pytest

from kpops.api.kpops_resources import KpopsResources
from kpops.component_handlers import ComponentHandlers
from kpops.components.base_components.base_defaults_component import (
BaseDefaultsComponent,
Expand All @@ -16,6 +17,10 @@
from kpops.utils.environment import ENV
from tests.components import PIPELINE_BASE_DIR, RESOURCES_PATH

PIPELINE_YAML = KpopsResources.PIPELINE.as_yaml_file()

DEFAULTS_YAML = KpopsResources.DEFAULTS.as_yaml_file()


class Parent(BaseDefaultsComponent):
__test__ = False
Expand Down Expand Up @@ -86,9 +91,7 @@ class TestBaseDefaultsComponent:
def test_load_defaults(
self, component_class: type[BaseDefaultsComponent], defaults: dict
):
assert (
component_class.load_defaults(RESOURCES_PATH / "defaults.yaml") == defaults
)
assert component_class.load_defaults(RESOURCES_PATH / DEFAULTS_YAML) == defaults

@pytest.mark.parametrize(
("component_class", "defaults"),
Expand Down Expand Up @@ -117,8 +120,9 @@ def test_load_defaults_with_environment(
):
assert (
component_class.load_defaults(
RESOURCES_PATH / "defaults_development.yaml",
RESOURCES_PATH / "defaults.yaml",
RESOURCES_PATH
/ KpopsResources.DEFAULTS.as_yaml_file(prefix="development"),
RESOURCES_PATH / DEFAULTS_YAML,
)
== defaults
)
Expand Down Expand Up @@ -212,16 +216,17 @@ def test_merge_defaults(self, config: KpopsConfig, handlers: ComponentHandlers):
[
(
RESOURCES_PATH
/ "pipelines/test-distributed-defaults/pipeline-deep/pipeline.yaml",
/ "pipelines/test-distributed-defaults/pipeline-deep"
/ PIPELINE_YAML,
None,
[
Path(
f"{RESOURCES_PATH}/pipelines/test-distributed-defaults/pipeline-deep/defaults.yaml"
),
Path(
f"{RESOURCES_PATH}/pipelines/test-distributed-defaults/defaults.yaml"
),
Path(f"{RESOURCES_PATH}/defaults.yaml"),
f"{RESOURCES_PATH}/pipelines/test-distributed-defaults/pipeline-deep"
)
/ DEFAULTS_YAML,
Path(f"{RESOURCES_PATH}/pipelines/test-distributed-defaults")
/ DEFAULTS_YAML,
Path(RESOURCES_PATH) / DEFAULTS_YAML,
],
),
(
Expand Down

0 comments on commit 3fa68f3

Please sign in to comment.