File tree 4 files changed +78
-3
lines changed
4 files changed +78
-3
lines changed Original file line number Diff line number Diff line change
1
+ version : ' 3.2'
2
+ services :
3
+ percona-5.7 :
4
+ platform : linux/amd64
5
+ image : percona:5.7
6
+ environment :
7
+ MYSQL_ALLOW_EMPTY_PASSWORD : true
8
+ MYSQL_DATABASE : pymysqlreplication_test
9
+ ports :
10
+ - 3306:3306
11
+ command : mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates
12
+ restart : always
13
+ networks :
14
+ - default
15
+
16
+ percona-5.7-ctl :
17
+ image : percona:5.7
18
+ environment :
19
+ MYSQL_ALLOW_EMPTY_PASSWORD : true
20
+ MYSQL_DATABASE : pymysqlreplication_test
21
+ ports :
22
+ - 3307:3307
23
+ command : mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates -P 3307
24
+
25
+ pymysqlreplication :
26
+ build :
27
+ context : .
28
+ dockerfile : test.Dockerfile
29
+ args :
30
+ BASE_IMAGE : python:3.11-alpine
31
+ MYSQL_5_7 : percona-5.7
32
+ MYSQL_5_7_CTL : percona-5.7-ctl
33
+
34
+ command :
35
+ - /bin/sh
36
+ - -ce
37
+ - |
38
+ echo "wait mysql server"
39
+
40
+ while :
41
+ do
42
+ if mysql -h percona-5.7 --user=root --execute "USE pymysqlreplication_test;" 2>&1 >/dev/null && mysql -h percona-5.7-ctl --port=3307 --user=root --execute "USE pymysqlreplication_test;" 2>&1 >/dev/null; then
43
+ break
44
+ fi
45
+ done
46
+
47
+ echo "run pytest"
48
+ pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos"
49
+
50
+ working_dir : /pymysqlreplication
51
+ networks :
52
+ - default
53
+ depends_on :
54
+ - percona-5.7
55
+
56
+ networks :
57
+ default : {}
Original file line number Diff line number Diff line change @@ -19,11 +19,9 @@ def ignoredEvents(self):
19
19
return []
20
20
21
21
def setUp (self ):
22
-
23
- db = os .environ .get ('DB' )
24
22
# default
25
23
self .database = {
26
- "host" : "localhost" ,
24
+ "host" : os . environ . get ( "MYSQL_5_7" ) or "localhost" ,
27
25
"user" : "root" ,
28
26
"passwd" : "" ,
29
27
"port" : 3306 ,
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
+ import os
3
+
2
4
import pymysql
3
5
import copy
4
6
import time
@@ -768,6 +770,8 @@ def setUp(self):
768
770
ctl_db = copy .copy (self .database )
769
771
ctl_db ["db" ] = None
770
772
ctl_db ["port" ] = 3307
773
+ if os .environ .get ("MYSQL_5_7_CTL" ) is not None :
774
+ ctl_db ["host" ] = os .environ .get ("MYSQL_5_7_CTL" )
771
775
self .ctl_conn_control = pymysql .connect (** ctl_db )
772
776
self .ctl_conn_control .cursor ().execute ("DROP DATABASE IF EXISTS pymysqlreplication_test" )
773
777
self .ctl_conn_control .cursor ().execute ("CREATE DATABASE pymysqlreplication_test" )
Original file line number Diff line number Diff line change
1
+ ARG BASE_IMAGE=${BASE_IMAGE:-python:3.11-alpine}
2
+ FROM ${BASE_IMAGE}
3
+
4
+ COPY pymysqlreplication pymysqlreplication
5
+ COPY README.md README.md
6
+ COPY setup.py setup.py
7
+ RUN apk add bind-tools
8
+ RUN apk add mysql-client
9
+ RUN pip install .
10
+ RUN pip install pytest
11
+
12
+ ARG MYSQL_5_7
13
+ ENV MYSQL_5_7 ${MYSQL_5_7}
14
+
15
+ ARG MYSQL_5_7_CTL
16
+ ENV MYSQL_5_7_CTL ${MYSQL_5_7_CTL}
You can’t perform that action at this time.
0 commit comments