(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestShowViaSQL(t *testing.T) { |
| 172 | req := require.New(t) |
| 173 | store := testkit.CreateMockStore(t) |
| 174 | tk := testkit.NewTestKit(t, store) |
| 175 | |
| 176 | tempBackup := tempBackupDir(t) |
| 177 | metaPath := path.Join(tempBackup, "backupmeta") |
| 178 | err := os.WriteFile(metaPath, FullMeta, 0o444) |
| 179 | req.NoError(err) |
| 180 | |
| 181 | tk.MustExec("set @@time_zone='+08:00'") |
| 182 | res := tk.MustQuery(fmt.Sprintf("SHOW BACKUP METADATA FROM 'local://%s'", tempBackup)) |
| 183 | fmt.Printf("%#v", res.Sort().Rows()) |
| 184 | res.Sort().Check([][]any{ |
| 185 | {"tpcc", "customer", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 186 | {"tpcc", "district", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 187 | {"tpcc", "history", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 188 | {"tpcc", "item", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 189 | {"tpcc", "new_order", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 190 | {"tpcc", "order_line", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 191 | {"tpcc", "orders", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 192 | {"tpcc", "stock", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 193 | {"tpcc", "warehouse", "0", "0", "<nil>", "2023-04-10 11:18:21"}, |
| 194 | }) |
| 195 | |
| 196 | // Test result in different time_zone |
| 197 | tk.MustExec("set @@time_zone='-08:00'") |
| 198 | res = tk.MustQuery(fmt.Sprintf("SHOW BACKUP METADATA FROM 'local://%s'", tempBackup)) |
| 199 | fmt.Printf("%#v", res.Sort().Rows()) |
| 200 | res.Sort().Check([][]any{ |
| 201 | {"tpcc", "customer", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 202 | {"tpcc", "district", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 203 | {"tpcc", "history", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 204 | {"tpcc", "item", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 205 | {"tpcc", "new_order", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 206 | {"tpcc", "order_line", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 207 | {"tpcc", "orders", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 208 | {"tpcc", "stock", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 209 | {"tpcc", "warehouse", "0", "0", "<nil>", "2023-04-09 19:18:21"}, |
| 210 | }) |
| 211 | } |
nothing calls this directly
no test coverage detected