code: def test_node_selection(all_nodes):
      all_node_ids = {node_id for node_id, _ in all_nodes}
      # Test NoServer
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager(
          HTTPOptions(location=DeploymentMode.NoServer)
      )
      cluster_node_info_cache.alive_nodes = all_nodes
      assert proxy_state_manager._get_target_nodes(all_node_ids) == []
  
      # Test HeadOnly
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager(
          HTTPOptions(location=DeploymentMode.HeadOnly)
      )
      cluster_node_info_cache.alive_nodes = all_nodes
      assert (
          proxy_state_manager._get_target_nodes(all_node_ids)
          == all_nodes[:1]
      )
  
      # Test EveryNode
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager(
          HTTPOptions(location=DeploymentMode.EveryNode)
      )
      cluster_node_info_cache.alive_nodes = all_nodes
      assert (
          proxy_state_manager._get_target_nodes(all_node_ids)
          == all_nodes
      )
  
      # Test specific nodes
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager(
          HTTPOptions(location=DeploymentMode.EveryNode)
      )
      cluster_node_info_cache.alive_nodes = all_nodes
      assert proxy_state_manager._get_target_nodes({HEAD_NODE_ID}) == [
          (HEAD_NODE_ID, "fake-head-ip")
      ]
  
imports: import json
  import time
  from typing import List, Tuple
  from unittest.mock import patch
  import pytest
  from ray._private.test_utils import wait_for_condition
  from ray.serve._private.cluster_node_info_cache import ClusterNodeInfoCache
  from ray.serve._private.common import ProxyStatus
  from ray.serve._private.constants import PROXY_HEALTH_CHECK_UNHEALTHY_THRESHOLD
  from ray.serve._private.proxy_state import ProxyState, ProxyStateManager, ProxyWrapper, ProxyWrapperCallStatus
  from ray.serve._private.test_utils import MockTimer
  from ray.serve._private.utils import Timer
  from ray.serve.config import DeploymentMode, HTTPOptions
  from ray.serve.schema import LoggingConfig
label_desc: Use image node_id 7 for calling a global function with example usage: test_node_selection(all_nodes) without return types