Skip to content

Commit e790196

Browse files
Add unit tests for 'MariaDbGtidListEvent' replication class
1 parent 0d5c012 commit e790196

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pymysqlreplication/tests/test_basic.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pymysqlreplication.constants.BINLOG import *
1818
from pymysqlreplication.row_event import *
1919

20-
__all__ = ["TestBasicBinLogStreamReader", "TestMultipleRowBinLogStreamReader", "TestCTLConnectionSettings", "TestGtidBinLogStreamReader"]
20+
__all__ = ["TestBasicBinLogStreamReader", "TestMultipleRowBinLogStreamReader", "TestCTLConnectionSettings", "TestGtidBinLogStreamReader","TestMariadbBinlogStreaReader"]
2121

2222

2323
class TestBasicBinLogStreamReader(base.PyMySQLReplicationTestCase):
@@ -1002,6 +1002,25 @@ def test_parsing(self):
10021002
gtid = Gtid("57b70f4e-20d3-11e5-a393-4a63946f7eac:1-:1")
10031003
gtid = Gtid("57b70f4e-20d3-11e5-a393-4a63946f7eac::1")
10041004

1005+
class TestMariadbBinlogStreaReader(base.PyMySQLReplicationTestCase):
1006+
def setUp(self):
1007+
super(TestMariadbBinlogStreaReader,self).setUp()
1008+
if not self.isMariaDB():
1009+
raise unittest.SkipTest("Skipping test: Not a MariaDB instance")
1010+
1011+
def test_gtid_list_event(self):
1012+
event = self.stream.fetchone()
1013+
self.assertEqual(event.position, 4)
1014+
1015+
#FormatDescriptionEvent
1016+
event = self.stream.fetchone()
1017+
self.assertEqual(event.event_type,15)
1018+
self.assertIsInstance(event,FormatDescriptionEvent)
1019+
1020+
#MariadbAnnotateRowsEvent
1021+
event = self.stream.fetchone()
1022+
self.assertEqual(event.event_type,163)
1023+
self.assertIsInstance(event,MariadbGtidListEvent)
10051024

10061025
if __name__ == "__main__":
10071026
import unittest

0 commit comments

Comments
 (0)