From 7f7a0796fbed6c2d46069630d80f306e4bf28b86 Mon Sep 17 00:00:00 2001 From: baerwang <52104949+baerwang@users.noreply.github.com> Date: Sat, 5 Nov 2022 19:20:08 +0800 Subject: [PATCH] test: strengthen ut (#332) --- .../undo/builder/mysql_multi_delete_undo_log_builder_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/datasource/sql/undo/builder/mysql_multi_delete_undo_log_builder_test.go b/pkg/datasource/sql/undo/builder/mysql_multi_delete_undo_log_builder_test.go index 9ea8d426e..7e89e0d6f 100644 --- a/pkg/datasource/sql/undo/builder/mysql_multi_delete_undo_log_builder_test.go +++ b/pkg/datasource/sql/undo/builder/mysql_multi_delete_undo_log_builder_test.go @@ -41,13 +41,13 @@ func TestBuildSelectSQLByMultiDelete(t *testing.T) { { sourceQuery: []string{"delete from table_update_executor_test2 where id = ?", "delete from table_update_executor_test2 where id = ?"}, sourceQueryArgs: []driver.Value{3, 2}, - expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 where id =? or id=? FOR UPDATE", + expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 WHERE id=? OR id=? FOR UPDATE", expectQueryArgs: []driver.Value{3, 2}, }, { sourceQuery: []string{"delete from table_update_executor_test2 where id = ?", "delete from table_update_executor_test2 where name = ? and age = ?"}, sourceQueryArgs: []driver.Value{3, "seata-go", 4}, - expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 where id =? or id=? and age=? FOR UPDATE", + expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 WHERE id=? OR name=? AND age=? FOR UPDATE", expectQueryArgs: []driver.Value{3, "seata-go", 4}, }, } @@ -59,6 +59,7 @@ func TestBuildSelectSQLByMultiDelete(t *testing.T) { items, args, err := builder.buildBeforeImageSQL(tt.sourceQuery, tt.sourceQueryArgs) assert.Nil(t, err) assert.Equal(t, 1, len(items)) + assert.Equal(t, items[0], tt.expectQuery) assert.Equal(t, tt.expectQueryArgs, args) }) }