(t *testing.T)
| 140 | } |
| 141 | |
| 142 | func TestMultiTablesRestorerRestoreSuccess(t *testing.T) { |
| 143 | ctx := context.Background() |
| 144 | importer := &FakeBalancedFileImporter{} |
| 145 | workerPool := util.NewWorkerPool(2, "multi-tables-restorer") |
| 146 | |
| 147 | restorer := restore.NewMultiTablesRestorer(ctx, importer, workerPool, nil) |
| 148 | |
| 149 | var progress int64 |
| 150 | fileSets := createSampleBatchFileSets() |
| 151 | fileSets2 := createSampleBatchFileSets() |
| 152 | |
| 153 | var mu sync.Mutex |
| 154 | restorer.GoRestore(func(p int64) { |
| 155 | mu.Lock() |
| 156 | progress += p |
| 157 | mu.Unlock() |
| 158 | }, fileSets, fileSets2) |
| 159 | err := restorer.WaitUntilFinish() |
| 160 | require.NoError(t, err) |
| 161 | |
| 162 | // Ensure progress was tracked correctly |
| 163 | require.Equal(t, int64(2), progress) // Total files group: 2 |
| 164 | require.Equal(t, 2, importer.unblockCount) |
| 165 | } |
| 166 | |
| 167 | func TestMultiTablesRestorerRestoreWithImportError(t *testing.T) { |
| 168 | ctx := context.Background() |
nothing calls this directly
no test coverage detected