mirror of https://github.com/zulip/zulip.git
event_queue: Avoid hardcoded paths in /var/tmp.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
b37ed12df2
commit
e5bf0c0a69
|
@ -322,14 +322,14 @@ class MissedMessageNotificationsTest(ZulipTestCase):
|
|||
|
||||
class FileReloadLogicTest(ZulipTestCase):
|
||||
def test_persistent_queue_filename(self) -> None:
|
||||
with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/var/tmp/event_queues%s.json"):
|
||||
with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/home/zulip/tornado/event_queues%s.json"):
|
||||
self.assertEqual(persistent_queue_filename(9993),
|
||||
"/var/tmp/event_queues.json")
|
||||
"/home/zulip/tornado/event_queues.json")
|
||||
self.assertEqual(persistent_queue_filename(9993, last=True),
|
||||
"/var/tmp/event_queues.json.last")
|
||||
with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/var/tmp/event_queues%s.json",
|
||||
"/home/zulip/tornado/event_queues.json.last")
|
||||
with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/home/zulip/tornado/event_queues%s.json",
|
||||
TORNADO_PROCESSES=4):
|
||||
self.assertEqual(persistent_queue_filename(9993),
|
||||
"/var/tmp/event_queues.9993.json")
|
||||
"/home/zulip/tornado/event_queues.9993.json")
|
||||
self.assertEqual(persistent_queue_filename(9993, last=True),
|
||||
"/var/tmp/event_queues.9993.last.json")
|
||||
"/home/zulip/tornado/event_queues.9993.last.json")
|
||||
|
|
|
@ -423,10 +423,10 @@ def persistent_queue_filename(port: int, last: bool=False) -> str:
|
|||
if settings.TORNADO_PROCESSES == 1:
|
||||
# Use non-port-aware, legacy version.
|
||||
if last:
|
||||
return "/var/tmp/event_queues.json.last"
|
||||
return settings.JSON_PERSISTENT_QUEUE_FILENAME_PATTERN % ('',) + '.last'
|
||||
return settings.JSON_PERSISTENT_QUEUE_FILENAME_PATTERN % ('',)
|
||||
if last:
|
||||
return "/var/tmp/event_queues.%d.last.json" % (port,)
|
||||
return settings.JSON_PERSISTENT_QUEUE_FILENAME_PATTERN % ('.' + str(port) + '.last',)
|
||||
return settings.JSON_PERSISTENT_QUEUE_FILENAME_PATTERN % ('.' + str(port),)
|
||||
|
||||
def dump_event_queues(port: int) -> None:
|
||||
|
|
Loading…
Reference in New Issue