docstr: collection schema: [pk, float_vector]
  Steps:
  1. create collection
  2. create index and insert data or not
  3. import data
  4. insert data or not
  5. verify the data entities
  6. verify search and query
docstr_tok: ["collection","schema",":","[","pk",",","float_vector","]","Steps",":","1.","create","collection","2.","create","index","and","insert","data","or","not","3.","import","data","4.","insert","data","or","not","5.","verify","the","data","entities","6.","verify","search","and","query"]
code: def test_insert_before_or_after_bulk_insert(
      self, insert_before_bulk_insert
  ):
      """
      collection schema: [pk, float_vector]
      Steps:
      1. create collection
      2. create index and insert data or not
      3. import data
      4. insert data or not
      5. verify the data entities
      6. verify search and query
      """
      bulk_insert_row = 500
      direct_insert_row = 3000
      dim = 128
      files = prepare_bulk_insert_json_files(
          minio_endpoint=self.minio_endpoint,
          bucket_name=self.bucket_name,
          is_row_based=True,
          rows=bulk_insert_row,
          dim=dim,
          data_fields=[df.pk_field, df.float_field, df.vec_field],
          force=True,
      )
      self._connect()
      c_name = cf.gen_unique_str("bulk_insert")
      fields = [
          cf.gen_int64_field(name=df.pk_field, is_primary=True),
          cf.gen_float_field(name=df.float_field),
          cf.gen_float_vec_field(name=df.vec_field, dim=dim),
      ]
      data = [
          [i for i in range(direct_insert_row)],
          [np.float32(i) for i in range(direct_insert_row)],
          cf.gen_vectors(direct_insert_row, dim=dim),
      ]
      schema = cf.gen_collection_schema(fields=fields)
      self.collection_wrap.init_collection(c_name, schema=schema)
      # build index
      index_params = ct.default_index
      self.collection_wrap.create_index(
          field_name=df.vec_field, index_params=index_params
      )
      # load collection
      self.collection_wrap.load()
      if insert_before_bulk_insert:
          # insert data
          self.collection_wrap.insert(data)
          self.collection_wrap.num_entities
      # import data
      t0 = time.time()
      task_id, _ = self.utility_wrap.do_bulk_insert(
          collection_name=c_name, files=files
      )
      logging.info(f"bulk insert task ids:{task_id}")
      (
          success,
          states,
      ) = self.utility_wrap.wait_for_bulk_insert_tasks_completed(
          task_ids=[task_id], timeout=300
      )
      tt = time.time() - t0
      log.info(f"bulk insert state:{success} in {tt}")
      assert success
      if not insert_before_bulk_insert:
          # insert data
          self.collection_wrap.insert(data)
          self.collection_wrap.num_entities
  
      num_entities = self.collection_wrap.num_entities
      log.info(f"collection entities: {num_entities}")
      assert num_entities == bulk_insert_row + direct_insert_row
      # verify index
      time.sleep(2)
      self.utility_wrap.wait_for_index_building_complete(
          c_name, timeout=300
      )
      res, _ = self.utility_wrap.index_building_progress(c_name)
      log.info(f"index building progress: {res}")
      # verify search and query
      log.info(f"wait for load finished and be ready for search")
      self.collection_wrap.load(_refresh=True)
      time.sleep(2)
      nq = 3
      topk = 10
      search_data = cf.gen_vectors(nq, dim=dim)
      search_params = ct.default_search_params
      res, _ = self.collection_wrap.search(
          search_data,
          df.vec_field,
          param=search_params,
          limit=topk,
          check_task=CheckTasks.check_search_results,
          check_items={"nq": nq, "limit": topk},
      )
      for hits in res:
          ids = hits.ids
          expr = f"{df.pk_field} in {ids}"
          expr = expr.replace("'", '"')
          results, _ = self.collection_wrap.query(expr=expr)
          assert len(results) == len(ids)
  
imports: import logging
  import time
  import pytest
  from pymilvus import DataType
  import numpy
  from pathlib import Path
  from base.client_base import TestcaseBase
  from common import common_func
  from common import common_type
  from common.milvus_sys import MilvusSys
  from common.common_type import CaseLabel, CheckTasks
  from utils.util_log import test_log
  from common.bulk_insert_data import prepare_bulk_insert_json_files, prepare_bulk_insert_new_json_files, prepare_bulk_insert_numpy_files, prepare_bulk_insert_parquet_files, prepare_bulk_insert_csv_files, DataField
label_desc: Use image node_id 5 for calling the TestBulkInsert obj's underlying member method code with example usage: obj.test_insert_before_or_after_bulk_insert(insert_before_bulk_insert) without return types