code: def test_deploy_through_config_fail(check_obj_ref_ready_nowait):
      """Test fail to deploy through config.
      Deploy obj ref errors out, so status should transition to deploy failed.
      """
      kv_store = MockKVStore()
      deployment_state_manager = MockDeploymentStateManager(kv_store)
      app_state_manager = ApplicationStateManager(
          deployment_state_manager, MockEndpointState(), kv_store
      )
      # Deploy config
      app_state_manager.deploy_config(
          name="test_app", app_config=Mock()
      )
      app_state = app_state_manager._application_states["test_app"]
      assert app_state.status == ApplicationStatus.DEPLOYING
  
      # Before object ref is ready
      check_obj_ref_ready_nowait.return_value = False
      app_state.update()
      assert app_state._build_app_task_info
      assert app_state.status == ApplicationStatus.DEPLOYING
      app_state.update()
      assert app_state.status == ApplicationStatus.DEPLOYING
  
      # Object ref is ready, and the task has called apply_deployment_args
      check_obj_ref_ready_nowait.return_value = True
      app_state.update()
      assert app_state.status == ApplicationStatus.DEPLOY_FAILED
      assert (
          "failed" in app_state._status_msg
          or "error" in app_state._status_msg
      )
  
imports: import sys
  from typing import Dict, List, Tuple
  from unittest.mock import Mock, PropertyMock, patch
  import pytest
  from ray.exceptions import RayTaskError
  from ray.serve._private.application_state import ApplicationState, ApplicationStateManager, override_deployment_info
  from ray.serve._private.common import ApplicationStatus, DeploymentID, DeploymentStatus, DeploymentStatusInfo, DeploymentStatusTrigger
  from ray.serve._private.config import DeploymentConfig, ReplicaConfig
  from ray.serve._private.deploy_utils import deploy_args_to_deployment_info
  from ray.serve._private.deployment_info import DeploymentInfo
  from ray.serve._private.test_utils import MockKVStore
  from ray.serve._private.utils import get_random_string
  from ray.serve.exceptions import RayServeException
  from ray.serve.schema import DeploymentSchema, ServeApplicationSchema
label_desc: Use image node_id 10 for calling a global function with example usage: test_deploy_through_config_fail(check_obj_ref_ready_nowait) without return types