code: def test_get_instances():
      storage = InstanceStorage(
          cluster_id="test_cluster",
          storage=InMemoryStorage(),
      )
      instance1 = create_instance("instance1", version=1)
      instance2 = create_instance(
          "instance2", status=Instance.ALLOCATED, version=1
      )
      instance3 = create_instance(
          "instance3", status=Instance.STOPPING, version=1
      )
  
      assert (True, 1) == storage.batch_upsert_instances(
          [
              copy.deepcopy(instance1),
              copy.deepcopy(instance2),
              copy.deepcopy(instance3),
          ],
          expected_storage_version=None,
      )
  
      assert (
          {
              "instance1": instance1,
              "instance2": instance2,
              "instance3": instance3,
          },
          1,
      ) == storage.get_instances()
  
      assert (
          {
              "instance1": instance1,
              "instance2": instance2,
          },
          1,
      ) == storage.get_instances(
          instance_ids=["instance1", "instance2"]
      )
  
      assert ({"instance2": instance2}, 1) == storage.get_instances(
          instance_ids=["instance1", "instance2"],
          status_filter={Instance.ALLOCATED},
      )
  
      assert (
          {
              "instance2": instance2,
          },
          1,
      ) == storage.get_instances(status_filter={Instance.ALLOCATED})
  
file_path: ray/python/ray/autoscaler/v2/tests/test_instance_storage.py
imports: import copy
  import os
  import sys
  from unittest import mock
  import pytest
  from ray.autoscaler.v2.instance_manager.instance_storage import InstanceStorage, InstanceUpdatedSubscriber, InstanceUpdateEvent
  from ray.autoscaler.v2.instance_manager.storage import InMemoryStorage
  from ray.core.generated.instance_manager_pb2 import Instance
label_desc: Use image node_id 5 for calling a global function with example usage: test_get_instances() without return types