Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
wk989898 committed Sep 11, 2024
1 parent cae2309 commit f072df3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 42 deletions.
19 changes: 19 additions & 0 deletions cdc/sink/dmlsink/txn/mysql/dml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (

"github.com/pingcap/tidb/pkg/parser/charset"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/types"
"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/pkg/util"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -709,6 +711,23 @@ func TestMapReplace(t *testing.T) {
[]byte("你好,世界"),
},
},
{
quoteTable: "`test`.`t1`",
cols: []*model.Column{
{
Name: "a",
Type: mysql.TypeTiDBVectorFloat32,
Value: util.Must(types.ParseVectorFloat32("[1.0,-2,0.3,-4.4,55]")),
},
{
Name: "b",
Type: mysql.TypeTiDBVectorFloat32,
Value: util.Must(types.ParseVectorFloat32("[1,2,3,4,5]")),
},
},
expectedQuery: "REPLACE INTO `test`.`t1` (`a`,`b`) VALUES ",
expectedArgs: []interface{}{"[1,-2,0.3,-4.4,55]", "[1,2,3,4,5]"},
},
}
for _, tc := range testCases {
// multiple times to verify the stability of column sequence in query string
Expand Down
43 changes: 2 additions & 41 deletions cdc/sink/dmlsink/txn/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,56 +1492,17 @@ func TestPrepareBatchDMLs(t *testing.T) {
}}, tableInfoWithVector),
ApproximateDataSize: 10,
},
{
StartTs: 418658114257813516,
CommitTs: 418658114257813517,
TableInfo: tableInfoWithVector,
PreColumns: model.Columns2ColumnDatas([]*model.Column{{
Name: "a1",
Value: 1,
}, {
Name: "a3",
Value: util.Must(types.ParseVectorFloat32("[1,2,3,4,5]")),
}}, tableInfoWithVector),
Columns: model.Columns2ColumnDatas([]*model.Column{{
Name: "a1",
Value: 3,
}, {
Name: "a3",
Value: util.Must(types.ParseVectorFloat32("[1.1,-2,3.33,-4.12,-5]")),
}}, tableInfoWithVector),
ApproximateDataSize: 10,
},
{
StartTs: 418658114257813516,
CommitTs: 418658114257813517,
TableInfo: tableInfoWithVector,
PreColumns: model.Columns2ColumnDatas([]*model.Column{{
Name: "a1",
Value: 3,
}, {
Name: "a3",
Value: util.Must(types.ParseVectorFloat32("[1.1,-2,3.33,-4.12,-5]")),
}}, tableInfoWithVector),
ApproximateDataSize: 10,
},
},
expected: &preparedDMLs{
startTs: []model.Ts{418658114257813516},
sqls: []string{
"DELETE FROM `common_1`.`uk_without_pk` WHERE (`a1` = ? AND `a3` = ?)",
"UPDATE `common_1`.`uk_without_pk` SET `a1`=CASE WHEN " +
"`a1` = ? AND `a3` = ? THEN ? END, `a3`=CASE WHEN " +
"`a1` = ? AND `a3` = ? THEN ? END WHERE (`a1` = ? AND `a3` = ?)",
"INSERT INTO `common_1`.`uk_without_pk` (`a1`,`a3`) VALUES (?,?)",
},
values: [][]interface{}{
{3, "[1.1,-2,3.33,-4.12,-5]"},
{1, "[1,2,3,4,5]", 3, 1, "[1,2,3,4,5]", "[1.1,-2,3.33,-4.12,-5]", 1, "[1,2,3,4,5]"},
{1, "[1,2,3,4,5]"},
},
rowCount: 3,
approximateSize: 325,
rowCount: 1,
approximateSize: 73,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/download-integration-test-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function download_binaries() {
tiflash_download_url="${file_server_url}/download/builds/pingcap/tiflash/${tiflash_branch}/${tiflash_sha1}/centos7/tiflash.tar.gz"
minio_download_url="${file_server_url}/download/minio.tar.gz"
go_ycsb_download_url="${file_server_url}/download/builds/pingcap/go-ycsb/test-br/go-ycsb"
etcd_download_url="${file_server_url}/download/builds/pingcap/cdc/etcd-v3.4.7-linux-amd64.tar.gz"
etcd_download_url="${file_server_url}/download/builds/pingcap/cdc/etcd-v3.5.15-linux-amd64.tar.gz"
sync_diff_inspector_url="${file_server_url}/download/builds/pingcap/cdc/sync_diff_inspector_hash-a129f096_linux-amd64.tar.gz"
jq_download_url="${file_server_url}/download/builds/pingcap/test/jq-1.6/jq-linux64"
schema_registry_url="${file_server_url}/download/builds/pingcap/cdc/schema-registry.tar.gz"
Expand Down

0 comments on commit f072df3

Please sign in to comment.