pgroonga: Disable PGroonga in development to fix CI.

A recent Postgres upstream release appears to have broken PGroonga.
While we wait for https://github.com/pgroonga/pgroonga/issues/203 to
be resolved, disable PGroonga in our automated tests so that Zulip
CI passes.
This commit is contained in:
Tim Abbott 2022-02-11 10:43:55 -08:00 committed by Anders Kaseorg
parent 22bfa56301
commit fdabf0b357
4 changed files with 10 additions and 5 deletions

View File

@ -19,6 +19,8 @@ exclude_lines =
@abstractmethod @abstractmethod
# PEP 484 overloading syntax # PEP 484 overloading syntax
^\s*\.\.\. ^\s*\.\.\.
# Skipped unit tests
@skip
[run] [run]
data_file=var/.coverage data_file=var/.coverage

View File

@ -1,7 +1,7 @@
import datetime import datetime
import os import os
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from unittest import mock from unittest import mock, skip
import orjson import orjson
from django.db import connection from django.db import connection
@ -436,11 +436,13 @@ class NarrowBuilderTest(ZulipTestCase):
"WHERE NOT (content ILIKE %(content_1)s OR subject ILIKE %(subject_1)s) AND NOT (search_tsvector @@ plainto_tsquery(%(param_4)s, %(param_5)s))", "WHERE NOT (content ILIKE %(content_1)s OR subject ILIKE %(subject_1)s) AND NOT (search_tsvector @@ plainto_tsquery(%(param_4)s, %(param_5)s))",
) )
@skip
@override_settings(USING_PGROONGA=True) @override_settings(USING_PGROONGA=True)
def test_add_term_using_search_operator_pgroonga(self) -> None: def test_add_term_using_search_operator_pgroonga(self) -> None:
term = dict(operator="search", operand='"french fries"') term = dict(operator="search", operand='"french fries"')
self._do_add_term_test(term, "WHERE search_pgroonga &@~ escape_html(%(escape_html_1)s)") self._do_add_term_test(term, "WHERE search_pgroonga &@~ escape_html(%(escape_html_1)s)")
@skip
@override_settings(USING_PGROONGA=True) @override_settings(USING_PGROONGA=True)
def test_add_term_using_search_operator_and_negated_pgroonga(self) -> None: # NEGATED def test_add_term_using_search_operator_and_negated_pgroonga(self) -> None: # NEGATED
term = dict(operator="search", operand='"french fries"', negated=True) term = dict(operator="search", operand='"french fries"', negated=True)
@ -2303,6 +2305,7 @@ class GetOldMessagesTest(ZulipTestCase):
'<p>Public <span class="highlight">special</span> content!</p>', '<p>Public <span class="highlight">special</span> content!</p>',
) )
@skip
@override_settings(USING_PGROONGA=True) @override_settings(USING_PGROONGA=True)
def test_get_messages_with_search_pgroonga(self) -> None: def test_get_messages_with_search_pgroonga(self) -> None:
self.login("cordelia") self.login("cordelia")

View File

@ -495,14 +495,14 @@ class NarrowBuilder:
return query.where(maybe_negate(cond)) return query.where(maybe_negate(cond))
def by_search(self, query: Select, operand: str, maybe_negate: ConditionTransform) -> Select: def by_search(self, query: Select, operand: str, maybe_negate: ConditionTransform) -> Select:
if settings.USING_PGROONGA: if settings.USING_PGROONGA: # nocoverage
return self._by_search_pgroonga(query, operand, maybe_negate) return self._by_search_pgroonga(query, operand, maybe_negate)
else: else:
return self._by_search_tsearch(query, operand, maybe_negate) return self._by_search_tsearch(query, operand, maybe_negate)
def _by_search_pgroonga( def _by_search_pgroonga(
self, query: Select, operand: str, maybe_negate: ConditionTransform self, query: Select, operand: str, maybe_negate: ConditionTransform
) -> Select: ) -> Select: # nocoverage
match_positions_character = func.pgroonga_match_positions_character match_positions_character = func.pgroonga_match_positions_character
query_extract_keywords = func.pgroonga_query_extract_keywords query_extract_keywords = func.pgroonga_query_extract_keywords
operand_escaped = func.escape_html(operand, type_=Text) operand_escaped = func.escape_html(operand, type_=Text)
@ -574,7 +574,7 @@ def highlight_string(text: str, locs: Iterable[Tuple[int, int]]) -> str:
in_tag = True in_tag = True
elif character == ">": elif character == ">":
in_tag = False in_tag = False
if in_tag: if in_tag: # nocoverage
result += prefix result += prefix
result += match result += match
else: else:

View File

@ -85,7 +85,7 @@ TERMS_OF_SERVICE_MESSAGE: Optional[str] = "Description of changes to the ToS!"
EMBEDDED_BOTS_ENABLED = True EMBEDDED_BOTS_ENABLED = True
SYSTEM_ONLY_REALMS: Set[str] = set() SYSTEM_ONLY_REALMS: Set[str] = set()
USING_PGROONGA = True USING_PGROONGA = False
# Flush cache after migration. # Flush cache after migration.
POST_MIGRATION_CACHE_FLUSHING = True POST_MIGRATION_CACHE_FLUSHING = True