Skip to content

Commit

Permalink
add more filters in timeout query test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Bushmakin committed Feb 10, 2025
1 parent 664292e commit b7f3564
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pyreindexer/tests/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,11 @@ def test_query_select_timeout_small(self, db, namespace, index):
q3 = (db.query.new(namespace).where("val", CondType.CondGt, "testval1000")
.where("id", CondType.CondRange, [1, 9000])
.where("non_idx", CondType.CondGt, 100))
query = q1.merge(q2).merge(q3)
q4 = (db.query.new(namespace).where("non_idx", CondType.CondGt, "id")
.where("id", CondType.CondEq, [1, 9000]).op_not().where("id", CondType.CondLt, 100))
query = q1.merge(q2).merge(q3).merge(q4)
# When ("Try to make select query with small timeout")
assert_that(calling(query.execute).with_args(timeout=timedelta(milliseconds=1)),
assert_that(calling(query.execute).with_args(timeout=timedelta(milliseconds=100)),
raises(ApiError, pattern="Context timeout|Read lock (.*) was canceled on condition"))

def test_query_select_join_timeout_small(self, db, namespace, index):
Expand Down
5 changes: 3 additions & 2 deletions pyreindexer/tests/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def test_sql_select_timeout_small(self, db, namespace, index):
# When ("Try to execute SQL query SELECT with small timeout")
query = ("SELECT * FROM new_ns WHERE id > -1 AND non_idx > 0 MERGE "
"(SELECT * FROM new_ns WHERE val < 'testval1000' AND non_idx > 0) MERGE "
"(SELECT * FROM new_ns WHERE val > 'testval1000' AND id RANGE(1,9000) AND non_idx > 100)")
assert_that(calling(db.query.sql).with_args(query, timeout=timedelta(milliseconds=1)),
"(SELECT * FROM new_ns WHERE val > 'testval1000' AND id RANGE(1,9000) AND non_idx > 100) MERGE "
"(SELECT * FROM new_ns WHERE non_idx > id AND NOT (id < 100))")
assert_that(calling(db.query.sql).with_args(query, timeout=timedelta(milliseconds=100)),
raises(ApiError, pattern="Context timeout|Read lock (.*) was canceled on condition"))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def build_cmake(self, ext):


setup(name=PACKAGE_NAME,
version='0.3.10',
version='0.3.11',
description='A connector that allows to interact with Reindexer',
author='Igor Tulmentyev',
maintainer='Reindexer Team',
Expand Down

0 comments on commit b7f3564

Please sign in to comment.