diff --git a/lib/galaxy_test/api/test_workflows.py b/lib/galaxy_test/api/test_workflows.py index 36549c820015..f0af906260e7 100644 --- a/lib/galaxy_test/api/test_workflows.py +++ b/lib/galaxy_test/api/test_workflows.py @@ -38,6 +38,7 @@ ) from galaxy_test.base.workflow_fixtures import ( NESTED_WORKFLOW_WITH_CONDITIONAL_SUBWORKFLOW_AND_DISCONNECTED_MAP_OVER_SOURCE, + WORKFLOW_FLAT_CROSS_PRODUCT, WORKFLOW_INPUTS_AS_OUTPUTS, WORKFLOW_NESTED_REPLACEMENT_PARAMETER, WORKFLOW_NESTED_RUNTIME_PARAMETER, @@ -2079,15 +2080,12 @@ def test_run_workflow_pick_value_bam_pja(self): change_datatype: bam tool_state: style_cond: - __current_case__: 2 pick_style: first_or_error type_cond: - __current_case__: 4 param_type: data pick_from: - - __index__: 0 - value: - __class__: RuntimeValue + - value: + __class__: RuntimeValue outputs: pick_out: outputSource: pick_value/data_param @@ -5114,6 +5112,89 @@ def test_run_with_default_file_in_step_inline(self): content = self.dataset_populator.get_history_dataset_content(history_id) assert "chr1" in content + def test_conditional_flat_crossproduct_subworkflow(self): + parent = yaml.safe_load( + """ +class: GalaxyWorkflow +inputs: + collection_a: collection + collection_b: collection + collection_c: collection +steps: + subworkflow_step: + run: null + in: + collection_a: collection_a + collection_b: collection_b + when: $(false) + pick_value: + tool_id: pick_value + in: + style_cond|type_cond|pick_from_0|value: + source: subworkflow_step/output_a + style_cond|type_cond|pick_from_1|value: + # we need a collection of same length as fallback, + # which makes this less intuitive than it could be. + source: collection_c + tool_state: + style_cond: + pick_style: first + type_cond: + param_type: data + pick_from: + - value: + __class__: RuntimeValue + - value: + __class__: RuntimeValue +outputs: + the_output: + outputSource: pick_value/data_param +test_data: + collection_a: + collection_type: list + elements: + - identifier: A + content: A + - identifier: B + content: B + collection_b: + collection_type: list + elements: + - identifier: C + content: C + - identifier: D + content: D + collection_c: + collection_type: list + elements: + - identifier: fallbackA + content: fallbackA + - identifier: fallbackBB + content: fallbackB + - identifier: fallbackC + content: fallbackC + - identifier: fallbackD + content: fallbackD +""" + ) + parent["steps"]["subworkflow_step"]["run"] = yaml.safe_load(WORKFLOW_FLAT_CROSS_PRODUCT) + with self.dataset_populator.test_history() as history_id: + summary = self._run_workflow( + parent, + history_id=history_id, + wait=True, + assert_ok=True, + ) + invocation = self.workflow_populator.get_invocation(summary.invocation_id, step_details=True) + hdca_id = invocation["output_collections"]["the_output"]["id"] + hdca = self.dataset_populator.get_history_collection_details( + history_id=history_id, + content_id=hdca_id, + ) + # Following assert is what user would expect, but heuristic currently picks first input element as identifier source + # assert hdca["elements"][0]["element_identifier"] == "fallbackA" + assert "fallbackA" in hdca["elements"][0]["object"]["peek"] + def test_run_with_validated_parameter_connection_invalid(self): with self.dataset_populator.test_history() as history_id: self._run_jobs( diff --git a/lib/galaxy_test/base/workflow_fixtures.py b/lib/galaxy_test/base/workflow_fixtures.py index 912adecb32f9..4efb06f8ba92 100644 --- a/lib/galaxy_test/base/workflow_fixtures.py +++ b/lib/galaxy_test/base/workflow_fixtures.py @@ -1177,3 +1177,24 @@ format: txt location: https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bed """ + + +WORKFLOW_FLAT_CROSS_PRODUCT = """ +class: GalaxyWorkflow +inputs: + collection_a: collection + collection_b: collection +steps: + cross_product: + tool_id: __CROSS_PRODUCT_FLAT__ + in: + input_a: + collection_a + input_b: + collection_b +outputs: + output_a: + outputSource: cross_product/output_a + output_b: + outputSource: cross_product/output_b +"""