(t *testing.T)
| 1103 | } |
| 1104 | |
| 1105 | func TestCheckpointQueryBuilder(t *testing.T) { |
| 1106 | databaseName := "mydb" |
| 1107 | tableName := "_tbl_ghk" |
| 1108 | valueArgs := []interface{}{"mona", "mascot", int8(-17), "anothername", "anotherposition", int8(-2)} |
| 1109 | uniqueKeyColumns := NewColumnList([]string{"name", "position", "my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长很长很长"}) |
| 1110 | builder, err := NewCheckpointQueryBuilder(databaseName, tableName, uniqueKeyColumns) |
| 1111 | require.NoError(t, err) |
| 1112 | query, uniqueKeyArgs, err := builder.BuildQuery(valueArgs) |
| 1113 | require.NoError(t, err) |
| 1114 | expected := ` |
| 1115 | insert /* gh-ost */ into mydb._tbl_ghk |
| 1116 | (gh_ost_chk_timestamp, gh_ost_chk_coords, gh_ost_chk_iteration, |
| 1117 | gh_ost_rows_copied, gh_ost_dml_applied, gh_ost_is_cutover, |
| 1118 | name_min, position_min, my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长_min, |
| 1119 | name_max, position_max, my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长_max) |
| 1120 | values |
| 1121 | (unix_timestamp(now()), ?, ?, |
| 1122 | ?, ?, ?, |
| 1123 | ?, ?, ?, |
| 1124 | ?, ?, ?) |
| 1125 | ` |
| 1126 | require.Equal(t, normalizeQuery(expected), normalizeQuery(query)) |
| 1127 | require.Equal(t, []interface{}{"mona", "mascot", int8(-17), "anothername", "anotherposition", int8(-2)}, uniqueKeyArgs) |
| 1128 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…