docstr: target: test compact cross partitions
  method: 1.create with shard_num=1
          2.create partition and insert, flush
          3.insert _default partition and flush
          4.compact
  expected: Verify two independent compaction plans
docstr_tok: ["target",":","test","compact","cross","partitions","method",":","1.create","with","shard_num=1","2.create","partition","and","insert",",","flush","3.insert","_default","partition","and","flush","4.compact","expected",":","Verify","two","independent","compaction","plans"]
code: def test_compact_cross_partition(self):
      """
      target: test compact cross partitions
      method: 1.create with shard_num=1
              2.create partition and insert, flush
              3.insert _default partition and flush
              4.compact
      expected: Verify two independent compaction plans
      """
      # create collection and 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
      df = cf.gen_default_dataframe_data(tmp_nb)
      collection_w.insert(df)
      assert collection_w.num_entities == tmp_nb
      partition_w.insert(df)
      assert collection_w.num_entities == tmp_nb * 2
  
      # compaction only applied to indexed segments.
      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]
  
      # since manual compaction, segment should be compacted any way
      assert len(c_plans.plans) == 2
      for plan in c_plans.plans:
          assert len(plan.sources) == 1
  
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 22 for calling the TestCompactionOperation obj's underlying member method code with example usage: obj.test_compact_cross_partition() without return types