From 64adb9d3b47a3e4b2b96ee4ee1e3ccb6d1374a10 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 9 Jun 2024 08:48:20 +0200 Subject: [PATCH] Fix up test cases Add a sleep so we can delay output purging until command line is templated. If we don't sleep we generate a command line where the output path is just `''`. That needs another fix! --- test/functional/tools/all_output_types.xml | 10 +++- test/integration/test_extended_metadata.py | 5 ++ test/integration/test_pulsar_embedded_mq.py | 60 +++++++++++++++------ 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/test/functional/tools/all_output_types.xml b/test/functional/tools/all_output_types.xml index 1914c3b6009a..58cd10e8a4a9 100644 --- a/test/functional/tools/all_output_types.xml +++ b/test/functional/tools/all_output_types.xml @@ -1,7 +1,9 @@ output.txt && - cp output.txt '$static_output' && + echo hi > '$static_output' && + echo hi > '$static_output_2' && cp '$c1' galaxy.json ]]> @@ -12,9 +14,13 @@ "info": "my dynamic info" }} - + + + + + diff --git a/test/integration/test_extended_metadata.py b/test/integration/test_extended_metadata.py index ea433f5c2fab..2b0ef2704baa 100644 --- a/test/integration/test_extended_metadata.py +++ b/test/integration/test_extended_metadata.py @@ -5,6 +5,7 @@ LibraryPopulator, ) from galaxy_test.driver import integration_util +from .objectstore.test_purged_handling import purge_while_job_running TEST_TOOL_IDS = [ "from_work_dir_glob", @@ -47,6 +48,7 @@ class TestExtendedMetadataIntegration(integration_util.IntegrationTestCase): dataset_populator: DatasetPopulator + framework_tool_and_types = True def setUp(self): super().setUp() @@ -95,6 +97,9 @@ def test_fetch_data_library(self): assert dataset["file_ext"] == "bed", dataset assert dataset["created_from_basename"] == "4.bed" + def test_purge_while_job_running(self): + purge_while_job_running(self.dataset_populator) + class TestExtendedMetadataDeferredIntegration(integration_util.IntegrationTestCase): dataset_populator: DatasetPopulator diff --git a/test/integration/test_pulsar_embedded_mq.py b/test/integration/test_pulsar_embedded_mq.py index e0b9e156992b..14f448e0064c 100644 --- a/test/integration/test_pulsar_embedded_mq.py +++ b/test/integration/test_pulsar_embedded_mq.py @@ -7,7 +7,9 @@ import pytest from galaxy.util import safe_makedirs +from galaxy_test.base.populators import DatasetPopulator from galaxy_test.driver import integration_util +from .objectstore.test_purged_handling import purge_while_job_running SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) EMBEDDED_PULSAR_JOB_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "embedded_pulsar_mq_job_conf.yml") @@ -46,6 +48,40 @@ """ +def _handle_galaxy_config_kwds(cls, config): + amqp_url = os.environ.get("GALAXY_TEST_AMQP_URL", None) + if amqp_url is None: + pytest.skip("External AMQP URL not configured for test") + + jobs_directory = os.path.join(cls._test_driver.mkdtemp(), "pulsar_staging") + safe_makedirs(jobs_directory) + job_conf_template = string.Template(JOB_CONF_TEMPLATE) + job_conf_str = job_conf_template.substitute( + amqp_url=AMQP_URL, jobs_directory=jobs_directory, galaxy_home=os.path.join(SCRIPT_DIRECTORY, os.pardir) + ) + with tempfile.NamedTemporaryFile(suffix="_mq_job_conf.yml", mode="w", delete=False) as job_conf: + job_conf.write(job_conf_str) + config["job_config_file"] = job_conf.name + infrastructure_url = "http://localhost:$GALAXY_WEB_PORT" + config["galaxy_infrastructure_url"] = infrastructure_url + + +class TestEmbeddedMessageQueuePulsarPurge(integration_util.IntegrationTestCase): + dataset_populator: DatasetPopulator + framework_tool_and_types = True + + def setUp(self) -> None: + super().setUp() + self.dataset_populator = DatasetPopulator(self.galaxy_interactor) + + @classmethod + def handle_galaxy_config_kwds(cls, config): + _handle_galaxy_config_kwds(cls, config) + + def test_purge_while_job_running(self): + purge_while_job_running(self.dataset_populator) + + class EmbeddedMessageQueuePulsarIntegrationInstance(integration_util.IntegrationInstance): """Describe a Galaxy test instance with embedded pulsar configured. @@ -53,27 +89,19 @@ class EmbeddedMessageQueuePulsarIntegrationInstance(integration_util.Integration $ GALAXY_TEST_AMQP_URL='amqp://guest:guest@localhost:5672//' pytest -s test/integration/test_pulsar_embedded_mq.py """ + dataset_populator: DatasetPopulator framework_tool_and_types = True @classmethod def handle_galaxy_config_kwds(cls, config): - amqp_url = os.environ.get("GALAXY_TEST_AMQP_URL", None) - if amqp_url is None: - pytest.skip("External AMQP URL not configured for test") - - jobs_directory = os.path.join(cls._test_driver.mkdtemp(), "pulsar_staging") - safe_makedirs(jobs_directory) - job_conf_template = string.Template(JOB_CONF_TEMPLATE) - job_conf_str = job_conf_template.substitute( - amqp_url=AMQP_URL, jobs_directory=jobs_directory, galaxy_home=os.path.join(SCRIPT_DIRECTORY, os.pardir) - ) - with tempfile.NamedTemporaryFile(suffix="_mq_job_conf.yml", mode="w", delete=False) as job_conf: - job_conf.write(job_conf_str) - config["job_config_file"] = job_conf.name - infrastructure_url = "http://localhost:$GALAXY_WEB_PORT" - config["galaxy_infrastructure_url"] = infrastructure_url + _handle_galaxy_config_kwds(cls, config) + + def test_purge_while_job_running(self): + purge_while_job_running(self.dataset_populator) instance = integration_util.integration_module_instance(EmbeddedMessageQueuePulsarIntegrationInstance) -test_tools = integration_util.integration_tool_runner(["simple_constructs", "composite_output_tests"]) +test_tools = integration_util.integration_tool_runner( + ["simple_constructs", "composite_output_tests", "all_output_types"] +)