diff --git a/src/promptflow/promptflow/_sdk/operations/_test_submitter.py b/src/promptflow/promptflow/_sdk/operations/_test_submitter.py index c9afb89aad1b..4137d53e02f5 100644 --- a/src/promptflow/promptflow/_sdk/operations/_test_submitter.py +++ b/src/promptflow/promptflow/_sdk/operations/_test_submitter.py @@ -10,6 +10,7 @@ from types import GeneratorType from typing import Any, Mapping +from promptflow._internal import ConnectionManager from promptflow._sdk._constants import LOGGER_NAME, PROMPT_FLOW_DIR_NAME from promptflow._sdk._utils import dump_flow_result, parse_variant from promptflow._sdk.entities._flow import Flow @@ -149,12 +150,14 @@ def flow_test( if not connections: connections = SubmitterHelper.resolve_connections(flow=self.flow, client=self._client) + credential_list = ConnectionManager(connections).get_secret_list() + # resolve environment variables SubmitterHelper.resolve_environment_variables(environment_variables=environment_variables, client=self._client) environment_variables = environment_variables if environment_variables else {} SubmitterHelper.init_env(environment_variables=environment_variables) - with LoggerOperations(file_path=self.flow.code / PROMPT_FLOW_DIR_NAME / "flow.log", stream=stream_log): + with LoggerOperations(file_path=self.flow.code / PROMPT_FLOW_DIR_NAME / "flow.log", stream=stream_log, credential_list=credential_list): storage = DefaultRunStorage(base_dir=self.flow.code, sub_dir=Path(".promptflow/intermediate")) flow_executor = FlowExecutor.create( self.flow.path, connections, self.flow.code, storage=storage, raise_ex=False @@ -190,11 +193,13 @@ def node_test( from promptflow.executor import FlowExecutor connections = SubmitterHelper.resolve_connections(flow=self.flow, client=self._client) + credential_list = ConnectionManager(connections).get_secret_list() + # resolve environment variables SubmitterHelper.resolve_environment_variables(environment_variables=environment_variables, client=self._client) SubmitterHelper.init_env(environment_variables=environment_variables) - with LoggerOperations(file_path=self.flow.code / PROMPT_FLOW_DIR_NAME / f"{node_name}.node.log", stream=stream): + with LoggerOperations(file_path=self.flow.code / PROMPT_FLOW_DIR_NAME / f"{node_name}.node.log", stream=stream, credential_list=credential_list): result = FlowExecutor.load_and_exec_node( self.flow.path, node_name,