From cfb94e0211408b6ef2c23cbf66084ee37ea592c5 Mon Sep 17 00:00:00 2001 From: Ramin Gharib Date: Mon, 18 Sep 2023 14:11:31 +0200 Subject: [PATCH] add review --- .../base_components/kafka_connector.py | 18 +++++++----------- tests/components/test_kafka_connector.py | 4 +--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/kpops/components/base_components/kafka_connector.py b/kpops/components/base_components/kafka_connector.py index 29d889ef8..776f2c287 100644 --- a/kpops/components/base_components/kafka_connector.py +++ b/kpops/components/base_components/kafka_connector.py @@ -101,7 +101,7 @@ def helm(self) -> Helm: return helm @property - def _connector_resetter_release_name(self) -> str: + def _resetter_release_name(self) -> str: """Get connector resetter's release name""" suffix = "-clean" clean_up_release_name = self.full_name + suffix @@ -188,9 +188,7 @@ def _run_connect_resetter( f"Connector Cleanup: uninstalling cleanup job Helm release from previous runs for {self.full_name}" ) ) - self.__uninstall_connect_resetter( - self._connector_resetter_release_name, dry_run - ) + self.__uninstall_connect_resetter(self._resetter_release_name, dry_run) log.info( magentaify( @@ -202,14 +200,12 @@ def _run_connect_resetter( if dry_run: self.dry_run_handler.print_helm_diff( - stdout, self._connector_resetter_release_name, log + stdout, self._resetter_release_name, log ) if not retain_clean_jobs: log.info(magentaify("Connector Cleanup: uninstall Kafka Resetter.")) - self.__uninstall_connect_resetter( - self._connector_resetter_release_name, dry_run - ) + self.__uninstall_connect_resetter(self._resetter_release_name, dry_run) def __install_connect_resetter( self, @@ -225,7 +221,7 @@ def __install_connect_resetter( :return: The output of `helm upgrade --install` """ return self.helm.upgrade_install( - release_name=self._connector_resetter_release_name, + release_name=self._resetter_release_name, namespace=self.namespace, chart=self._resetter_helm_chart, dry_run=dry_run, @@ -300,7 +296,7 @@ def template(self) -> None: offset_topic=self.offset_topic, ) stdout = self.helm.template( - self._connector_resetter_release_name, + self._resetter_release_name, self._resetter_helm_chart, self.namespace, values, @@ -345,7 +341,7 @@ def add_input_topics(self, topics: list[str]) -> None: def template(self) -> None: values = self._get_kafka_connect_resetter_values() stdout = self.helm.template( - self._connector_resetter_release_name, + self._resetter_release_name, self._resetter_helm_chart, self.namespace, values, diff --git a/tests/components/test_kafka_connector.py b/tests/components/test_kafka_connector.py index 6d5ac9c8c..912f449fb 100644 --- a/tests/components/test_kafka_connector.py +++ b/tests/components/test_kafka_connector.py @@ -12,9 +12,7 @@ DEFAULTS_PATH = Path(__file__).parent / "resources" CONNECTOR_NAME = "test-connector-with-long-name-0123456789abcdefghijklmnop" -CONNECTOR_FULL_NAME = ( - "${pipeline_name}-test-connector-with-long-name-0123456789abcdefghijklmnop" -) +CONNECTOR_FULL_NAME = "${pipeline_name}-" + CONNECTOR_NAME CONNECTOR_CLEAN_FULL_NAME = "${pipeline_name}-test-connector-with-long-name-clean" CONNECTOR_CLASS = "com.bakdata.connect.TestConnector"