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

Function createBackupSuite

br/pkg/backup/client_test.go:110–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func createBackupSuite(t *testing.T) *testBackup {
111 tikvClient, mockCluster, pdClient, err := testutils.NewMockTiKV("", nil)
112 require.NoError(t, err)
113 s := new(testBackup)
114 s.mockGlue = &gluemock.MockGlue{}
115 s.mockPDClient = pdClient
116 s.mockCluster = mockCluster
117 s.ctx, s.cancel = context.WithCancel(context.Background())
118 mockMgr := &conn.Mgr{PdController: &pdutil.PdController{}}
119 mockMgr.SetPDClient(s.mockPDClient)
120 s.backupClient = backup.NewBackupClient(s.ctx, mockMgr)
121
122 s.cluster, err = mock.NewCluster()
123 require.NoError(t, err)
124 base := t.TempDir()
125 s.storage, err = storage.NewLocalStorage(base)
126 require.NoError(t, err)
127 require.NoError(t, s.cluster.Start())
128
129 t.Cleanup(func() {
130 mockMgr.Close()
131 s.cluster.Stop()
132 tikvClient.Close()
133 pdClient.Close()
134 view.Stop()
135 })
136 return s
137}
138
139func TestGetTS(t *testing.T) {
140 s := createBackupSuite(t)

Callers 8

TestGetTSFunction · 0.85
TestGetHistoryDDLJobsFunction · 0.85
TestCheckBackupIsLockedFunction · 0.85
TestOnBackupResponseFunction · 0.85
TestMainBackupLoopFunction · 0.85

Calls 10

CloseMethod · 0.95
NewBackupClientFunction · 0.92
NewClusterFunction · 0.92
NewLocalStorageFunction · 0.92
WithCancelMethod · 0.80
SetPDClientMethod · 0.80
StartMethod · 0.65
CleanupMethod · 0.65
StopMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected