@@ -124,7 +124,7 @@ class TestDoWhile(TestConditionalNodeInPipeline):
124124 def test_pipeline_with_do_while_node (self , client : MLClient , randstr : Callable [[], str ]) -> None :
125125 params_override = [{"name" : randstr ('name' )}]
126126 pipeline_job = load_job (
127- "./tests/test_configs/dsl_pipeline/pipeline_with_do_while /pipeline.yml" ,
127+ "./tests/test_configs/pipeline_jobs/control_flow/do_while /pipeline.yml" ,
128128 params_override = params_override ,
129129 )
130130 created_pipeline = assert_job_cancel (pipeline_job , client )
@@ -138,7 +138,7 @@ def test_pipeline_with_do_while_node(self, client: MLClient, randstr: Callable[[
138138 def test_do_while_pipeline_with_primitive_inputs (self , client : MLClient , randstr : Callable [[], str ]) -> None :
139139 params_override = [{"name" : randstr ('name' )}]
140140 pipeline_job = load_job (
141- "./tests/test_configs/dsl_pipeline/pipeline_with_do_while /pipeline_with_primitive_inputs.yml" ,
141+ "./tests/test_configs/pipeline_jobs/control_flow/do_while /pipeline_with_primitive_inputs.yml" ,
142142 params_override = params_override ,
143143 )
144144 created_pipeline = assert_job_cancel (pipeline_job , client )
@@ -208,3 +208,42 @@ def test_output_binding_foreach_node(self, client: MLClient, randstr: Callable):
208208 'type' : 'parallel_for'
209209 }
210210 assert_foreach (client , randstr ("job_name" ), source , expected_node )
211+
212+
213+ def assert_control_flow_in_pipeline_component (client , component_path , pipeline_path ):
214+ params_override = [{"component" : component_path }]
215+ pipeline_job = load_job (
216+ pipeline_path ,
217+ params_override = params_override ,
218+ )
219+ created_pipeline = assert_job_cancel (pipeline_job , client )
220+ pipeline_job_dict = created_pipeline ._to_rest_object ().as_dict ()
221+
222+ pipeline_job_dict = omit_with_wildcard (pipeline_job_dict , * omit_fields )
223+ assert pipeline_job_dict ["properties" ]["jobs" ] == {}
224+
225+
226+ class TestControlFLowPipelineComponent (TestConditionalNodeInPipeline ):
227+ def test_if_else (self , client : MLClient , randstr : Callable [[], str ]):
228+ assert_control_flow_in_pipeline_component (
229+ client = client ,
230+ component_path = "./if_else/simple_pipeline.yml" ,
231+ pipeline_path = "./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml"
232+ )
233+
234+ @pytest .mark .skip (
235+ reason = "TODO(2177353): check why recorded tests failure."
236+ )
237+ def test_do_while (self , client : MLClient , randstr : Callable [[], str ]):
238+ assert_control_flow_in_pipeline_component (
239+ client = client ,
240+ component_path = "./do_while/pipeline_component.yml" ,
241+ pipeline_path = "./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml"
242+ )
243+
244+ def test_foreach (self , client : MLClient , randstr : Callable [[], str ]):
245+ assert_control_flow_in_pipeline_component (
246+ client = client ,
247+ component_path = "./parallel_for/simple_pipeline.yml" ,
248+ pipeline_path = "./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml"
249+ )
0 commit comments