zulip/zerver/lib
Tim Abbott 8339c21637 test-backend: Fix db issues with running two copies in parallel.
Sometimes it's useful to run two copies of test-backend at the same
time.  The problem with doing so is that we need to make sure no two
threads are using the same test database ID.

Previously, this worked only if at most one of those copies was
running in the single-threaded mode, because we used a random database
ID for the single-threaded code path, but the same IDs counting from 0
for the parallel code path.

Fix this, mostly, by generating a random start for the range of IDs
used by the process, and then counting off database IDs starting from
there (both in the parallel and non-paralllel modes).

There's still a very low probability race, see the TODO.
Additionally, there appear to be some other races with running two
copies of test-backend at the same time not related to the database.

See https://github.com/zulip/zulip/issues/12426 for a follow-up issue
that's sorta created by this.
2019-05-28 16:38:45 -07:00
..
bugdown bugdown: Show previews for manually created youtube playlists. 2019-05-12 22:24:42 -07:00
url_preview url preview: Catch network errors during get for page content. 2019-05-13 13:55:00 -07:00
webhooks webhooks/github: Improve punctuation. 2019-05-09 13:05:49 -07:00
__init__.py
actions.py user_info: Add `bot_owner_id` to user info dataset. 2019-05-28 12:41:52 -07:00
addressee.py mypy: Require topics to be non-None in Addressee. 2019-05-01 17:52:37 -07:00
alert_words.py alert_words: Performance improvements in looking for alert_words. 2019-03-01 15:36:39 -08:00
api_test_helpers.py tools/test-api: Test Client.update_stream. 2019-04-25 16:24:59 -02:30
attachments.py
avatar.py python: Clean up various if False blocks. 2018-12-17 11:14:47 -08:00
avatar_hash.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
bot_config.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
bot_lib.py streams: Refactor multi-option helpers into separate functions. 2019-02-12 11:10:26 -08:00
bot_storage.py python: Stop importing Length from the wrong file. 2019-02-02 17:09:10 -08:00
bulk_create.py stream-descriptions: Create wrapper for rendering stream descriptions. 2019-03-06 17:16:14 -08:00
cache.py user_info: Add `bot_owner_id` to user info dataset. 2019-05-28 12:41:52 -07:00
cache_helpers.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
camo.py camo: Add endpoint to handle camo requests. 2019-01-04 10:27:04 -08:00
ccache.py str_utils: Move force_bytes into ccache.py. 2018-05-15 19:07:32 -07:00
context_managers.py
create_user.py email: Set email based on realm email_address_visibility. 2019-02-04 18:45:10 -08:00
db.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
debug.py mypy: Set local_partial_types = True. 2018-05-21 22:41:00 -07:00
dev_ldap_directory.py dev_ldap: Add custom profile data. 2019-01-29 16:01:30 -08:00
digest.py models: Rename Subscription.in_home_view field to is_muted. 2019-05-12 22:08:10 -07:00
domains.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
email_mirror.py email_mirror: Rewrite log_and_report and cover it with tests. 2019-05-20 19:35:32 -07:00
email_mirror_helpers.py email_mirror: Raise ZulipEmailForwardError if email pattern not recognised. 2019-03-21 15:25:57 -07:00
email_notifications.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
emoji.py lint: Fix calls to _() on computed strings. 2019-04-23 15:23:03 -07:00
error_notify.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
events.py user_info: Add `bot_owner_id` to user info dataset. 2019-05-28 12:41:52 -07:00
exceptions.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
export.py export.py: Clean up redundant import statements. 2019-05-27 20:13:56 -07:00
feedback.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
fix_unreads.py models: Rename Subscription.in_home_view field to is_muted. 2019-05-12 22:08:10 -07:00
generate_test_data.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
hotspots.py docs: Mention bug in ALWAYS_SEND_ALL_HOTSPOTS feature. 2019-02-27 10:21:30 -08:00
html_diff.py
html_to_text.py html_to_text: Add delimiters between text from different elements. 2019-05-01 17:35:20 -07:00
i18n.py i18n: Log error & return "Unknown" if invalid code in get_language_name. 2019-03-21 15:32:13 -07:00
import_realm.py import: Replace data-user-group-id in rendered_content. 2019-05-28 12:53:20 -07:00
initial_password.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
integrations.py webhooks: Add Buildbot integration. 2019-04-27 15:19:16 -07:00
json_encoder_for_html.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
logging_util.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
management.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
mdiff.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
mention.py markdown: Change syntax of silent mentions ( _@person -> @_person). 2019-02-20 10:41:42 -08:00
message.py models: Rename Subscription.in_home_view field to is_muted. 2019-05-12 22:08:10 -07:00
migrate.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
mobile_auth_otp.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
name_restrictions.py signup: Add opayq.com to disposable domain whitelist. 2018-08-13 10:56:47 -07:00
narrow.py search: Add stop words to page_params. 2019-02-05 10:23:28 -08:00
onboarding.py onboarding: Update initial messages and stream descriptions. 2019-03-21 12:34:24 -07:00
openapi.py Minimize race conditions for reading zulip.yaml. 2018-09-12 11:07:20 -07:00
outgoing_webhook.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
parallel.py
profile.py
push_notifications.py lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
queue.py requirements: Upgrade pika from 0.12.0 to 0.13.0. 2019-01-31 10:04:07 -08:00
rate_limiter.py rate_limiter: Generalise some rate_limit_user code. 2019-05-01 12:54:32 -07:00
realm_description.py html_to_text: Add delimiters between text from different elements. 2019-05-01 17:35:20 -07:00
realm_icon.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
realm_logo.py settings: Add support for uploading logo for night mode. 2019-02-18 15:15:57 -08:00
redis_utils.py
remote_server.py production: Add optional support for submitting usage statistics. 2019-02-26 17:35:10 -08:00
request.py requirements: Upgrade pyflakes. 2019-02-01 07:26:13 -08:00
request.pyi extract_recipients: Support user IDs. 2019-01-08 19:08:49 -03:30
response.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
rest.py report: Allow error-reporting views from unauthed users. 2018-12-16 15:44:48 -08:00
retention.py retention: Split archive_messages code into two functions. 2019-05-27 12:53:32 -07:00
send_email.py deliver_email: Refactor to extract email delivery. 2019-03-20 14:52:05 -07:00
sessions.py sessions: Suppress coverage error until we can debug. 2018-12-01 10:08:57 -08:00
soft_deactivation.py soft deactivation: Remove useless conditional. 2019-05-08 14:40:33 -07:00
sqlalchemy_utils.py mypy: Set local_partial_types = True. 2018-05-21 22:41:00 -07:00
statistics.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
storage.py python: Remove now-unnecessary str_utils library. 2018-11-27 11:57:54 -08:00
stream_recipient.py
stream_subscription.py subscriptions: Migrate notification setting defaults model. 2019-05-08 17:45:10 -07:00
stream_topic.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
streams.py lint: Fix calls to _() on computed strings. 2019-04-23 15:23:03 -07:00
subdomains.py get_realm: raise DoesNotExist instead of returning None. 2019-05-06 21:58:16 -07:00
test_classes.py tests: Extract and use assert_logged_in_user_id test helper. 2019-05-27 18:32:27 -07:00
test_data.source.txt
test_fixtures.py test-backend: Avoid dropping/rebuiling zulip_test database. 2019-05-28 16:38:45 -07:00
test_helpers.py url preview: Confirm content-type before trying to show previews. 2019-05-13 13:45:17 -07:00
test_runner.py test-backend: Fix db issues with running two copies in parallel. 2019-05-28 16:38:45 -07:00
tex.py Enable pycodestyle W605 (invalid escape sequence). 2018-07-03 16:54:46 +02:00
thumbnail.py camo: Add endpoint to handle camo requests. 2019-01-04 10:27:04 -08:00
timeout.py mypy: Add assertion in timeout.py. 2018-04-25 08:58:55 -07:00
timestamp.py
timezone.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
topic.py onboarding: Simplify get_turtle_message. 2019-03-21 12:33:32 -07:00
topic_mutes.py Extract topic_match_sa() helper. 2018-11-07 10:03:53 -08:00
transfer.py python: Remove unused imports. 2019-02-22 16:54:36 -08:00
type_debug.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
types.py extract_recipients: Support user IDs. 2019-01-08 19:08:49 -03:30
unminify.py unminify: Clean up unnecessary repetition of webpack:/// URLs. 2018-08-03 15:56:40 -07:00
upload.py uploads: Revert "Url encoded name of the file should be an ascii." 2019-04-22 22:28:39 -07:00
url_encoding.py topic -> subject: Extract get_topic_from_message_info(). 2018-11-14 23:24:06 -08:00
user_agent.py user_agent: Use re.X to make the regex a little more readable. 2018-12-05 14:58:13 -08:00
user_groups.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
user_status.py user status: Add "status_text" support in the backend. 2019-01-24 09:46:35 -08:00
users.py lint: Fix calls to _() on computed strings. 2019-04-23 15:23:03 -07:00
utils.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
validator.py lint: Fix calls to _() on computed strings. 2019-04-23 15:23:03 -07:00
video_calls.py zoom: Fix handling of 201 status codes from zoom API. 2019-01-16 15:37:06 -08:00
widget.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
zcommand.py zcommand: Fix broken switch mode message. 2018-08-08 11:29:49 -07:00
zephyr.py python: Remove now-unnecessary str_utils library. 2018-11-27 11:57:54 -08:00