code: def test_deployment(ray_cluster):
      # https://github.com/ray-project/ray/issues/11437
  
      cluster = ray_cluster
      head_node = cluster.add_node(num_cpus=6)
  
      # Create first job, check we can run a simple serve endpoint
      ray.init(head_node.address, namespace=SERVE_NAMESPACE)
      first_job_id = ray.get_runtime_context().get_job_id()
      serve.start()
  
      @serve.deployment
      def f(*args):
          return "from_f"
  
      handle = serve.run(f.bind(), name="f", route_prefix="/say_hi_f")
      handle = handle.options(use_new_handle_api=True)
      assert handle.remote().result() == "from_f"
      assert (
          requests.get("http://localhost:8000/say_hi_f").text
          == "from_f"
      )
  
      serve.context._global_client = None
      ray.shutdown()
  
      # Create the second job, make sure we can still create new deployments.
      ray.init(head_node.address, namespace="serve")
      assert ray.get_runtime_context().get_job_id() != first_job_id
  
      @serve.deployment
      def g(*args):
          return "from_g"
  
      handle = serve.run(g.bind(), name="g", route_prefix="/say_hi_g")
      handle = handle.options(use_new_handle_api=True)
      assert handle.remote().result() == "from_g"
      assert (
          requests.get("http://localhost:8000/say_hi_g").text
          == "from_g"
      )
      assert (
          requests.get("http://localhost:8000/say_hi_f").text
          == "from_f"
      )
  
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 6 for calling a global function with example usage: test_deployment(ray_cluster) and returns: str, str