Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raminqaf committed Jul 15, 2024
1 parent b031585 commit 49cd883
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
10 changes: 3 additions & 7 deletions kpops/components/streams_bootstrap/producer/producer_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ def helm_chart(self) -> str:
f"{self.repo_config.repository_name}/{AppType.CLEANUP_PRODUCER_APP.value}"
)

@override
async def clean(self, dry_run: bool) -> None:
await super().clean(dry_run)


class ProducerApp(KafkaApp, StreamsBootstrap):
"""Producer component.
Expand Down Expand Up @@ -110,10 +106,10 @@ async def destroy(self, dry_run: bool) -> None:
self.namespace, self.helm_release_name
)
if cluster_values:
release_name = self._cleaner.helm_release_name
self._cleaner.app = self.app.model_validate(cluster_values)
self._cleaner.app.name_override = release_name
log.debug("Fetched helm chart values from cluster")
name_override = self._cleaner.helm_name_override
self._cleaner.app = self.app.model_validate(cluster_values)
self._cleaner.app.name_override = name_override

await super().destroy(dry_run)

Expand Down
6 changes: 3 additions & 3 deletions kpops/components/streams_bootstrap/streams/streams_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ async def destroy(self, dry_run: bool) -> None:
self.namespace, self.helm_release_name
)
if cluster_values:
release_name = self._cleaner.helm_release_name
self._cleaner.app = self.app.model_validate(cluster_values)
self._cleaner.app.name_override = release_name
log.debug("Fetched helm chart values from cluster")
name_override = self._cleaner.helm_name_override
self._cleaner.app = self.app.model_validate(cluster_values)
self._cleaner.app.name_override = name_override

await super().destroy(dry_run)

Expand Down
2 changes: 1 addition & 1 deletion tests/components/test_producer_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ def test_get_output_topics(
]

@pytest.mark.asyncio()
@pytest.mark.skip("Cannot be tested with only calling clean.")
async def test_should_deploy_clean_up_job_with_values_in_cluster_when_clean(
self,
config: KpopsConfig,
Expand Down Expand Up @@ -433,6 +432,7 @@ async def test_should_deploy_clean_up_job_with_values_in_cluster_when_clean(
},
},
)
mocker.patch.object(producer_app.helm, "uninstall")
mocker.patch.object(producer_app._cleaner.dry_run_handler, "print_helm_diff")
mocker.patch.object(producer_app._cleaner.helm, "uninstall")

Expand Down
3 changes: 2 additions & 1 deletion tests/components/test_streams_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ async def test_should_clean_streams_app_and_deploy_clean_up_job_and_delete_clean
)

@pytest.mark.asyncio()
@pytest.mark.skip("Cannot be tested with only calling clean.")
async def test_should_deploy_clean_up_job_with_values_in_cluster(
self,
config: KpopsConfig,
Expand Down Expand Up @@ -745,6 +744,8 @@ async def test_should_deploy_clean_up_job_with_values_in_cluster(
},
)

mocker.patch.object(streams_app.helm, "uninstall")

mock_helm_upgrade_install = mocker.patch.object(
streams_app._cleaner.helm, "upgrade_install"
)
Expand Down

0 comments on commit 49cd883

Please sign in to comment.