Skip to content

Commit

Permalink
Merge branch 'master' into feature/fix_float_vector_build_v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander.A,Utkin committed Feb 11, 2025
2 parents 1dce325 + 347d9a9 commit 3c6223a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
18 changes: 11 additions & 7 deletions pyreindexer/tests/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,22 @@ def test_query_delete_all(self, db, namespace, index, items):


class TestQueryTimeouts:
@pytest.mark.skip(reason="This test is flacky on v4. It has to be rewritten")
def test_query_select_timeout_small(self, db, namespace, index):
# Given("Create namespace with items")
items = [{"id": i, "val": f"testval{i}"} for i in range(20000)]
items = [{"id": i, "val": f"testval{i}", "non_idx": i + 1} for i in range(10000)]
for item in items:
db.item.insert("new_ns", item)
# Given ("Create new query")
query = (db.query.new(namespace).explain()
.where("id", CondType.CondGt, 0)
.where("val", CondType.CondLt, "testval10000")
.equal_position("id", "val")
.sort("id", True).sort("val", False))
q1 = (db.query.new(namespace).where("id", CondType.CondGt, -1)
.where("non_idx", CondType.CondGt, 0))
q2 = (db.query.new(namespace).where("val", CondType.CondLt, "testval1000")
.where("non_idx", CondType.CondGt, 0))
q3 = (db.query.new(namespace).where("val", CondType.CondGt, "testval1000")
.where("id", CondType.CondRange, [1, 9000])
.where("non_idx", CondType.CondGt, 100))
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)),
raises(ApiError, pattern="Context timeout|Read lock (.*) was canceled on condition"))
Expand Down
11 changes: 5 additions & 6 deletions pyreindexer/tests/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from hamcrest import *

import pytest

from pyreindexer.exceptions import ApiError


Expand Down Expand Up @@ -78,14 +76,15 @@ def test_sql_select_with_aggregations(self, db, namespace, index, items):
assert_that(agg['value'], equal_to(expected_values[agg['type']]),
f"Incorrect aggregation result for {agg['type']}")

@pytest.mark.skip(reason="This test is flacky on v4. It has to be rewritten")
def test_sql_select_timeout_small(self, db, namespace, index):
# Given("Create namespace with items")
items = [{"id": i, "val": f"testval{i}", "non_idx": i + 1} for i in range(10000)]
for item in items:
db.item.insert("new_ns", item)
# 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)")
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) 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=1)),
raises(ApiError, pattern="Context timeout"))
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.9',
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 3c6223a

Please sign in to comment.