code: def test_check_bundle_index(ray_start_cluster, connect_to_client):
      @ray.remote(num_cpus=2)
      class Actor(object):
          def __init__(self):
              self.n = 0
  
          def value(self):
              return self.n
  
      cluster = ray_start_cluster
      cluster.add_node(num_cpus=4)
      ray.init(address=cluster.address)
  
      with connect_to_client_or_not(connect_to_client):
          placement_group = ray.util.placement_group(
              name="name",
              strategy="SPREAD",
              bundles=[{"CPU": 2}, {"CPU": 2}],
          )
  
          with pytest.raises(
              ValueError, match="bundle index 3 is invalid"
          ):
              Actor.options(
                  scheduling_strategy=PlacementGroupSchedulingStrategy(
                      placement_group=placement_group,
                      placement_group_bundle_index=3,
                  )
              ).remote()
  
          with pytest.raises(
              ValueError, match="bundle index -2 is invalid"
          ):
              Actor.options(
                  scheduling_strategy=PlacementGroupSchedulingStrategy(
                      placement_group=placement_group,
                      placement_group_bundle_index=-2,
                  )
              ).remote()
  
          with pytest.raises(
              ValueError, match="bundle index must be -1"
          ):
              Actor.options(placement_group_bundle_index=0).remote()
  
          placement_group_assert_no_leak([placement_group])
  
imports: import sys
  import time
  import pytest
  import ray
  import ray._private.gcs_utils
  import ray.cluster_utils
  from ray._private.test_utils import convert_actor_state, generate_system_config_map, get_error_message, get_other_nodes, kill_actor_and_wait_for_failure, placement_group_assert_no_leak, run_string_as_driver, wait_for_condition
  from ray.util.client.ray_client_helpers import connect_to_client_or_not
  from ray.util.placement_group import get_current_placement_group
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 1 for calling a global function with example usage: test_check_bundle_index(ray_start_cluster, connect_to_client) and returns: self