class_docstr: Test cases of alias interface operations
class_docstr_tok: ["Test","cases","of","alias","interface","operations"]
docstr: target: test alias 
          1.creating partition, 
          2.inserting data, 
          3.creating index, 
          4.loading collection,  
          5.searching, 
          6.releasing collection,
  method: follow the steps in target
  expected: all steps operated by alias can work
docstr_tok: ["target",":","test","alias","1.creating","partition",",","2.inserting","data",",","3.creating","index",",","4.loading","collection",",","5.searching",",","6.releasing","collection",",","method",":","follow","the","steps","in","target","expected",":","all","steps","operated","by","alias","can","work"]
code: def test_alias_exec_operations_as_collection(self):
      """
      target: test alias
              1.creating partition,
              2.inserting data,
              3.creating index,
              4.loading collection,
              5.searching,
              6.releasing collection,
      method: follow the steps in target
      expected: all steps operated by alias can work
      """
      create_partition_flag = True
      insert_data_flag = True
      create_index_flag = True
      load_collection_flag = True
      search_flag = True
      release_collection_flag = True
  
      self._connect()
      c_name = cf.gen_unique_str("collection")
      collection_w = self.init_collection_wrap(
          name=c_name,
          schema=default_schema,
          check_task=CheckTasks.check_collection_property,
          check_items={exp_name: c_name, exp_schema: default_schema},
      )
      alias_name = cf.gen_unique_str(prefix)
      self.utility_wrap.create_alias(collection_w.name, alias_name)
      # collection_w.create_alias(alias_name)
      collection_alias, _ = self.collection_wrap.init_collection(
          name=alias_name,
          check_task=CheckTasks.check_collection_property,
          check_items={
              exp_name: alias_name,
              exp_schema: default_schema,
          },
      )
  
      # create partition by alias
      partition_name = cf.gen_unique_str("partition")
      try:
          collection_alias.create_partition(partition_name)
      except Exception as e:
          log.info(f"alias create partition failed with exception {e}")
          create_partition_flag = False
          collection_w.create_partition(partition_name)
  
      # assert partition
      pytest.assume(
          create_partition_flag is True
          and [p.name for p in collection_alias.partitions]
          == [p.name for p in collection_w.partitions]
      )
  
      # insert data by alias
      df = cf.gen_default_dataframe_data(ct.default_nb)
      try:
          collection_alias.insert(data=df)
      except Exception as e:
          log.info(f"alias insert data failed with exception {e}")
          insert_data_flag = False
          collection_w.insert(data=df)
  
      # assert insert data
      pytest.assume(
          insert_data_flag is True
          and collection_w.num_entities == ct.default_nb
          and collection_alias.num_entities == ct.default_nb
      )
  
      # create index by alias
      default_index = {
          "index_type": "IVF_FLAT",
          "params": {"nlist": 128},
          "metric_type": "L2",
      }
      try:
          collection_alias.create_index(
              field_name="float_vector", index_params=default_index
          )
      except Exception as e:
          log.info(f"alias create index failed with exception {e}")
          create_index_flag = False
          collection_w.create_index(
              field_name="float_vector", index_params=default_index
          )
  
      # assert create index
      pytest.assume(
          create_index_flag is True
          and collection_alias.has_index() is True
          and collection_w.has_index()[0] is True
      )
  
      # load by alias
      try:
          collection_alias.load()
      except Exception as e:
          log.info(f"alias load collection failed with exception {e}")
          load_collection_flag = False
          collection_w.load()
      # assert load
      pytest.assume(load_collection_flag is True)
  
      # search by alias
      topK = 5
      search_params = {"metric_type": "L2", "params": {"nprobe": 10}}
  
      query = [
          [random.random() for _ in range(ct.default_dim)]
          for _ in range(1)
      ]
      alias_res = None
      try:
          alias_res = collection_alias.search(
              query,
              "float_vector",
              search_params,
              topK,
              "int64 >= 0",
              output_fields=["int64"],
          )
      except Exception as e:
          log.info(f"alias search failed with exception {e}")
          search_flag = False
  
      collection_res, _ = collection_w.search(
          query,
          "float_vector",
          search_params,
          topK,
          "int64 >= 0",
          output_fields=["int64"],
      )
      # assert search
      pytest.assume(
          search_flag is True
          and alias_res[0].ids == collection_res[0].ids
      )
  
      # release by alias
      try:
          collection_alias.release()
      except Exception as e:
          log.info(f"alias release failed with exception {e}")
          release_collection_flag = False
          collection_w.release()
      # assert release
      pytest.assume(release_collection_flag is True)
  
imports: import pytest
  import random
  from base.client_base import TestcaseBase
  from utils.util_log import test_log
  from common import common_func
  from common import common_type
  from common.common_type import CaseLabel, CheckTasks
label_desc: Use image node_id 4 for calling the TestAliasOperation obj's underlying member method code with example usage: obj.test_alias_exec_operations_as_collection() without return types