docstr: target: test compact during index
  method: while compact collection start a thread to create index
  expected: No exception
docstr_tok: ["target",":","test","compact","during","index","method",":","while","compact","collection","start","a","thread","to","create","index","expected",":","No","exception"]
code: def test_compact_during_index(self):
      """
      target: test compact during index
      method: while compact collection start a thread to create index
      expected: No exception
      """
      collection_w = self.collection_insert_multi_segments_one_shard(
          prefix, nb_of_segment=ct.default_nb, is_dup=False
      )
  
      def do_index():
          collection_w.create_index(
              ct.default_float_vec_field_name, ct.default_index
          )
          assert collection_w.index()[0].params == ct.default_index
  
      # compact during index
      t = threading.Thread(target=do_index, args=())
      t.start()
      collection_w.compact()
      collection_w.wait_for_compaction_completed(timeout=180)
      collection_w.get_compaction_plans()
  
      t.join()
      collection_w.load()
      replicas = collection_w.get_replicas()[0]
      replica_num = len(replicas.groups)
      seg_info = self.utility_wrap.get_query_segment_info(
          collection_w.name
      )[0]
      if not (
          len(seg_info) == 1 * replica_num
          or len(seg_info) == 2 * replica_num
      ):
          assert False
  
imports: import threading
  from time import time, sleep
  import pytest
  from pymilvus.grpc_gen.common_pb2 import SegmentState
  from pymilvus.exceptions import MilvusException
  from base.client_base import TestcaseBase
  from common import common_func
  from common import common_type
  from common.common_type import CaseLabel, CheckTasks
  from utils.util_log import test_log
label_desc: Use image node_id 24 for calling the TestCompactionOperation obj's underlying member method code with example usage: obj.test_compact_during_index() without return types