Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions tests/unit/vertexai/genai/test_agent_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,47 @@ def test_create_agent_engine_config_with_source_packages(
== _TEST_AGENT_ENGINE_IDENTITY_TYPE_SERVICE_ACCOUNT
)

def test_create_agent_engine_config_with_developer_connect_source(self):
with tempfile.TemporaryDirectory() as tmpdir:
requirements_file_path = os.path.join(tmpdir, "requirements.txt")
with open(requirements_file_path, "w") as f:
f.write("requests==2.0.0")
developer_connect_source = {
"git_repository_link": "projects/test-project/locations/us-central1/connections/test-connection/gitRepositoryLinks/test-repo",
"revision": "main",
"dir": "agent",
}
config = self.client.agent_engines._create_config(
mode="create",
display_name=_TEST_AGENT_ENGINE_DISPLAY_NAME,
description=_TEST_AGENT_ENGINE_DESCRIPTION,
developer_connect_source=developer_connect_source,
entrypoint_module="main",
entrypoint_object="app",
requirements_file=requirements_file_path,
class_methods=_TEST_AGENT_ENGINE_CLASS_METHODS,
agent_framework=_TEST_AGENT_FRAMEWORK,
identity_type=_TEST_AGENT_ENGINE_IDENTITY_TYPE_SERVICE_ACCOUNT,
python_version=_TEST_PYTHON_VERSION_OVERRIDE,
)
assert config["display_name"] == _TEST_AGENT_ENGINE_DISPLAY_NAME
assert config["description"] == _TEST_AGENT_ENGINE_DESCRIPTION
assert config["spec"]["agent_framework"] == _TEST_AGENT_FRAMEWORK
assert config["spec"]["source_code_spec"] == {
"developer_connect_source": {"config": developer_connect_source},
"python_spec": {
"version": _TEST_PYTHON_VERSION_OVERRIDE,
"entrypoint_module": "main",
"entrypoint_object": "app",
"requirements_file": requirements_file_path,
},
}
assert config["spec"]["class_methods"] == _TEST_AGENT_ENGINE_CLASS_METHODS
assert (
config["spec"]["identity_type"]
== _TEST_AGENT_ENGINE_IDENTITY_TYPE_SERVICE_ACCOUNT
)

@mock.patch.object(
_agent_engines_utils,
"_create_base64_encoded_tarball",
Expand Down Expand Up @@ -1824,6 +1865,7 @@ def test_create_agent_engine_with_env_vars_dict(
labels=None,
class_methods=None,
source_packages=None,
developer_connect_source=None,
entrypoint_module=None,
entrypoint_object=None,
requirements_file=None,
Expand Down Expand Up @@ -1924,6 +1966,7 @@ def test_create_agent_engine_with_custom_service_account(
agent_server_mode=None,
class_methods=None,
source_packages=None,
developer_connect_source=None,
entrypoint_module=None,
entrypoint_object=None,
requirements_file=None,
Expand Down Expand Up @@ -2023,6 +2066,7 @@ def test_create_agent_engine_with_experimental_mode(
agent_server_mode=_genai_types.AgentServerMode.EXPERIMENTAL,
class_methods=None,
source_packages=None,
developer_connect_source=None,
entrypoint_module=None,
entrypoint_object=None,
requirements_file=None,
Expand Down Expand Up @@ -2191,6 +2235,7 @@ def test_create_agent_engine_with_class_methods(
agent_server_mode=None,
class_methods=_TEST_AGENT_ENGINE_CLASS_METHODS,
source_packages=None,
developer_connect_source=None,
entrypoint_module=None,
entrypoint_object=None,
requirements_file=None,
Expand Down Expand Up @@ -2284,6 +2329,7 @@ def test_create_agent_engine_with_agent_framework(
agent_server_mode=None,
class_methods=None,
source_packages=None,
developer_connect_source=None,
entrypoint_module=None,
entrypoint_object=None,
requirements_file=None,
Expand Down
Loading
Loading