Skip to content

Commit 4d70424

Browse files
authored
build: add new task for integration tests of sync_diff_inspector (#12060)
ref #11672
1 parent 7af47d0 commit 4d70424

38 files changed

+65
-55
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ clean:
388388
sync-diff-inspector:
389389
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/sync_diff_inspector ./sync_diff_inspector
390390

391+
sync-diff-inspector-integration_test: failpoint-enable sync-diff-inspector failpoint-disable
392+
@which bin/tidb-server
393+
@which bin/tikv-server
394+
@which bin/pd-server
395+
@which bin/sync_diff_inspector
396+
@which bin/dumpling
397+
@which bin/loader
398+
@which bin/importer
399+
cd sync_diff_inspector && ln -sf ../bin .
400+
cd sync_diff_inspector && ./tests/run.sh
401+
391402
dm: dm-master dm-worker dmctl dm-syncer
392403

393404
dm-master:

dm/pkg/shardddl/optimism/lock_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2738,7 +2738,7 @@ func (t *testLock) TestTrySyncForOneDDL(c *check.C) {
27382738
c.Assert(schemaChanged, check.IsTrue)
27392739
c.Assert(conflictStage, check.Equals, ConflictNone)
27402740

2741-
// check create partition, no changed since https://github.com/pingcap/tidb-tools/blob/d671b0840063bc2532941f02e02e12627402844c/pkg/schemacmp/table.go#L251
2741+
// check create partition, no changed since https://github.com/pingcap/tidb/blob/42075e6ad60ba5d1f860ac845908f0c34ac28253/pkg/util/schemacmp/table.go#L256
27422742
schemaChanged, conflictStage = l.trySyncForOneDDL(source, schema, table1, t0, t1)
27432743
c.Assert(schemaChanged, check.IsTrue)
27442744
c.Assert(conflictStage, check.Equals, ConflictNone)

dm/syncer/validate_worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ type validateCompareContext struct {
476476
columns []*model.ColumnInfo
477477
}
478478

479-
// a simplified version of https://github.com/pingcap/tidb-tools/blob/d9fdfa2f9040aab3fab7cd11774a82226f467fe7/sync_diff_inspector/utils/utils.go#L487-L606
479+
// a simplified version of CompareData in https://github.com/pingcap/tiflow/blob/4c38b919659e8506c220d1be9b0fdd7baf609e33/sync_diff_inspector/utils/utils.go#L538
480480
func (c *validateCompareContext) compareData(key string, sourceData, targetData []*sql.NullString) (bool, error) {
481481
for i, column := range c.columns {
482482
data1, data2 := sourceData[i], targetData[i]

sync_diff_inspector/tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This folder contains all tests which relies on external service such as TiDB.
2121

2222
3. The user executing the tests must have permission to create the folder
2323

24-
`/tmp/tidb_tools_test`. All test artifacts will be written into this folder.
24+
`/tmp/sync_diff_inspector_test`. All test artifacts will be written into this folder.
2525

2626
## Running
2727

sync_diff_inspector/tests/_utils/check_contains

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# argument 2 is the filename
55

66
set -eu
7-
OUT_DIR=/tmp/tidb_tools_test
7+
OUT_DIR=/tmp/sync_diff_inspector_test
88

99
if ! grep -Fq "$1" "$2"; then
1010
echo "TEST FAILED: '$2' DOES NOT CONTAIN '$1'"

sync_diff_inspector/tests/_utils/check_contains_count

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# argument 3 is the match count
66

77
set -eu
8-
OUT_DIR=/tmp/tidb_tools_test
8+
OUT_DIR=/tmp/sync_diff_inspector_test
99

1010
count=$(grep -F "$1" "$2" | wc -l)
1111

sync_diff_inspector/tests/_utils/check_contains_regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# argument 2 is the filename
55

66
set -eu
7-
OUT_DIR=/tmp/tidb_tools_test
7+
OUT_DIR=/tmp/sync_diff_inspector_test
88

99
if ! grep -q "$1" "$2"; then
1010
echo "TEST FAILED: '$2' DOES NOT CONTAIN '$1'"

sync_diff_inspector/tests/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -eu
44

5-
OUT_DIR=/tmp/tidb_tools_test
5+
OUT_DIR=/tmp/sync_diff_inspector_test
66

77
# assign default value to mysql config
88
if [[ -z ${MYSQL_HOST+x} ]]; then

sync_diff_inspector/tests/sync_diff_inspector/checkpoint/config_base.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ chunk-size = 10
4040
# 2 log: sync-diff.log
4141
# 3 summary: summary.txt
4242
# 4 checkpoint: a dir
43-
output-dir = "/tmp/tidb_tools_test/sync_diff_inspector/output"
43+
output-dir = "/tmp/sync_diff_inspector_test/sync_diff_inspector/output"
4444

4545
source-instances = ["mysql1"]
4646

sync_diff_inspector/tests/sync_diff_inspector/checkpoint/config_base_continous.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ chunk-size = 50
4242
# 2 log: sync-diff.log
4343
# 3 summary: summary.txt
4444
# 4 checkpoint: a dir
45-
output-dir = "/tmp/tidb_tools_test/sync_diff_inspector/output"
45+
output-dir = "/tmp/sync_diff_inspector_test/sync_diff_inspector/output"
4646

4747
source-instances = ["mysql1"]
4848

0 commit comments

Comments
 (0)