[skip e2e] Fix index timeout after scale out (#15185)

Signed-off-by: ThreadDao <yufen.zong@zilliz.com>
This commit is contained in:
ThreadDao 2022-01-13 14:29:34 +08:00 committed by GitHub
parent 008e08a996
commit 50695e5b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 39 deletions

View File

@ -38,9 +38,10 @@ class CustomResourceOperations(object):
try: try:
config.load_kube_config() config.load_kube_config()
api_instance = client.CustomObjectsApi() api_instance = client.CustomObjectsApi()
data = api_instance.delete_namespaced_custom_object(self.group, self.version, self.namespace, self.plural, api_response = api_instance.delete_namespaced_custom_object(self.group, self.version, self.namespace,
self.plural,
metadata_name) metadata_name)
log.debug(f"delete custom resource response: {data}") log.debug(f"delete custom resource response: {api_response}")
except ApiException as e: except ApiException as e:
if raise_ex: if raise_ex:
log.error("Exception when calling CustomObjectsApi->delete_namespaced_custom_object: %s\n" % e) log.error("Exception when calling CustomObjectsApi->delete_namespaced_custom_object: %s\n" % e)
@ -67,13 +68,13 @@ class CustomResourceOperations(object):
try: try:
config.load_kube_config() config.load_kube_config()
api_instance = client.CustomObjectsApi() api_instance = client.CustomObjectsApi()
data = api_instance.list_namespaced_custom_object(self.group, self.version, self.namespace, api_response = api_instance.list_namespaced_custom_object(self.group, self.version, self.namespace,
plural=self.plural, pretty=pretty) plural=self.plural, pretty=pretty)
log.debug(f"list custom resource response: {data}") log.debug(f"list custom resource response: {api_response}")
except ApiException as e: except ApiException as e:
log.error("Exception when calling CustomObjectsApi->list_namespaced_custom_object: %s\n" % e) log.error("Exception when calling CustomObjectsApi->list_namespaced_custom_object: %s\n" % e)
raise Exception(str(e)) raise Exception(str(e))
return data return api_response
def get(self, metadata_name): def get(self, metadata_name):
"""get a customer resources by name in k8s""" """get a customer resources by name in k8s"""

View File

@ -125,6 +125,7 @@ class TestIndexNodeScale:
log.info(f"milvus healthy: {healthy}") log.info(f"milvus healthy: {healthy}")
host = mic.endpoint(release_name, constants.NAMESPACE).split(':')[0] host = mic.endpoint(release_name, constants.NAMESPACE).split(':')[0]
try:
# connect # connect
connections.add_connection(default={"host": host, "port": 19530}) connections.add_connection(default={"host": host, "port": 19530})
connections.connect(alias='default') connections.connect(alias='default')
@ -155,6 +156,8 @@ class TestIndexNodeScale:
# expand indexNode from 2 to 1 # expand indexNode from 2 to 1
mic.upgrade(release_name, {'spec.components.indexNode.replicas': 1}, constants.NAMESPACE) mic.upgrade(release_name, {'spec.components.indexNode.replicas': 1}, constants.NAMESPACE)
time.sleep(5)
mic.wait_for_healthy(release_name, constants.NAMESPACE)
start = datetime.datetime.now() start = datetime.datetime.now()
collection_w.create_index(ct.default_float_vec_field_name, default_index_params) collection_w.create_index(ct.default_float_vec_field_name, default_index_params)
@ -165,4 +168,8 @@ class TestIndexNodeScale:
log.debug(t1 / t0) log.debug(t1 / t0)
assert round(t1 / t0) == 2 assert round(t1 / t0) == 2
except Exception as e:
raise Exception(str(e))
finally:
mic.uninstall(release_name, namespace=constants.NAMESPACE) mic.uninstall(release_name, namespace=constants.NAMESPACE)