anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: zulip/zulip
Issue: Occasional pgroonga test flakiness

We've been seeing occasional nondeterministic test failures in CI related to pgroonga, e.g. here:
https://travis-ci.org/zulip/zulip/jobs/158890340

@kou do you have any ideas for what could be going on here?  Is there logging that would make sense to add to try to debug this?


Changed files:
zproject/test_settings.py

diff --git a/zproject/test_settings.py b/zproject/test_settings.py
index 42661af3ae..a46a80e321 100644
--- a/zproject/test_settings.py
+++ b/zproject/test_settings.py
@@ -10,6 +10,15 @@ DATABASES["default"] = {"NAME": "zulip_test",
                         "ENGINE": "django.db.backends.postgresql_psycopg2",
                         "TEST_NAME": "django_zulip_tests",
                         "OPTIONS": {"connection_factory": TimeTrackingConnection },}
+if USING_PGROONGA:
+    # We need to have "pgroonga" schema before "pg_catalog" schema in
+    # the PostgreSQL search path, because "pgroonga" schema overrides
+    # the "@@" operator from "pg_catalog" schema, and "pg_catalog"
+    # schema is searched first if not specified in the search path.
+    # See also: http://www.postgresql.org/docs/current/static/runtime-config-client.html
+    pg_options = '-c search_path=%(SCHEMA)s,zulip,public,pgroonga,pg_catalog' % \\
+        DATABASES['default']
+    DATABASES['default']['OPTIONS']['options'] = pg_options
 
 # In theory this should just go in zproject/settings.py inside the `if
 # PIPELINE_ENABLED` statement, but because zproject/settings.py is processed