code: def test_shutdown(ray_shutdown):
      ray.init(num_cpus=16)
      serve.start(http_options=dict(port=8003))
      gcs_client = GcsClient(
          address=ray.get_runtime_context().gcs_address
      )
      cluster_node_info_cache = create_cluster_node_info_cache(
          gcs_client
      )
      cluster_node_info_cache.update()
  
      @serve.deployment
      def f():
          pass
  
      serve.run(f.bind())
  
      actor_names = [
          SERVE_CONTROLLER_NAME,
          format_actor_name(
              SERVE_PROXY_NAME,
              cluster_node_info_cache.get_alive_nodes()[0][0],
          ),
      ]
  
      def check_alive():
          alive = True
          for actor_name in actor_names:
              try:
                  ray.get_actor(actor_name, namespace=SERVE_NAMESPACE)
              except ValueError:
                  alive = False
          return alive
  
      wait_for_condition(check_alive)
  
      serve.shutdown()
      with pytest.raises(RayServeException):
          _private_api.list_deployments()
  
      def check_dead():
          for actor_name in actor_names:
              try:
                  ray.get_actor(actor_name, namespace=SERVE_NAMESPACE)
                  return False
              except ValueError:
                  pass
          return True
  
      wait_for_condition(check_dead)
  
imports: import logging
  import os
  import socket
  import sys
  import time
  import pytest
  import requests
  import ray
  import ray._private.gcs_utils
  from ray import serve
  from ray._private.services import new_port
  from ray._private.test_utils import convert_actor_state, run_string_as_driver, wait_for_condition
  from ray._raylet import GcsClient
  from ray.cluster_utils import Cluster, cluster_not_supported
  from ray.serve._private import api
  from ray.serve._private.constants import SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE, SERVE_PROXY_NAME, SERVE_ROOT_URL_ENV_KEY
  from ray.serve._private.default_impl import create_cluster_node_info_cache
  from ray.serve._private.http_util import set_socket_reuse_port
  from ray.serve._private.utils import block_until_http_ready, format_actor_name
  from ray.serve.config import DeploymentMode, HTTPOptions, ProxyLocation
  from ray.serve.context import _get_global_client
  from ray.serve.exceptions import RayServeException
  from ray.serve.schema import ServeApplicationSchema, ServeDeploySchema
  from ray.tests.conftest import maybe_external_redis
  from ray.tests.conftest import ray_start_with_dashboard
  from ray.util.state import list_actors
label_desc: Use image node_id 3 for calling a global function with example usage: test_shutdown(ray_shutdown) and returns: alive, True, False