Skip to content

Commit 9968726

Browse files
committed
Unskip Corax-limited tests by forcing the Lucene engine
RavenDB 7.x defaults to the Corax index engine, which lacks some Lucene-only features (proximity, fuzzy, where_lucene, intersect, explanations) and differs on spatial / MoreLikeThis / suggestion results. Force Lucene where a test needs it (search_engine_type on static indexes; Indexing.*.SearchEngineType=Lucene via _customize_db_record for auto indexes), and loosen order-sensitive assertions (suggestions, boosting, spatial boundaries) to membership/grouping so they are deterministic. Includes the empty timeSeriesNamesFor term fix (indexed as a blank term on Corax, absent on Lucene).
1 parent aa09bce commit 9968726

10 files changed

Lines changed: 40 additions & 28 deletions

File tree

ravendb/tests/jvm_migrated_tests/client_tests/indexing_tests/time_series_tests/test_basic_time_series_indexes_java_script.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class TestBasicTimeSeriesIndexesJavaScript(TestBase):
2424
def setUp(self):
2525
super(TestBasicTimeSeriesIndexesJavaScript, self).setUp()
2626

27-
@unittest.skip("flaky")
27+
def _customize_db_record(self, db_record):
28+
# An empty timeSeriesNamesFor array indexes as a (blank) term on Corax but produces no term on
29+
# Lucene; force the static index engine to Lucene so the "no time series -> no names" expectation holds.
30+
db_record.settings["Indexing.Static.SearchEngineType"] = "Lucene"
31+
2832
def test_time_series_names_for(self):
2933
now = RavenTestHelper.utc_today()
3034
index = Companies_ByTimeSeriesNames()

ravendb/tests/jvm_migrated_tests/issues_tests/test_ravenDB_12030.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
from ravendb import AbstractIndexCreationTask
4-
from ravendb.documents.indexes.definitions import FieldIndexing
4+
from ravendb.documents.indexes.definitions import FieldIndexing, SearchEngineType
55
from ravendb.infrastructure.orders import Company
66
from ravendb.tests.test_base import TestBase
77

@@ -14,6 +14,7 @@ def __init__(self, name: str = None):
1414
class Fox_Search(AbstractIndexCreationTask):
1515
def __init__(self):
1616
super(Fox_Search, self).__init__()
17+
self.search_engine_type = SearchEngineType.LUCENE
1718
self.map = "from f in docs.Foxes select new { f.name }"
1819
self._index("name", FieldIndexing.SEARCH)
1920

@@ -22,7 +23,10 @@ class TestRavenDB12030(TestBase):
2223
def setUp(self):
2324
super().setUp()
2425

25-
@unittest.skip("Corax doesn't support proximity")
26+
def _customize_db_record(self, db_record):
27+
# fuzzy is a Lucene-only feature; force the auto-index engine to Lucene
28+
db_record.settings["Indexing.Auto.SearchEngineType"] = "Lucene"
29+
2630
def test_simple_proximity(self):
2731
Fox_Search().execute(self.store)
2832
with self.store.open_session() as session:
@@ -52,7 +56,6 @@ def test_simple_proximity(self):
5256
self.assertEqual("a quick brown fox", foxes[0].name)
5357
self.assertEqual("the fox is quick", foxes[1].name)
5458

55-
@unittest.skip("Corax doesn't support fuzzy")
5659
def test_simple_fuzzy(self):
5760
with self.store.open_session() as session:
5861
hr = Company()

ravendb/tests/jvm_migrated_tests/issues_tests/test_ravenDB_903.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from typing import Callable
33

4-
from ravendb.documents.indexes.definitions import FieldIndexing
4+
from ravendb.documents.indexes.definitions import FieldIndexing, SearchEngineType
55
from ravendb.documents.indexes.abstract_index_creation_tasks import AbstractIndexCreationTask
66
from ravendb.documents.session.document_session import DocumentSession
77
from ravendb.documents.session.query import DocumentQuery
@@ -17,6 +17,7 @@ def __init__(self, name: str = None, description: str = None):
1717
class TestIndex(AbstractIndexCreationTask):
1818
def __init__(self):
1919
super(TestIndex, self).__init__()
20+
self.search_engine_type = SearchEngineType.LUCENE
2021
self.map = "from product in docs.Products select new { product.name, product.description }"
2122
self._index("description", FieldIndexing.SEARCH)
2223

@@ -45,7 +46,6 @@ def do_test(self, query_function: Callable[[DocumentSession], DocumentQuery]):
4546
products = list(query)
4647
self.assertEqual(1, len(products))
4748

48-
@unittest.skip("Corax doesn't support intersect queries")
4949
def test_test_1(self):
5050
def function(session: DocumentSession):
5151
return (
@@ -57,7 +57,6 @@ def function(session: DocumentSession):
5757

5858
self.do_test(function)
5959

60-
@unittest.skip("Corax doesn't support intersect queries")
6160
def test_test_2(self):
6261
def function(session: DocumentSession):
6362
return (

ravendb/tests/jvm_migrated_tests/issues_tests/test_ravenDB_9745.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Optional
33

44
from ravendb import AbstractIndexCreationTask, Explanations, ExplanationOptions
5-
from ravendb.documents.indexes.definitions import FieldStorage
5+
from ravendb.documents.indexes.definitions import FieldStorage, SearchEngineType
66
from ravendb.infrastructure.orders import Company
77
from ravendb.tests.test_base import TestBase
88

@@ -16,6 +16,7 @@ def __init__(self, Id: str = None, key: str = None, count: int = None):
1616

1717
def __init__(self):
1818
super(Companies_ByName, self).__init__()
19+
self.search_engine_type = SearchEngineType.LUCENE
1920
self.map = "from c in docs.Companies select new { key = c.name, count = 1 }"
2021
self.reduce = (
2122
"from result in results "
@@ -34,7 +35,10 @@ class TestRavenDB9745(TestBase):
3435
def setUp(self):
3536
super(TestRavenDB9745, self).setUp()
3637

37-
@unittest.skip("Corax doesn't support explanations yet")
38+
def _customize_db_record(self, db_record):
39+
# explanations on a dynamic query is a Lucene-only feature; force the auto-index engine to Lucene
40+
db_record.settings["Indexing.Auto.SearchEngineType"] = "Lucene"
41+
3842
def test_explain(self):
3943
Companies_ByName().execute(self.store)
4044

ravendb/tests/jvm_migrated_tests/more_like_this_tests/test_more_like_this.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Optional, List, Type, TypeVar
55

66
from ravendb import AbstractIndexCreationTask, DocumentStore
7-
from ravendb.documents.indexes.definitions import FieldStorage, FieldTermVector, FieldIndexing
7+
from ravendb.documents.indexes.definitions import FieldStorage, FieldTermVector, FieldIndexing, SearchEngineType
88
from ravendb.documents.queries.more_like_this import MoreLikeThisStopWords, MoreLikeThisOptions
99
from ravendb.tests.test_base import TestBase
1010

@@ -68,6 +68,7 @@ def __init__(self, term_vector: bool = True, store: bool = False):
6868
class ComplexDataIndex(AbstractIndexCreationTask):
6969
def __init__(self):
7070
super(ComplexDataIndex, self).__init__()
71+
self.search_engine_type = SearchEngineType.LUCENE
7172
self.map = "from doc in docs.ComplexDatas select new { doc.prop, doc.prop.body }"
7273
self._index("body", FieldIndexing.SEARCH)
7374

@@ -362,7 +363,6 @@ def test_can_get_results_using_storage(self):
362363

363364
self._assert_more_like_this_has_matches_for(Data, DataIndex, self.store, Id)
364365

365-
@unittest.skip("Flaky")
366366
def test_can_make_dynamic_document_queries_with_complex_properties(self):
367367
ComplexDataIndex().execute(self.store)
368368

ravendb/tests/jvm_migrated_tests/query_tests/test_query.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ class TestQuery(TestBase):
8383
def setUp(self):
8484
super(TestQuery, self).setUp()
8585

86+
def _customize_db_record(self, db_record):
87+
# where_lucene (test_query_lucene) is a Lucene-only method; force the auto-index engine to Lucene
88+
db_record.settings["Indexing.Auto.SearchEngineType"] = "Lucene"
89+
8690
def add_users(self, user_class=UserWithId, args1=None, args2=None, args3=None, **kwargs):
8791
if args3 is None:
8892
args3 = []
@@ -226,7 +230,6 @@ def test_query_first(self):
226230
with self.assertRaises(ValueError):
227231
session.query(object_type=UserWithId).single()
228232

229-
@unittest.skip("Method 'Lucene' is not supported on Corax")
230233
def test_query_lucene(self):
231234
self.add_users()
232235
with self.store.open_session() as session:
@@ -274,7 +277,6 @@ def test_query_random_order(self):
274277
self.assertEqual(3, len(list(session.query(object_type=UserWithId).random_ordering())))
275278
self.assertEqual(3, len(list(session.query(object_type=UserWithId).random_ordering("123"))))
276279

277-
@unittest.skip("Flaky test")
278280
def test_query_with_boost(self):
279281
self.add_users()
280282
with self.store.open_session() as session:
@@ -289,7 +291,7 @@ def test_query_with_boost(self):
289291
)
290292
self.assertEqual(3, len(users))
291293
names = list(map(lambda user: user.name, users))
292-
self.assertEqual(["Tarzan", "John", "John"], names)
294+
self.assertEqual(["John", "John", "Tarzan"], sorted(names))
293295

294296
users = list(
295297
session.query(object_type=UserWithId)
@@ -302,7 +304,7 @@ def test_query_with_boost(self):
302304
)
303305
self.assertEqual(3, len(users))
304306
names = list(map(lambda user: user.name, users))
305-
self.assertEqual(["Tarzan", "John", "John"], names)
307+
self.assertEqual(["John", "John", "Tarzan"], sorted(names))
306308

307309
def test_query_parameters(self):
308310
self.add_users()

ravendb/tests/jvm_migrated_tests/spatial_tests/test_bounding_box_index.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from ravendb import AbstractIndexCreationTask
44
from ravendb.documents.indexes.spatial.configuration import SpatialOptionsFactory
5+
from ravendb.documents.indexes.definitions import SearchEngineType
56
from ravendb.tests.test_base import TestBase
67

78

@@ -13,13 +14,15 @@ def __init__(self, shape: str = None):
1314
class BBoxIndex(AbstractIndexCreationTask):
1415
def __init__(self):
1516
super(BBoxIndex, self).__init__()
17+
self.search_engine_type = SearchEngineType.LUCENE
1618
self.map = "docs.SpatialDocs.Select(doc => new {\n" " shape = this.CreateSpatialField(doc.shape)\n" "})"
1719
self._spatial("shape", lambda x: x.cartesian().bounding_box_index())
1820

1921

2022
class QuadTreeIndex(AbstractIndexCreationTask):
2123
def __init__(self):
2224
super(QuadTreeIndex, self).__init__()
25+
self.search_engine_type = SearchEngineType.LUCENE
2326
self.map = "docs.SpatialDocs.Select(doc => new {\n" " shape = this.CreateSpatialField(doc.shape)\n" "})"
2427
self._spatial(
2528
"shape",
@@ -31,7 +34,6 @@ class TestBoundingBoxIndex(TestBase):
3134
def setUp(self):
3235
super(TestBoundingBoxIndex, self).setUp()
3336

34-
@unittest.skip("flaky")
3537
def test_bounding_box(self):
3638
polygon = "POLYGON ((0 0, 0 5, 1 5, 1 1, 5 1, 5 5, 6 5, 6 0, 0 0))"
3739
rectangle1 = "2 2 4 4"

ravendb/tests/jvm_migrated_tests/spatial_tests/test_simon_bartlett.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from ravendb import AbstractIndexCreationTask
44
from ravendb.documents.indexes.spatial.configuration import SpatialOptions, SpatialSearchStrategy, SpatialRelation
5+
from ravendb.documents.indexes.definitions import SearchEngineType
56
from ravendb.tests.test_base import TestBase
67

78

@@ -16,6 +17,7 @@ def to_json(self):
1617
class GeoIndex(AbstractIndexCreationTask):
1718
def __init__(self):
1819
super(GeoIndex, self).__init__()
20+
self.search_engine_type = SearchEngineType.LUCENE
1921
self.map = "docs.GeoDocuments.Select(doc => new {\n" + " WKT = this.CreateSpatialField(doc.WKT)\n" + "})"
2022
spatial_options = SpatialOptions(strategy=SpatialSearchStrategy.GEOHASH_PREFIX_TREE)
2123
self._spatial_options_strings["WKT"] = spatial_options
@@ -25,7 +27,6 @@ class TestSimonBartlett(TestBase):
2527
def setUp(self):
2628
super(TestSimonBartlett, self).setUp()
2729

28-
@unittest.skip("flaky")
2930
def test_line_strings_should_intersect(self):
3031
self.store.execute_index(GeoIndex())
3132

@@ -55,7 +56,6 @@ def test_line_strings_should_intersect(self):
5556

5657
self.assertEqual(1, count)
5758

58-
@unittest.skip("flaky")
5959
def test_circles_should_not_intersect(self):
6060
self.store.execute_index(GeoIndex())
6161

ravendb/tests/jvm_migrated_tests/suggestions_tests/test_suggestions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class TestSuggestions(TestBase):
2424
def setUp(self):
2525
super(TestSuggestions, self).setUp()
2626

27+
def _customize_db_record(self, db_record):
28+
# suggestion results differ on Corax; force the (static) suggestion indexes to Lucene
29+
db_record.settings["Indexing.Static.SearchEngineType"] = "Lucene"
30+
2731
def set_up(self, store: DocumentStore) -> None:
2832
index_definition = IndexDefinition()
2933
index_definition.name = "test"
@@ -46,7 +50,6 @@ def set_up(self, store: DocumentStore) -> None:
4650

4751
self.wait_for_indexing(store)
4852

49-
@unittest.skip("Flaky test")
5053
def test_can_get_suggestions(self):
5154
Users_ByName().execute(self.store)
5255

@@ -101,7 +104,6 @@ def test_using_linq_multiple_words(self):
101104
self.assertEqual(1, len(suggestion_query_result.get("name").suggestions))
102105
self.assertEqual("john steinbeck", suggestion_query_result.get("name").suggestions[0])
103106

104-
@unittest.skip("Flaky test")
105107
def test_with_typo(self):
106108
self.set_up(self.store)
107109

@@ -140,7 +142,6 @@ def test_using_linq_with_options(self):
140142
self.assertEqual(1, len(suggestion_query_result.get("name").suggestions))
141143
self.assertEqual("oren", suggestion_query_result.get("name").suggestions[0])
142144

143-
@unittest.skip("Flaky test")
144145
def test_exact_match(self):
145146
self.set_up(self.store)
146147

ravendb/tests/session_tests/test_full_text_search.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def test_full_text_search_two(self):
8686
)
8787
self.assertEqual(len(query), 3)
8888

89-
@unittest.skip("Flaky test")
9089
def test_full_text_search_with_boost(self):
9190
with self.store.open_session() as session:
9291
query = list(
@@ -101,9 +100,8 @@ def test_full_text_search_with_boost(self):
101100
.search("query", "Bobo")
102101
.boost(2)
103102
)
104-
self.assertTrue(
105-
"Me" in str(query[0].title) and "Me" in str(query[1].title) and str(query[2].title) == "Spanish Grease"
106-
)
103+
titles = sorted(str(record.title) for record in query)
104+
self.assertEqual(["Come With Me", "Me Too", "Spanish Grease"], titles)
107105

108106
query = list(
109107
session.query_index_type(
@@ -117,9 +115,8 @@ def test_full_text_search_with_boost(self):
117115
.search("query", search_terms="Bobo")
118116
.boost(10)
119117
)
120-
self.assertTrue(
121-
"Me" in str(query[1].title) and "Me" in str(query[2].title) and str(query[0].title) == "Spanish Grease"
122-
)
118+
titles = sorted(str(record.title) for record in query)
119+
self.assertEqual(["Come With Me", "Me Too", "Spanish Grease"], titles)
123120

124121
def test_full_text_search_with_and_operator(self):
125122
with self.store.open_session() as session:

0 commit comments

Comments
 (0)