Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions synapse/storage/util/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
https://github.com/matrix-org/synapse. Please include the following data with
your report:
-----
last_value: '%(last_value)', is_called: '%(is_called)',
max_stream_id: '%(max_stream_id)',
max_in_stream_positions: '%(max_in_stream_positions)'
last_value: '%(last_value)s', is_called: '%(is_called)s',
max_stream_id: '%(max_stream_id)s',
max_in_stream_positions: '%(max_in_stream_positions)s'
Comment thread
FrenchGithubUser marked this conversation as resolved.
-----

A temporary workaround to fix this error is to shut down Synapse (including
Expand Down
2 changes: 1 addition & 1 deletion tests/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def make_request(
shorthand: Whether to try and be helpful and prefix the given URL
with the usual REST API path, if it doesn't contain it.
federation_auth_origin: if set to not-None, we will add a fake
Authorization header pretenting to be the given server name.
Authorization header pretending to be the given server name.
content_type: The content-type to use for the request. If not set then will default to
application/json unless content_is_form is true.
content_is_form: Whether the content is URL encoded form data. Adds the
Expand Down
28 changes: 27 additions & 1 deletion tests/storage/test_id_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
from synapse.storage.types import Cursor
from synapse.storage.util.id_generators import MultiWriterIdGenerator
from synapse.storage.util.sequence import (
_INCONSISTENT_STREAM_ERROR,
LocalSequenceGenerator,
PostgresSequenceGenerator,
SequenceGenerator,
)
from synapse.util.clock import Clock

from tests.unittest import HomeserverTestCase
from tests.unittest import HomeserverTestCase, TestCase
from tests.utils import USE_POSTGRES_FOR_TESTS


Expand Down Expand Up @@ -789,3 +790,28 @@ def test_load_existing_stream(self) -> None:
self.assertEqual(second_id_gen.get_current_token_for_writer("first"), 7)
self.assertEqual(second_id_gen.get_current_token_for_writer("second"), 7)
self.assertEqual(second_id_gen.get_persisted_upto_position(), 7)


class InconsistentStreamErrorFormatTest(TestCase):
"""Test that _INCONSISTENT_STREAM_ERROR can be formatted without raising a
ValueError.
"""

def test_format_with_all_parameters(self) -> None:
params = {
"seq": "events_sequence",
"stream_name": "events",
"last_value": 42,
"is_called": True,
"max_stream_id": 50,
"max_in_stream_positions": 55,
}

result = _INCONSISTENT_STREAM_ERROR % params

self.assertIn("events_sequence", result)
self.assertIn("events", result)
self.assertIn("42", result)
self.assertIn("True", result)
self.assertIn("50", result)
self.assertIn("55", result)
2 changes: 1 addition & 1 deletion tests/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def make_request(
shorthand: Whether to try and be helpful and prefix the given URL
with the usual REST API path, if it doesn't contain it.
federation_auth_origin: if set to not-None, we will add a fake
Authorization header pretenting to be the given server name.
Authorization header pretending to be the given server name.

content_type: The content-type to use for the request. If not set then will default to
application/json unless content_is_form is true.
Expand Down
Loading