Skip to content
Snippets Groups Projects
Unverified Commit 07bd98a3 authored by jie.wang's avatar jie.wang Committed by GitHub
Browse files

do not skip test_index.py (#508)


Co-authored-by: default avatarYee <2520865+yixinglu@users.noreply.github.com>
Co-authored-by: default avatarcpw <13495049+CPWstatic@users.noreply.github.com>
parent a54d7f32
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,6 @@ from tests.common.nebula_test_suite import NebulaTestSuite
from tests.common.nebula_test_suite import T_EMPTY, T_NULL
from tests.common.utils import find_in_rows
status_pattern = re.compile(r'FINISHED|QUEUE|RUNNING')
class TestIndex(NebulaTestSuite):
......@@ -56,25 +55,6 @@ class TestIndex(NebulaTestSuite):
resp = self.execute('DROP SPACE index_space;')
self.check_resp_succeeded(resp)
@classmethod
def find_result(self, resp, expect):
if resp.is_empty() and len(expect) == 0:
return True
if resp.is_empty():
return False
rows = resp.rows()
if len(rows) < len(expect):
return False
new_expect = self.convert_expect(expect)
for exp in new_expect:
if not find_in_rows(exp.values, rows):
return False
return True
def test_tag_index(self):
# Single Tag Single Field
......@@ -112,7 +92,7 @@ class TestIndex(NebulaTestSuite):
resp = self.client.execute('CREATE TAG INDEX disorder_tag_index ON tag_1(col3, col2)')
self.check_resp_succeeded(resp)
time.sleep(3)
time.sleep(self.delay)
# Rebuild Tag Index
resp = self.client.execute('REBUILD TAG INDEX single_tag_index')
self.check_resp_succeeded(resp)
......@@ -126,32 +106,29 @@ class TestIndex(NebulaTestSuite):
resp = self.client.execute('REBUILD TAG INDEX non_existent_tag_index')
self.check_resp_failed(resp) # need to check if index exists in validator in future
time.sleep(3)
time.sleep(self.delay)
# Show Tag Index Status
resp0 = self.client.execute('SHOW TAG INDEX STATUS')
self.check_resp_succeeded(resp0)
self.search_result(resp0, [[re.compile(r'single_tag_index'), status_pattern],
[re.compile(r'multi_tag_index'), status_pattern],
[re.compile(r'disorder_tag_index'), status_pattern]], is_regex=True)
resp = self.client.execute('SHOW TAG INDEX STATUS')
self.check_resp_succeeded(resp)
self.search_result(resp, [['single_tag_index', 'FINISHED'],
['multi_tag_index', 'FINISHED'],
['disorder_tag_index', 'FINISHED']])
# Lookup
# Only run Lookup when index status is 'FINISHED'
if self.find_result(resp0, [['single_tag_index', 'FINISHED']]):
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col2 == 18 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['101', 'Tom']]
self.check_out_of_order_result(resp, expect)
if self.find_result(resp0, [['multi_tag_index', 'FINISHED']]):
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col3 > 35.7 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['102', 'Jerry'], ['103', 'Bob']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col2 > 18 AND tag_1.col3 < 37.2 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['103', 'Bob']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col2 == 18 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['101', 'Tom']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col3 > 35.7 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['102', 'Jerry'], ['103', 'Bob']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON tag_1 WHERE tag_1.col2 > 18 AND tag_1.col3 < 37.2 YIELD tag_1.col1')
self.check_resp_succeeded(resp)
expect = [['103', 'Bob']]
self.check_out_of_order_result(resp, expect)
# Describe Tag Index
resp = self.client.execute('DESC TAG INDEX single_tag_index')
......@@ -264,7 +241,7 @@ class TestIndex(NebulaTestSuite):
resp = self.client.execute('CREATE EDGE INDEX disorder_edge_index ON edge_1(col3, col2)')
self.check_resp_succeeded(resp)
time.sleep(3)
time.sleep(self.delay)
# Rebuild Edge Index
resp = self.client.execute('REBUILD EDGE INDEX single_edge_index')
self.check_resp_succeeded(resp)
......@@ -278,32 +255,29 @@ class TestIndex(NebulaTestSuite):
resp = self.client.execute('REBUILD EDGE INDEX non_existent_edge_index')
self.check_resp_failed(resp)
time.sleep(3)
time.sleep(self.delay)
# Show Edge Index Status
resp0 = self.client.execute('SHOW EDGE INDEX STATUS')
self.check_resp_succeeded(resp0)
self.search_result(resp0, [[re.compile(r'single_edge_index'), status_pattern],
[re.compile(r'multi_edge_index'), status_pattern],
[re.compile(r'disorder_edge_index'), status_pattern]], is_regex=True)
resp = self.client.execute('SHOW EDGE INDEX STATUS')
self.check_resp_succeeded(resp)
self.search_result(resp, [['single_edge_index', 'FINISHED'],
['multi_edge_index', 'FINISHED'],
['disorder_edge_index', 'FINISHED']])
# Lookup
# Only run Lookup when index status is 'FINISHED'
if self.find_result(resp0, [['single_edge_index', 'FINISHED']]):
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col2 == 22 YIELD edge_1.col2')
self.check_resp_succeeded(resp)
expect = [['102', '103', 0, 22]]
self.check_out_of_order_result(resp, expect)
if self.find_result(resp0, [['multi_edge_index', 'FINISHED']]):
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col3 > 43.4 YIELD edge_1.col1')
self.check_resp_succeeded(resp)
expect = [['102', '103', 0, 'Yellow'], ['101', '102', 0, 'Red']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col2 > 45 AND edge_1.col3 < 44.3 YIELD edge_1.col1')
self.check_resp_succeeded(resp)
expect = [['103', '101', 0, 'Blue']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col2 == 22 YIELD edge_1.col2')
self.check_resp_succeeded(resp)
expect = [['102', '103', 0, 22]]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col3 > 43.4 YIELD edge_1.col1')
self.check_resp_succeeded(resp)
expect = [['102', '103', 0, 'Yellow'], ['101', '102', 0, 'Red']]
self.check_out_of_order_result(resp, expect)
resp = self.client.execute('LOOKUP ON edge_1 WHERE edge_1.col2 > 45 AND edge_1.col3 < 44.3 YIELD edge_1.col1')
self.check_resp_succeeded(resp)
expect = [['103', '101', 0, 'Blue']]
self.check_out_of_order_result(resp, expect)
# Describe Edge Index
resp = self.client.execute('DESC EDGE INDEX single_edge_index')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment