From bb832fbeaa27c2c1e2f2e38ab9f6bdf137286545 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 16 Jun 2019 21:21:27 +0200 Subject: [PATCH] Adjust testcase for new delete job behavior --- test/integration/test_kubernetes_runner.py | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/test/integration/test_kubernetes_runner.py b/test/integration/test_kubernetes_runner.py index 2880f8e0e46..d948343fe17 100644 --- a/test/integration/test_kubernetes_runner.py +++ b/test/integration/test_kubernetes_runner.py @@ -8,6 +8,8 @@ import subprocess import tempfile import time +import pytest + from base import integration_util # noqa: I100,I202 from base.populators import skip_without_tool from .test_containerized_jobs import MulledJobTestCases # noqa: I201 @@ -96,6 +98,12 @@ def job_config(jobs_directory): gx-short-id 10 + + jobs-directory-claim:$jobs_directory,tool-directory-claim:$tool_directory + $k8s_config_path + gx-short-id + never + @@ -112,12 +120,20 @@ def job_config(jobs_directory): busybox:ubuntu-14.04 42 + + 1.9 + 10M + true + busybox:ubuntu-14.04 + 42 + + """) @@ -222,8 +238,10 @@ class BaseKubernetesIntegrationTestCase(BaseJobEnvironmentIntegrationTestCase, M # Wait for job to be cancelled in kubernetes time.sleep(2) - status = json.loads(subprocess.check_output(['kubectl', 'get', 'job', external_id, '-o', 'json'])) - assert 'active' not in status['status'] + # The default job config removes jobs, didn't find a better way to check that the job doesn't exist anymore + with pytest.raises(subprocess.CalledProcessError) as excinfo: + subprocess.check_output(['kubectl', 'get', 'job', external_id, '-o', 'json'], stderr=subprocess.STDOUT) + assert "not found" in excinfo.value.output.decode() @skip_without_tool('job_properties') def test_exit_code_127(self): @@ -258,7 +276,7 @@ class BaseKubernetesIntegrationTestCase(BaseJobEnvironmentIntegrationTestCase, M @skip_without_tool('galaxy_slots_and_memory') def test_slots_and_memory(self): - self.dataset_populator.run_tool( + running_response = self.dataset_populator.run_tool( 'galaxy_slots_and_memory', {}, self.history_id, @@ -270,6 +288,13 @@ class BaseKubernetesIntegrationTestCase(BaseJobEnvironmentIntegrationTestCase, M MEM_PER_SLOT = '5' assert [CPU, MEM, MEM_PER_SLOT] == dataset_content.split('\n'), dataset_content + # Tool is mapped to destination without cleanup, make sure job still exists in kubernetes API + job_dict = running_response["jobs"][0] + job = self.galaxy_interactor.get("jobs/%s" % job_dict['id'], admin=True).json() + external_id = job['external_id'] + status = json.loads(subprocess.check_output(['kubectl', 'get', 'job', external_id, '-o', 'json'])) + assert 'active' not in status['status'] + @skip_without_tool('create_2') def test_walltime_limit(self): running_response = self.dataset_populator.run_tool(