@@ -903,6 +903,52 @@ def test_agent_engine_adk_telemetry_enablement(
903903 {"name" : key , "value" : value } for key , value in expected_env_vars .items ()
904904 ]
905905
906+ @mock .patch .object (_agent_engines_utils , "_prepare" )
907+ @pytest .mark .parametrize (
908+ "env_vars,expected_env_vars" ,
909+ [
910+ ({}, {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "unspecified" }),
911+ (None , {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "unspecified" }),
912+ (
913+ {"some_env" : "some_val" },
914+ {
915+ "some_env" : "some_val" ,
916+ GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "unspecified" ,
917+ },
918+ ),
919+ (
920+ {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "true" },
921+ {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "true" },
922+ ),
923+ (
924+ {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "false" },
925+ {GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY : "false" },
926+ ),
927+ ],
928+ )
929+ def test_agent_engine_adk_telemetry_enablement_through_source_packages (
930+ self ,
931+ mock_prepare : mock .Mock ,
932+ env_vars : dict [str , str ],
933+ expected_env_vars : dict [str , str ],
934+ ):
935+ config = self .client .agent_engines ._create_config (
936+ mode = "create" ,
937+ display_name = _TEST_AGENT_ENGINE_DISPLAY_NAME ,
938+ description = _TEST_AGENT_ENGINE_DESCRIPTION ,
939+ source_packages = [],
940+ class_methods = [],
941+ entrypoint_module = "." ,
942+ entrypoint_object = "." ,
943+ env_vars = env_vars ,
944+ agent_framework = "google-adk" ,
945+ )
946+ assert config ["display_name" ] == _TEST_AGENT_ENGINE_DISPLAY_NAME
947+ assert config ["description" ] == _TEST_AGENT_ENGINE_DESCRIPTION
948+ assert config ["spec" ]["deployment_spec" ]["env" ] == [
949+ {"name" : key , "value" : value } for key , value in expected_env_vars .items ()
950+ ]
951+
906952 @mock .patch .object (_agent_engines_utils , "_prepare" )
907953 def test_create_agent_engine_config_full (self , mock_prepare ):
908954 config = self .client .agent_engines ._create_config (
0 commit comments