Skip to content

Commit

Permalink
dont clean failing job
Browse files Browse the repository at this point in the history
  • Loading branch information
stathischaritos committed Jun 24, 2022
1 parent eee5e72 commit 994028e
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions test/test_kubernetes_job_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,37 +63,6 @@ def test_job_definition_as_yaml():
assert yaml_as_dict["spec"]["template"]["spec"]["volumes"] == []


@patch("kubeluigi.run_and_track_job")
@patch("kubeluigi.clean_job_resources")
@patch.object(KubernetesJobTask, "build_job_definition")
@patch.object(KubernetesJobTask, "_init_kubernetes")
def test_failing_task_clean_resources(
mocked_init_kubernetes,
mocked_build_job_definition,
mocked_clean_job_resources,
mocked_run_and_track_job,
):
"""
testing k8s resources are cleaned when running job fails.
"""
task = DummyTask()
task._init_task_metadata()
task.kubernetes_client = MagicMock()
task._KubernetesJobTask__logger = MagicMock()

class DummyException(Exception):
pass

e = DummyException()
mocked_run_and_track_job.side_effect = e
with pytest.raises(DummyException):
task.run()

mocked_build_job_definition.assert_called_once()
mocked_clean_job_resources.assert_called_once()
mocked_clean_job_resources.assert_called_once()


def test_name_not_implemented():
task = KubernetesJobTask()

Expand Down

0 comments on commit 994028e

Please sign in to comment.