docstr: target: test compact partition
  method: compact partition
  expected: Verify partition segments merged
docstr_tok: ["target",":","test","compact","partition","method",":","compact","partition","expected",":","Verify","partition","segments","merged"]
code: def test_compact_partition(self):
      """
      target: test compact partition
      method: compact partition
      expected: Verify partition segments merged
      """
      # create collection with shard_num=1, and create partition
      collection_w = self.init_collection_wrap(
          name=cf.gen_unique_str(prefix), shards_num=1
      )
      partition_w = self.init_partition_wrap(
          collection_wrap=collection_w
      )
  
      # insert flush twice
      for i in range(2):
          df = cf.gen_default_dataframe_data(tmp_nb)
          partition_w.insert(df)
          assert partition_w.num_entities == tmp_nb * (i + 1)
  
      # create index
      collection_w.create_index(
          ct.default_float_vec_field_name, ct.default_index
      )
      log.debug(collection_w.index())
  
      # compact
      collection_w.compact()
      collection_w.wait_for_compaction_completed()
      c_plans = collection_w.get_compaction_plans()[0]
  
      assert len(c_plans.plans) == 1
      assert len(c_plans.plans[0].sources) == 2
      target = c_plans.plans[0].target
  
      # verify queryNode load the compacted segments
      cost = 180
      start = time()
      while time() - start < cost:
          collection_w.load()
          segment_info = self.utility_wrap.get_query_segment_info(
              collection_w.name
          )[0]
          if len(segment_info) == 1:
              break
          sleep(1.0)
      assert target == segment_info[0].segmentID
  
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 3 for calling the TestCompactionParams obj's underlying member method code with example usage: obj.test_compact_partition() without return types