code: def test_connect_to_cluster(ray_start_regular_shared):
      server = ray_client_server.serve("localhost:50055")
      with ray.client("localhost:50055").connect() as client_context:
          assert (
              client_context.dashboard_url
              == ray._private.worker.get_dashboard_url()
          )
          python_version = ".".join(
              [str(x) for x in list(sys.version_info)[:3]]
          )
          assert client_context.python_version == python_version
          assert client_context.ray_version == ray.__version__
          assert client_context.ray_commit == ray.__commit__
          protocol_version = ray.util.client.CURRENT_PROTOCOL_VERSION
          assert client_context.protocol_version == protocol_version
  
      server.stop(0)
      subprocess.check_output("ray stop --force", shell=True)
  
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 4 for calling a global function with example usage: test_connect_to_cluster(ray_start_regular_shared) without return types