summary refs log tree commit diff
path: root/tests/replication/tcp/test_commands.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-04-29 16:23:08 +0100
committerGitHub <noreply@github.com>2020-04-29 16:23:08 +0100
commit37f6823f5b91f27b9dd8de8fc0e52d5ea889647c (patch)
treedf9a392c3b1d4470185dcfb90e63c1005ef4e4bb /tests/replication/tcp/test_commands.py
parentDon't relay REMOTE_SERVER_UP cmds to same conn. (#7352) (diff)
downloadsynapse-37f6823f5b91f27b9dd8de8fc0e52d5ea889647c.tar.xz
Add instance name to RDATA/POSITION commands (#7364)
This is primarily for allowing us to send those commands from workers, but for now simply allows us to ignore echoed RDATA/POSITION commands that we sent (we get echoes of sent commands when using redis). Currently we log a WARNING on the master process every time we receive an echoed RDATA.

Diffstat (limited to 'tests/replication/tcp/test_commands.py')
-rw-r--r--tests/replication/tcp/test_commands.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/replication/tcp/test_commands.py b/tests/replication/tcp/test_commands.py
index 3cbcb513cc..7ddfd0a733 100644
--- a/tests/replication/tcp/test_commands.py
+++ b/tests/replication/tcp/test_commands.py
@@ -28,15 +28,17 @@ class ParseCommandTestCase(TestCase):
         self.assertIsInstance(cmd, ReplicateCommand)
 
     def test_parse_rdata(self):
-        line = 'RDATA events 6287863 ["ev", ["$eventid", "!roomid", "type", null, null, null]]'
+        line = 'RDATA events master 6287863 ["ev", ["$eventid", "!roomid", "type", null, null, null]]'
         cmd = parse_command_from_line(line)
         self.assertIsInstance(cmd, RdataCommand)
         self.assertEqual(cmd.stream_name, "events")
+        self.assertEqual(cmd.instance_name, "master")
         self.assertEqual(cmd.token, 6287863)
 
     def test_parse_rdata_batch(self):
-        line = 'RDATA presence batch ["@foo:example.com", "online"]'
+        line = 'RDATA presence master batch ["@foo:example.com", "online"]'
         cmd = parse_command_from_line(line)
         self.assertIsInstance(cmd, RdataCommand)
         self.assertEqual(cmd.stream_name, "presence")
+        self.assertEqual(cmd.instance_name, "master")
         self.assertIsNone(cmd.token)