docstr: Method：
  1. create a collection with partition key on collection schema with customized num_partitions
  2. verify insert, build, load and search successfully
  3. drop collection
docstr_tok: ["Method\uff1a","1.","create","a","collection","with","partition","key","on","collection","schema","with","customized","num_partitions","2.","verify","insert",",","build",",","load","and","search","successfully","3.","drop","collection"]
code: def test_partition_key_on_collection_schema(
      self, par_key_field, index_on_par_key_field
  ):
      """
      Method：
      1. create a collection with partition key on collection schema with customized num_partitions
      2. verify insert, build, load and search successfully
      3. drop collection
      """
      self._connect()
      pk_field = cf.gen_string_field(name="pk", is_primary=True)
      int64_field = cf.gen_int64_field()
      string_field = cf.gen_string_field()
      vector_field = cf.gen_float_vec_field()
      schema = cf.gen_collection_schema(
          fields=[pk_field, int64_field, string_field, vector_field],
          auto_id=False,
          partition_key_field=par_key_field,
      )
      c_name = cf.gen_unique_str("par_key")
      collection_w, _ = self.collection_wrap.init_collection(
          name=c_name, schema=schema, num_partitions=9
      )
  
      # insert
      nb = 1000
      string_prefix = cf.gen_str_by_length(length=6)
      entities_per_parkey = 20
      for n in range(entities_per_parkey):
          pk_values = [str(i) for i in range(n * nb, (n + 1) * nb)]
          int64_values = [i for i in range(0, nb)]
          string_values = [string_prefix + str(i) for i in range(0, nb)]
          float_vec_values = gen_vectors(nb, ct.default_dim)
          data = [
              pk_values,
              int64_values,
              string_values,
              float_vec_values,
          ]
          collection_w.insert(data)
  
      # flush
      collection_w.flush()
      # build index
      collection_w.create_index(
          field_name=vector_field.name, index_params=ct.default_index
      )
      if index_on_par_key_field:
          collection_w.create_index(
              field_name=par_key_field, index_params={}
          )
      # load
      collection_w.load()
      # search
      nq = 10
      search_vectors = gen_vectors(nq, ct.default_dim)
      # search with mixed filtered
      res1 = collection_w.search(
          data=search_vectors,
          anns_field=vector_field.name,
          param=ct.default_search_params,
          limit=entities_per_parkey,
          expr=f'{int64_field.name} in [1,3,5] && {string_field.name} in ["{string_prefix}1","{string_prefix}3","{string_prefix}5"]',
          output_fields=[int64_field.name, string_field.name],
          check_task=CheckTasks.check_search_results,
          check_items={"nq": nq, "limit": ct.default_limit},
      )[0]
  
imports: import pytest
  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_pymilvus import *
label_desc: Use image node_id 2 for calling the TestPartitionKeyParams obj's underlying member method code with example usage: obj.test_partition_key_on_collection_schema(par_key_field, index_on_par_key_field) without return types