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

Function TestNeedCheckTargetClusterFresh

br/pkg/restore/snap_client/client_test.go:122–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

120}
121
122func TestNeedCheckTargetClusterFresh(t *testing.T) {
123 // cannot use shared `mc`, other parallel case may change it.
124 cluster := getStartedMockedCluster(t)
125 defer cluster.Stop()
126
127 g := gluetidb.New()
128 client := snapclient.NewRestoreClient(cluster.PDClient, cluster.PDHTTPCli, nil, split.DefaultTestKeepaliveCfg)
129 err := client.InitConnections(g, cluster.Storage)
130 require.NoError(t, err)
131
132 // not set filter and first run with checkpoint
133 require.True(t, client.NeedCheckFreshCluster(false, false))
134
135 // skip check when has checkpoint
136 require.False(t, client.NeedCheckFreshCluster(false, true))
137
138 // skip check when set --filter
139 require.False(t, client.NeedCheckFreshCluster(true, true))
140
141 // skip check when has set --filter and has checkpoint
142 require.False(t, client.NeedCheckFreshCluster(true, false))
143
144 require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/br/pkg/restore/snap_client/mock-incr-backup-data", "return(false)"))
145 defer func() {
146 require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/br/pkg/restore/snap_client/mock-incr-backup-data"))
147 }()
148 // skip check when increment backup
149 require.False(t, client.NeedCheckFreshCluster(false, false))
150}
151
152func TestCheckTargetClusterFresh(t *testing.T) {
153 // cannot use shared `mc`, other parallel case may change it.

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
getStartedMockedClusterFunction · 0.85
InitConnectionsMethod · 0.80
NeedCheckFreshClusterMethod · 0.80
EnableMethod · 0.80
DisableMethod · 0.80
StopMethod · 0.65

Tested by

no test coverage detected