code: def test_request_cluster_resources_basic(shutdown_only):
      ctx = ray.init(num_cpus=1)
      stub = _autoscaler_state_service_stub()
      gcs_address = ctx.address_info["gcs_address"]
  
      # Request one
      request_cluster_resources(gcs_address, [{"CPU": 1}])
  
      def verify():
          state = get_cluster_resource_state(stub)
          assert_cluster_resource_constraints(state, [{"CPU": 1}], [1])
          return True
  
      wait_for_condition(verify)
  
      # Request another overrides the previous request
      request_cluster_resources(
          gcs_address, [{"CPU": 2, "GPU": 1}, {"CPU": 1}]
      )
  
      def verify():
          state = get_cluster_resource_state(stub)
          assert_cluster_resource_constraints(
              state, [{"CPU": 2, "GPU": 1}, {"CPU": 1}], [1, 1]
          )
          return True
  
      # Request multiple is aggregated by shape.
      request_cluster_resources(gcs_address, [{"CPU": 1}] * 100)
  
      def verify():
          state = get_cluster_resource_state(stub)
          assert_cluster_resource_constraints(
              state, [{"CPU": 1}], [100]
          )
          return True
  
      wait_for_condition(verify)
  
imports: import os
  import sys
  import time
  from dataclasses import dataclass
  from typing import Callable, List, Optional, Tuple
  import pytest
  import ray
  import ray._private.ray_constants
  from ray._private.test_utils import wait_for_condition
  from ray.autoscaler.v2.schema import ClusterStatus, LaunchRequest, NodeInfo, ResourceRequestByCount
  from ray.autoscaler.v2.sdk import get_cluster_status, request_cluster_resources
  from ray.autoscaler.v2.tests.util import get_available_resources, get_cluster_resource_state, get_total_resources, report_autoscaling_state
  from ray.core.generated import autoscaler_pb2, autoscaler_pb2_grpc
  from ray.core.generated.autoscaler_pb2 import ClusterResourceState, NodeStatus
  from ray.util.state.api import list_nodes
label_desc: Use image node_id 8 for calling a global function with example usage: test_request_cluster_resources_basic(shutdown_only) and returns: True, True, True