docstr: target: test inject memory stress into indexnode
  method: 1.Deploy milvus and limit indexnode memory resource 3 / 4Gi
          2.Create collection and insert some data
          3.Inject memory stress chaos 512Mi
          4.Create index
  expected:
docstr_tok: ["target",":","test","inject","memory","stress","into","indexnode","method",":","1.Deploy","milvus","and","limit","indexnode","memory","resource","3","\/","4Gi","2.Create","collection","and","insert","some","data","3.Inject","memory","stress","chaos","512Mi","4.Create","index","expected",":"]
code: def test_chaos_memory_stress_indexnode(self, connection, chaos_yaml):
      """
      target: test inject memory stress into indexnode
      method: 1.Deploy milvus and limit indexnode memory resource 3 / 4Gi
              2.Create collection and insert some data
              3.Inject memory stress chaos 512Mi
              4.Create index
      expected:
      """
      # init collection and insert
      nb = 256000  # vector size: 512*4*nb about 512Mi and create index need 2.8Gi memory
      dim = 512
      # c_name = cf.gen_unique_str('chaos_memory')
      c_name = "chaos_memory_gKs8aSUu"
      index_params = {
          "index_type": "IVF_SQ8",
          "metric_type": "L2",
          "params": {"nlist": 128},
      }
  
      collection_w = ApiCollectionWrapper()
      collection_w.init_collection(
          name=c_name,
          schema=cf.gen_default_collection_schema(dim=dim),
          shards_num=1,
      )
  
      # insert 256000 512 dim entities, size 512Mi
      for i in range(2):
          t0_insert = datetime.datetime.now()
          df = cf.gen_default_dataframe_data(nb=nb // 2, dim=dim)
          res = collection_w.insert(df)[0]
          assert res.insert_count == nb // 2
          # log.info(f'After {i + 1} insert, num_entities: {collection_w.num_entities}')
          tt_insert = datetime.datetime.now() - t0_insert
          log.info(f"{i} insert data cost: {tt_insert}")
  
      # flush
      t0_flush = datetime.datetime.now()
      assert collection_w.num_entities == nb
      tt_flush = datetime.datetime.now() - t0_flush
      log.info(f"flush {nb * 10} entities cost: {tt_flush}")
  
      log.info(collection_w.indexes[0].params)
      if collection_w.has_index()[0]:
          collection_w.drop_index()
  
      # indexNode start build index, inject chaos memory stress
      chaos_config = gen_experiment_config(chaos_yaml)
      log.debug(chaos_config)
      chaos_res = CusResource(
          kind=chaos_config["kind"],
          group=constants.CHAOS_GROUP,
          version=constants.CHAOS_VERSION,
          namespace=constants.CHAOS_NAMESPACE,
      )
      chaos_res.create(chaos_config)
      log.debug("inject chaos")
  
      # create index
      t0_index = datetime.datetime.now()
      index, _ = collection_w.create_index(
          field_name=ct.default_float_vec_field_name,
          index_params=index_params,
      )
      tt_index = datetime.datetime.now() - t0_index
  
      log.info(f"create index cost: {tt_index}")
      log.info(collection_w.indexes[0].params)
  
imports: import random
  import threading
  import time
  from time import sleep
  import pytest
  import datetime
  from pymilvus import connections
  from base.collection_wrapper import ApiCollectionWrapper
  from base.utility_wrapper import ApiUtilityWrapper
  from chaos.checker import Op, CollectionCreateChecker, InsertFlushChecker, IndexCreateChecker, SearchChecker, QueryChecker
  from common.cus_resource_opts import CustomResourceOperations
  from common import common_func
  from common import common_type
  from chaos import chaos_commons
  from chaos.chaos_commons import gen_experiment_config, get_chaos_yamls, start_monitor_threads
  from common.common_type import CaseLabel, CheckTasks
  from chaos import constants
  from utils.util_log import test_log
  from utils.util_k8s import get_querynode_id_pod_pairs
label_desc: Use image node_id 4 for calling the TestChaosData obj's underlying member method code with example usage: obj.test_chaos_memory_stress_indexnode(connection, chaos_yaml) without return types