Skip to content

Commit

Permalink
rm skip from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Bushmakin committed Feb 10, 2025
1 parent 22d0932 commit 1a5e682
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 9 additions & 7 deletions pyreindexer/tests/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,20 @@ 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))
query = q1.merge(q2).merge(q3)
# 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
8 changes: 3 additions & 5 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,14 @@ 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 "
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)),
raises(ApiError, pattern="Context timeout"))
raises(ApiError, pattern="Context timeout|Read lock (.*) was canceled on condition"))

0 comments on commit 1a5e682

Please sign in to comment.