code: def test_controller_failure(serve_instance):
      @serve.deployment(name="controller_failure")
      def function(_):
          return "hello1"
  
      serve.run(function.bind())
  
      assert (
          request_with_retries("/controller_failure/", timeout=1).text
          == "hello1"
      )
  
      for _ in range(10):
          response = request_with_retries(
              "/controller_failure/", timeout=30
          )
          assert response.text == "hello1"
  
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
  
      for _ in range(10):
          response = request_with_retries(
              "/controller_failure/", timeout=30
          )
          assert response.text == "hello1"
  
      def function2(_):
          return "hello2"
  
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
  
      serve.run(function.options(func_or_class=function2).bind())
  
      def check_controller_failure():
          response = request_with_retries(
              "/controller_failure/", timeout=30
          )
          return response.text == "hello2"
  
      wait_for_condition(check_controller_failure)
  
      @serve.deployment(name="controller_failure_2")
      def function3(_):
          return "hello3"
  
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
      serve.run(function3.bind())
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
  
      for _ in range(10):
          response = request_with_retries(
              "/controller_failure/", timeout=30
          )
          assert response.text == "hello2"
          response = request_with_retries(
              "/controller_failure_2/", timeout=30
          )
          assert response.text == "hello3"
  
file_path: ray/python/ray/serve/tests/test_failure.py
imports: import os
  import sys
  import time
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.serve._private.common import DeploymentID
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
label_desc: Use image node_id 2 for calling a global function with example usage: test_controller_failure(serve_instance) and returns: str, str, unknown, str