mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
models: Migration of Message.pub_date to date_sent, part 2.
Fixes #1727. With the server down, apply migrations 0245 and 0246. 0246 will remove the pub_date column, so it's essential that the previous migrations ran correctly to copy data before running this.
This commit is contained in:
committed by
Tim Abbott
parent
f198475281
commit
dbe508bb91
@@ -1,18 +1,18 @@
|
||||
from zilencer.management.commands.populate_db import choose_pub_date
|
||||
from zilencer.management.commands.populate_db import choose_date_sent
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
|
||||
from django.utils.timezone import timedelta as timezone_timedelta
|
||||
|
||||
class TestChoosePubDate(ZulipTestCase):
|
||||
def test_choose_pub_date_large_tot_messages(self) -> None:
|
||||
def test_choose_date_sent_large_tot_messages(self) -> None:
|
||||
"""
|
||||
Test for a bug that was present, where specifying a large amount of messages to generate
|
||||
would cause each message to have pub_date set to timezone_now(), instead of the pub_dates
|
||||
would cause each message to have date_sent set to timezone_now(), instead of the date_sents
|
||||
being distributed across the span of several days.
|
||||
"""
|
||||
tot_messages = 1000000
|
||||
datetimes_list = [
|
||||
choose_pub_date(i, tot_messages, 1) for i in range(1, tot_messages, tot_messages // 100)
|
||||
choose_date_sent(i, tot_messages, 1) for i in range(1, tot_messages, tot_messages // 100)
|
||||
]
|
||||
|
||||
# Verify there is a meaningful difference between elements.
|
||||
|
||||
Reference in New Issue
Block a user