File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
from pymysqlreplication .event import *
4
4
from pymysqlreplication .constants .BINLOG import *
5
5
from pymysqlreplication .row_event import *
6
- import time
6
+
7
7
8
8
class TestBasicBinLogStreamReader (base .PyMySQLReplicationTestCase ):
9
9
def test_read_query_event (self ):
@@ -22,13 +22,25 @@ def test_read_query_event(self):
22
22
self .assertIsInstance (event , QueryEvent )
23
23
self .assertEqual (event .query , query )
24
24
25
+ def test_reading_rotate_event (self ):
26
+ query = "CREATE TABLE test_2 (id INT NOT NULL AUTO_INCREMENT, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))"
27
+ self .execute (query )
28
+
29
+ rotate_event = self .stream .fetchone ()
30
+ self .stream .close ()
31
+
32
+ query = "CREATE TABLE test_3 (id INT NOT NULL AUTO_INCREMENT, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))"
33
+ self .execute (query )
34
+
35
+ rotate_event = self .stream .fetchone ()
36
+
25
37
def test_connection_lost_event (self ):
26
38
self .stream .close ()
27
39
self .stream = BinLogStreamReader (connection_settings = self .database , blocking = True )
28
40
29
41
query = "CREATE TABLE test (id INT NOT NULL AUTO_INCREMENT, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))"
30
42
self .execute (query )
31
- query2 = "INSERT INTO test (data) VALUES('a')" ;
43
+ query2 = "INSERT INTO test (data) VALUES('a')"
32
44
for i in range (0 , 10000 ):
33
45
self .execute (query2 )
34
46
self .execute ("COMMIT" )
You can’t perform that action at this time.
0 commit comments