MCPcopy
hub / github.com/pingcap/tidb / TestMultiTablesRestorerRestoreSuccess

Function TestMultiTablesRestorerRestoreSuccess

br/pkg/restore/restorer_test.go:142–165  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

140}
141
142func 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
167func TestMultiTablesRestorerRestoreWithImportError(t *testing.T) {
168 ctx := context.Background()

Callers

nothing calls this directly

Calls 8

GoRestoreMethod · 0.95
WaitUntilFinishMethod · 0.95
NewWorkerPoolFunction · 0.92
NewMultiTablesRestorerFunction · 0.92
LockMethod · 0.65
UnlockMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected