code: def test_address_resolution(call_ray_stop_only):
      subprocess.check_output(
          "ray start --head --ray-client-server-port=50055", shell=True
      )
  
      with ray.client("localhost:50055").connect():
          assert ray.util.client.ray.is_connected()
  
      try:
          os.environ["RAY_ADDRESS"] = "local"
          with ray.client("localhost:50055").connect():
              # client(...) takes precedence of RAY_ADDRESS=local
              assert ray.util.client.ray.is_connected()
  
          # This tries to call `ray.init(address="local") which creates a new Ray
          # instance.
          with ray.client(None).connect():
              wait_for_condition(
                  lambda: len(
                      ray._private.services.find_gcs_addresses()
                  )
                  == 2,
                  retry_interval_ms=1000,
              )
  
      finally:
          if os.environ.get("RAY_ADDRESS"):
              del os.environ["RAY_ADDRESS"]
          ray.shutdown()
  
imports: import os
  import subprocess
  import sys
  import warnings
  from unittest.mock import Mock, patch
  import pytest
  import ray
  import ray.client_builder
  import ray.util.client.server.server
  from ray._private.test_utils import run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition, skip_flaky_core_test_premerge
  from ray.util.state import list_workers
label_desc: Use image node_id 9 for calling a global function with example usage: test_address_resolution(call_ray_stop_only) without return types