Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] dm: fix integration test in rocky8.9 #11751

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
7 changes: 5 additions & 2 deletions dm/tests/_utils/run_downstream_cluster
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ EOF
--data-dir "$WORK_DIR/pd" &
# wait until PD is online...
i=0
while ! curl "http://$PD_ADDR/pd/api/v1/version"; do
while curl "http://$PD_ADDR/pd/api/v1/version"; do
Copy link
Contributor Author

@River2000i River2000i Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If curl return exit code is not 0, it will not retry such as:

Starting PD...

Release Version: v8.5.0-alpha-23-gc8c75510a

Edition: Community

Git Commit Hash: c8c75510a3583c669a962c41e6117157f3d19dca

Git Branch: master

UTC Build Time:  2024-11-14 10:14:13

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed


  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 port 2379: Connection refused

script returned exit code 2

Seems check curl return without error(exit code is 0) is enough🤔
ref tiup: https://github.com/pingcap/tiup/blob/master/pkg/cluster/api/pdapi.go#L188-L195

i=$((i + 1))
if [ "$i" -gt 20 ]; then
echo 'Failed to start PD'
return 1
fi
sleep 3
done
echo 'Start PD success'
}

start_tikv() {
Expand All @@ -62,6 +63,7 @@ start_tikv() {
fi
sleep 5
done
echo 'Start TiKV success'
}

start_tidb() {
Expand All @@ -75,14 +77,15 @@ start_tidb() {
--log-file "$WORK_DIR/tidb.log" &

i=0
while ! curl "http://$TIDB_IP:10080/status"; do
while curl "http://$TIDB_IP:10080/status"; do
i=$((i + 1))
if [ "$i" -gt 50 ]; then
echo 'Failed to start TiDB'
return 1
fi
sleep 3
done
echo 'Start TiDB success'
}

start_pd
Expand Down
2 changes: 2 additions & 0 deletions dm/tests/many_tables/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ function run() {
pkill -hup tidb-server 2>/dev/null || true
wait_process_exit tidb-server
# now worker will process some binlog events, save table checkpoint and meet downstream error
echo "start incremental_data_2"
incremental_data_2
echo "finish incremental_data_2"
sleep 30

resume_num=$(grep 'unit process error' $WORK_DIR/worker1/log/dm-worker.log | wc -l)
Expand Down
1 change: 1 addition & 0 deletions dm/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests
ipaddress
21 changes: 15 additions & 6 deletions dm/tests/tls/conf/ca.pem
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
-----BEGIN CERTIFICATE-----
MIIBGDCBwAIJAOjYXLFw5V1HMAoGCCqGSM49BAMCMBQxEjAQBgNVBAMMCWxvY2Fs
aG9zdDAgFw0yMDAzMTcxMjAwMzNaGA8yMjkzMTIzMTEyMDAzM1owFDESMBAGA1UE
AwwJbG9jYWxob3N0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEglCIJD8uVBfD
kuM+UQP+VA7Srbz17WPLA0Sqc+sQ2p6fT6HYKCW60EXiZ/yEC0925iyVbXEEbX4J
xCc2Heow5TAKBggqhkjOPQQDAgNHADBEAiAILL3Zt/3NFeDW9c9UAcJ9lc92E0ZL
GNDuH6i19Fex3wIgT0ZMAKAFSirGGtcLu0emceuk+zVKjJzmYbsLdpj/JuQ=
MIICsTCCAZkCFBW2dYDlpiY0fQo4/BbVb4kWuLGMMA0GCSqGSIb3DQEBCwUAMBQx
EjAQBgNVBAMMCWxvY2FsaG9zdDAgFw0yNDExMTkwMjUxNThaGA8yMjk4MDkwNDAy
NTE1OFowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEAzNlitARpbbz2zDeze6X70vGg5Ti0t7xz7MsAAl9ESyf6i/XD
zBDGN5w18YaPUsXbOFz5dJeWtVK8xheJCN19RwYUGWf6BGuLohCA7ygSy43ICVNJ
xeW47xev4RcACu/C2UelBaVQLleSKsMFtEwuGJTlGL9nfxR3NKw7JUYntcy0+1c9
GJQunFp8UU2ymENJqlIwhtwy5Z56oWRGS34rVdyhmlQ/OrGEinTyyoZBxWJmzbvw
Cqi1+IZKmwobGVSIuNdKxLwn/KNRxXE+tWwVy/+Dq5U3mt4zdBcRHQsSuqxPzS+6
/3MivAN+5hGebHv1UyfKEQTACyKc8YHryf5SPwIDAQABMA0GCSqGSIb3DQEBCwUA
A4IBAQCPf/9isj85Ncsw7v01apIuklLzHByYZdkD0yY3Igrw2teaOGNKcTuXHiPM
v4QpV5KkkRtL+okNR6hL1BoY4OYkDRD67b8bHqr20JiYUriA1aZ5paW2MVXya8eE
T12fZYpNuYWKfd2YQiWSUuEEhCbr6cBkw9A4oyhVx5+QAFVstysm4U4dI9fn89uK
Ywtcc0ebk7FwjwGfchKW9mGG7mSOcZdGiKxYFxnI+wIf0nwjJvRraQbNpN2RuqSx
Oc/oG8QdRklQ6GnDKEwWb4P2z4r3n16O0ntcyXt03h1pFxrGTNhQ+pwbormCmN/c
t2udn5DvywhPljodj8vnprDScR4g
-----END CERTIFICATE-----
35 changes: 27 additions & 8 deletions dm/tests/tls/conf/dm.key
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICF/GDtVxhTPTP501nOu4jgwGSDY01xN+61xd9MfChw+oAoGCCqGSM49
AwEHoUQDQgAEgQOv5bQO7xK16vZWhwJqlz2vl19+AXW2Ql7KQyGi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FmI9jbwBY806NYq8gmFXY/pDjZPfhNr0cQTUIoM/NPL67er1CFKuL0zg
kduUZEP876B+6WLkDw0oh+c8QA8QAL/fd5tVbOurAoGADOucGT+TWgUPRiJbA93p
jUT88pP8Uit2hVpaLTY4vlVgGXWF9Pc3PDJMCCID2j0XYsGNPPGZFATuEH+u1klQ
R6uAVGTd3xZWVA4GSxMOsjPuJvxbT6uq2Av85EbLs3zh0owie7T2fckTGxjo9I4f
KIAGssh4L0qzQbiPaD+sG4MCgYADwxUjhnN/3/V1PMI+da3IeY5lDhG2pjxblEYa
Isq7bGLi7yfIBlIctjPwAHncHoJhH6ODqbuMQv3gnArJTJUCbIfKf/En3K7PHyeB
ebMXVsIyPbim7xX3QO+6/ME7Bg+co1ayt/zXH8L364gj0rtZlmBifzT7j2MUA9hR
DsCxpQKBgQCvPP4d0zZTRobdJtPaLnAgMq6F0RPhzoDzVlcKqXJzcELflSvusdel
L2CPOFs8KXe2BxlJpUUwmhuTIHuwWahkMxx/Dhd5rJ9qlQtDygTKNsaJgnflPscF
mFZkIeDqpeE05X9tcvWdA+QSgpmY7AmjwvlOfCTi0Ftx1s7HPfnhTQ==
-----END RSA PRIVATE KEY-----
24 changes: 16 additions & 8 deletions dm/tests/tls/conf/dm.pem
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
-----BEGIN CERTIFICATE-----
MIIBZDCCAQqgAwIBAgIJAIT/lgXUc1JqMAoGCCqGSM49BAMCMBQxEjAQBgNVBAMM
CWxvY2FsaG9zdDAgFw0yMDAzMTcxMjAwMzNaGA8yMjkzMTIzMTEyMDAzM1owDTEL
MAkGA1UEAwwCZG0wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASBA6/ltA7vErXq
9laHAmqXPa+XX34BdbZCXspDIaIElVK8tvIMs6uQh4WUc3TiKpDf1IpI5J94ZJ9G
3p2hTohwo0owSDAaBgNVHREEEzARgglsb2NhbGhvc3SHBH8AAAEwCwYDVR0PBAQD
AgWgMB0GA1Ud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dS1fM7ssyZZYI9k2VlrDPQF2jHQRfIu/bt
NyTNSt8etReb1rYCNKsFK8IPTkWwJmyOCDF+dhFLgA/z9KY2MZh1M+9gR9I5GNY=
-----END CERTIFICATE-----
4 changes: 2 additions & 2 deletions dm/tests/tls/conf/generate_tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ DNS.1 = localhost
IP.1 = 127.0.0.1
EOF

openssl ecparam -out "ca.key" -name prime256v1 -genkey
openssl genrsa -out "ca.key"
openssl req -new -batch -sha256 -subj '/CN=localhost' -key "ca.key" -out "ca.csr"
openssl x509 -req -sha256 -days 100000 -in "ca.csr" -signkey "ca.key" -out "ca.pem" 2>/dev/null

for role in dm other; do
openssl ecparam -out "$role.key" -name prime256v1 -genkey
openssl genrsa -out "$role.key"
openssl req -new -batch -sha256 -subj "/CN=${role}" -key "$role.key" -out "$role.csr"
openssl x509 -req -sha256 -days 100000 -extensions EXT -extfile "ipsan.cnf" -in "$role.csr" -CA "ca.pem" -CAkey "ca.key" -CAcreateserial -out "$role.pem" 2>/dev/null
done
35 changes: 27 additions & 8 deletions dm/tests/tls/conf/other.key
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICzbWZZ7dtha0lGXlBiP3QjCurPs5ExsR5thIQCcKCKeoAoGCCqGSM49
AwEHoUQDQgAEt5z9ACtEnsqv0ZPFx5YJhvBNQZJCEb75ZS/kDBiPoISea1HMt1w8
4ZkeWW+SBCwt0RtwzVPRq9VUGWaFRUOwdQ==
-----END EC PRIVATE KEY-----
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAw1kLMqpCyhCuviPrJkQFoZIO4ocbZO/WPju2L1B9o3QEaqzF
Zs7jTCVVtLynryw12OSay+t2JuTED4hHfSlR0RjjfHj2rV9CRyLty5Njf2ZrmX+V
pUNV/c1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rmRPVjOcCRDem88S/DfdTHWZpNGK
/rE+IXWiY4qb73zQH/YxrwKBgQCyxVPvGxXss2Noz/qVfZp809EUAOrmqWVwZ/hd
Y6qOGJ5inQjF3qNRjqy1cSUMXZvjAh0ndJjQdozNctX6k0ocSbdMFE2rFb4KfjHU
0cpIrMQVaOfCqJ/XHwHSqNmJG+r4+NSeyKAnMFfKYz7ydBpGauKiYeP8qM/KT4/f
3MUEqQKBgQC2zESZWJR49qMhsQlDREeD/pZjbX76DoVfUOuvNpI4mFP9Gj1cp92V
8sBVSREHeRoN/DltT8TtJgGXSzfW8pQWRxQh2BguryHYROJsXA0aVNgQPHmBLz49
V6UOSgXetUnm9TSkSGcMKDt93NwN1e6sJ3OJruAMTG3Y6guKN20sTg==
-----END RSA PRIVATE KEY-----
25 changes: 17 additions & 8 deletions dm/tests/tls/conf/other.pem
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIBZzCCAQ2gAwIBAgIJAIT/lgXUc1JrMAoGCCqGSM49BAMCMBQxEjAQBgNVBAMM
CWxvY2FsaG9zdDAgFw0yMDAzMTcxMjAwMzNaGA8yMjkzMTIzMTEyMDAzM1owEDEO
MAwGA1UEAwwFb3RoZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS3nP0AK0Se
yq/Rk8XHlgmG8E1BkkIRvvllL+QMGI+ghJ5rUcy3XDzhmR5Zb5IELC3RG3DNU9Gr
1VQZZoVFQ7B1o0owSDAaBgNVHREEEzARgglsb2NhbGhvc3SHBH8AAAEwCwYDVR0P
BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAKBggqhkjOPQQD
AgNIADBFAiEA34/Vz7SaJWqYOgOLyr+y1OwiT9R7yTgBQCSSvGC+HpsCIA20BhNe
RnicYz+9qOQRxAFP1wpIyMMgOK4tKuZhx+/J
MIIC/jCCAeagAwIBAgIUDg53fesx1gIIYkGiIDbjngxBd4wwDQYJKoZIhvcNAQEL
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MCAXDTI0MTExOTAyNTE0M1oYDzIyOTgw
OTA0MDI1MTQzWjAQMQ4wDAYDVQQDDAVvdGhlcjCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAMNZCzKqQsoQrr4j6yZEBaGSDuKHG2Tv1j47ti9QfaN0BGqs
xWbO40wlVbS8p68sNdjkmsvrdibkxA+IR30pUdEY43x49q1fQkci7cuTY39ma5l/
laVDVf3NQCqOAAmW48u1KUGdHUBAOmxxN0x6u6CxIURC9P0JGSjhKMvAhGfAZNg2
kXjnqRczV/WUrhWfyn5Y5fbJCdw/9EoNEYxniHXYSE21vErkezRBHB248HhGArqD
K1vvdBWAcdBsQAAgKs8jvkM7Fmqu1mw5FGHhCY8AmfYybYWLFxp38KS3XvQOKaCb
OfC7xy6tSqgzrlV3co0BQY2S1gVUHzk3W7803p8CAwEAAaNKMEgwGgYDVR0RBBMw
EYIJbG9jYWxob3N0hwR/AAABMAsGA1UdDwQEAwIFoDAdBgNVHSUEFjAUBggrBgEF
BQcDAgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAKaIFX66bIZRaiaLoQqw
nvremDwYX16RTDRXPmF8Jp0Rs7Xm8WeQF4B4HDhwWtkti9muecN2CzeYTlgzkbaK
yMG2mndmbO/W6pWuWObrRZF9TA+4jIQ/r5NuBcoVLwe0s4/EWxPqZyndNxBZCNr+
cpUlcG4QScrFfuj87K6yi+z1t7w0F1YMoRt0uD2MspWG2TQv7tR1iWMQRy9rVF9E
+GWEMPQRdMAG1fkTtlRd+VgcZXGWF7XEYWK0nSIBBXJf9mQGsl6XZcBqRMY2vgTa
Jk0Nix/aUsVP1cclVNQ9vL5qWUBnr9/3TseyqHcKFOrM+E6+vXFlVs33WJ2awwqP
HZ4=
-----END CERTIFICATE-----
28 changes: 18 additions & 10 deletions dm/tests/tls/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function get_mysql_ssl_data_path() {

function setup_tidb_with_tls() {
echo "run a new tidb server with tls"
cat - >"$WORK_DIR/tidb-tls-config.toml" <<EOF
cat - >"/dm/tidb-tls-config.toml" <<EOF

socket = "/tmp/tidb-tls.sock"

Expand All @@ -26,24 +26,32 @@ status-port = 10090

[security]
# set the path for certificates. Empty string means disabling secure connections.
ssl-ca = "$cur/conf/ca.pem"
ssl-cert = "$cur/conf/dm.pem"
ssl-key = "$cur/conf/dm.key"
cluster-ssl-ca = "$cur/conf/ca.pem"
cluster-ssl-cert = "$cur/conf/dm.pem"
cluster-ssl-key = "$cur/conf/dm.key"
ssl-ca = "/dm/tiflow/dm/tests/tls/conf/ca.pem"
ssl-cert = "/dm/tiflow/dm/tests/tls/conf/dm.pem"
ssl-key = "/dm/tiflow/dm/tests/tls/conf/dm.key"
cluster-ssl-ca = "/dm/tiflow/dm/tests/tls/conf/ca.pem"
cluster-ssl-cert = "/dm/tiflow/dm/tests/tls/conf/dm.pem"
cluster-ssl-key = "/dm/tiflow/dm/tests/tls/conf/dm.key"
EOF

bin/tidb-server \
-P 4400 \
--path $WORK_DIR/tidb \
--path /dm/tidb \
--store unistore \
--config $WORK_DIR/tidb-tls-config.toml \
--log-file "$WORK_DIR/tidb.log" 2>&1 &
--config /dm/tidb-tls-config.toml \
--log-file "dm/tidb.log" 2>&1 &

sleep 5
ls -alh $cur/conf
# if execute failed, print tidb's log for debug
# openssl s_client -connect 127.0.0.1:4400 -CAfile /path/to/ca.pem -cert /path/to/dm.pem -key /path/to/dm.key
echo "test openssl"
openssl s_client -connect 127.0.0.1:4400 -CAfile $cur/conf/ca.pem -cert $cur/conf/dm.pem -key $cur/conf/dm.key
echo "show databases"
mysql -uroot -h127.0.0.1 -P4400 --default-character-set utf8 -E -e "SHOW DATABASES;"
echo "drop database1"
mysql -uroot -h127.0.0.1 -P4400 --default-character-set utf8 --ssl-ca $cur/conf/ca.pem --ssl-cert $cur/conf/dm.pem --ssl-key $cur/conf/dm.key -E -e "drop database if exists tls" || (cat $WORK_DIR/tidb.log && exit 1)
echo "show databases2"
mysql -uroot -h127.0.0.1 -P4400 --default-character-set utf8 --ssl-ca $cur/conf/ca.pem --ssl-cert $cur/conf/dm.pem --ssl-key $cur/conf/dm.key -E -e "drop database if exists dm_meta"
}

Expand Down
Loading