Unverified Commit 81781787 authored by mvdbeek's avatar mvdbeek
Browse files

Test deferred data with extended metadata and metadata files

And also test that option filters work correctly.
parent f8721ccb
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2729,6 +2729,22 @@ class ToolsTestCase(ApiTestCase, TestsTools):
        output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output)
        assert output_content.startswith("chr1	147962192	147962580	CCDS989.1_cds_0_0_chr1_147962193_r	0	-")

    @skip_without_tool("metadata_bam")
    @uses_test_history(require_new=False)
    def test_run_deferred_dataset_with_metadata_options_filter(self, history_id):
        details = self.dataset_populator.create_deferred_hda(
            history_id, "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bam", ext="bam"
        )
        inputs = {"input_bam": dataset_to_param(details), "ref_names": "chrM"}
        run_response = self.dataset_populator.run_tool(tool_id="metadata_bam", inputs=inputs, history_id=history_id)
        output = run_response["outputs"][0]
        details = self.dataset_populator.get_history_dataset_details(
            history_id, dataset=output, wait=True, assert_ok=True
        )
        assert details["state"] == "ok"
        output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output)
        assert output_content.startswith("chrM")

    @skip_without_tool("cat1")
    @uses_test_history(require_new=False)
    def test_run_deferred_mapping(self, history_id: str):
+31 −0
Original line number Diff line number Diff line
@@ -91,6 +91,37 @@ class ExtendedMetadataIntegrationTestCase(integration_util.IntegrationTestCase):
        assert dataset["created_from_basename"] == "4.bed"


class ExtendedMetadataDeferredIntegrationTestCase(integration_util.IntegrationTestCase):
    def setUp(self):
        super().setUp()
        self.dataset_populator = DatasetPopulator(self.galaxy_interactor)

    @classmethod
    def handle_galaxy_config_kwds(cls, config):
        config["metadata_strategy"] = "extended"
        config["object_store_store_by"] = "uuid"
        config["retry_metadata_internally"] = False

    def test_deferred_upload_with_metadata_files(self):
        history_id = self.dataset_populator.new_history()
        deferred_dataset = self.dataset_populator.create_deferred_hda(
            history_id=history_id,
            uri="https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bam",
            ext="bam",
        )
        inputs = {"input1": {"src": "hda", "id": deferred_dataset["id"]}}
        run_response = self.dataset_populator.run_tool("cat1", inputs=inputs, history_id=history_id)
        self.dataset_populator.wait_for_job(run_response["jobs"][0]["id"], assert_ok=True)
        bam_dataset = self.dataset_populator.get_history_dataset_details(
            history_id=history_id, content_id=run_response["outputs"][0]["id"]
        )
        assert bam_dataset["state"] == "ok"
        assert bam_dataset["extension"] == "bam"
        metadata_response = self._get(f"datasets/{bam_dataset['id']}/metadata_file?metadata_file=bam_index")
        metadata_response.raise_for_status()
        assert metadata_response.content.startswith(b"BAI")


class ExtendedMetadataIntegrationInstance(integration_util.IntegrationInstance):
    """Describe a Galaxy test instance with embedded pulsar configured."""