code: def test_deploy_basic(serve_instance, use_handle):
      """Test basic serve.run().
  
      1. Deploy an application with one deployment `d`.
      2. Redeploy `d` and check that a new actor is started.
      3. Update the code for `d`, redeploy `d`, and check that a new actor
          is started with the new code.
      """
  
      @serve.deployment
      def d():
          return "code version 1", os.getpid()
  
      def call():
          if use_handle:
              handle = serve.get_deployment_handle("d", "default")
              return handle.remote().result()
          else:
              return requests.get("http://localhost:8000/d").json()
  
      serve.run(d.bind())
      resp, pid1 = call()
      assert resp == "code version 1"
  
      # Redeploying should start a new actor.
      serve.run(d.bind())
      resp, pid2 = call()
      assert resp == "code version 1"
      assert pid2 != pid1
  
      # Redeploying with new code should start a new actor with new code
      @serve.deployment
      def d():
          return "code version 2", os.getpid()
  
      serve.run(d.bind())
      resp, pid3 = call()
      assert resp == "code version 2"
      assert pid3 != pid2
  
imports: import os
  import sys
  import time
  from collections import defaultdict
  from typing import Callable
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.pydantic_compat import ValidationError
  from ray._private.test_utils import SignalActor
  from ray.serve._private.utils import get_random_string
  from ray.serve.exceptions import RayServeException
label_desc: Use image node_id 1 for calling a global function with example usage: test_deploy_basic(serve_instance, use_handle) and returns: str,  os, str,  os, handle, requests