code: def test_add_remove_cluster_resources(ray_start_cluster_head):
      """Tests that Global State API is consistent with actual cluster."""
      cluster = ray_start_cluster_head
      assert ray.cluster_resources()["CPU"] == 1
      nodes = []
      nodes += [cluster.add_node(num_cpus=1)]
      cluster.wait_for_nodes()
      assert ray.cluster_resources()["CPU"] == 2
  
      cluster.remove_node(nodes.pop())
      cluster.wait_for_nodes()
      assert ray.cluster_resources()["CPU"] == 1
  
      for i in range(5):
          nodes += [cluster.add_node(num_cpus=1)]
      cluster.wait_for_nodes()
      assert ray.cluster_resources()["CPU"] == 6
  
imports: import os
  import time
  import pytest
  import ray
  import ray._private.gcs_utils
  import ray._private.ray_constants
  from ray._raylet import GcsClient
  from ray.core.generated import autoscaler_pb2
  from ray._private.test_utils import convert_actor_state, make_global_state_accessor, wait_for_condition
label_desc: Use image node_id 3 for calling a global function with example usage: test_add_remove_cluster_resources(ray_start_cluster_head) without return types