def test_execute(self, mock_hook): op = CloudDataFusionDeleteInstanceOperator( task_id="test_taks", instance_name=INSTANCE_NAME, location=LOCATION, project_id=PROJECT_ID, ) op.execute({}) mock_hook.return_value.delete_instance.assert_called_once_with( instance_name=INSTANCE_NAME, location=LOCATION, project_id=PROJECT_ID ) assert mock_hook.return_value.wait_for_operation.call_count == 1
task_id="stop_pipeline", ) # [END howto_cloud_data_fusion_stop_pipeline] # [START howto_cloud_data_fusion_delete_pipeline] delete_pipeline = CloudDataFusionDeletePipelineOperator( location=LOCATION, pipeline_name=PIPELINE_NAME, instance_name=INSTANCE_NAME, task_id="delete_pipeline", ) # [END howto_cloud_data_fusion_delete_pipeline] # [START howto_cloud_data_fusion_delete_instance_operator] delete_instance = CloudDataFusionDeleteInstanceOperator( location=LOCATION, instance_name=INSTANCE_NAME, task_id="delete_instance") # [END howto_cloud_data_fusion_delete_instance_operator] # Add sleep before creating pipeline sleep = BashOperator(task_id="sleep", bash_command="sleep 60") create_instance >> get_instance >> restart_instance >> update_instance >> sleep (sleep >> create_pipeline >> list_pipelines >> start_pipeline_async >> start_pipeline_sensor >> start_pipeline >> stop_pipeline >> delete_pipeline) delete_pipeline >> delete_instance if __name__ == "__main__": dag.clear(dag_run_state=State.NONE) dag.run()