mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
Run the E2E test on kind / setup-test-matrix (push) Failing after 4s
e2e-test-kind.yaml / extract (push) Failing after 11s
Run the E2E test on kind / get-go-version (push) Failing after 12s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 7s
Main CI / get-go-version (push) Failing after 8s
Main CI / Build (push) Skipped
* Report a measured zero incremental instead of erasing it A CBT incremental with an exactly zero delta -- nothing changed since the parent -- was reported identically to a backup that moved the whole device. `velero backup describe --details` printed only "Moved data Size (bytes): 3221225472" with no incremental line, and status.incrementalBytes was absent, for a run that transferred nothing. The best possible CBT outcome displayed as the worst, and was indistinguishable from a genuine full, a whole-device fallback, or a backup predating incremental accounting. The zero was being erased twice. Besides the API status fields, datapath.BackupResult also carried omitempty, and that struct crosses a JSON boundary from the data mover pod to the controller (see micro_service_watcher.go), so the value was destroyed before the controller could persist it. Every uploader always reports a figure there, so 0 internally always means "transferred nothing" -- dropping omitempty is sufficient and correct for that hop. The API fields move to *int64 rather than just dropping omitempty. The field shipped in v1.18.0-v1.18.2, so backups exist whose stored volume info has no incrementalSize at all; with a plain int64 those unmarshal to 0 and would render "Incremental data Size (bytes): 0", a false claim of a perfect incremental on a run that never measured one. nil means not measured, a pointer to 0 means measured zero. Both fields already carry +optional, so the generated CRD schema is unchanged and no regeneration is required. Display gates relax from > 0 to != nil in all three places, including volumesByPod.Add, whose signature takes *int64 now; the restore describer passes nil, which is correct since restores measure no incremental. Verified live: the same zero-delta scenario that reported <none> now reports 0 and renders "Incremental data Size (bytes): 0", while an older backup described with the new client still correctly prints no incremental line at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> (cherry picked from commit 6c7aa9d588f6d5eab134d4ce19c92b838f45557c) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> * gofmt: fix import ordering in backup_test.go Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> * Regenerate CRDs for IncrementalBytes pointer type make update-crd was missed in the original commit. Regenerated with the pinned controller-gen v0.16.5 to avoid unrelated version-annotation churn across other CRDs. Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> * Add changelog for #10309 Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> * Address review: make IncrementalBytes a pointer to preserve backward compat Per Lyndon-Li's review on #10309: dropping omitempty on the plain int64 field breaks compatibility with a data mover from release-1.17 or earlier that predates IncrementalBytes and never writes the key -- the new controller would unmarshal a zero value ("nothing transferred") instead of recognizing the field is simply absent ("not measured"). Switch to *int64 with omitempty restored: - an old mover's omitted key unmarshals to nil ("not measured") - a current mover's genuine zero still serializes the key, unmarshaling to a non-nil pointer to 0 ("measured zero") - nonzero values work exactly as before - an old controller can still unmarshal a numeric value from a new mover pkg/controller/data_upload_controller.go and pod_volume_backup_controller.go assign the wire-struct field directly to their already-*int64,omitempty CRD status field instead of re-wrapping it with ptr.To, since both are now the same pointer type. Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> * Fix CI: update marshal-fail test assertions for IncrementalBytes pointer Both backup_micro_service_test.go files hardcoded the %v-formatted zero-value BackupResult struct in an error-message assertion. Now that IncrementalBytes is *int64, its zero value prints as <nil> instead of 0. Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> --------- Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
535 lines
15 KiB
Go
535 lines
15 KiB
Go
/*
|
|
Copyright The Velero Contributors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package podvolume
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"sync"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/cockroachdb/errors"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/mock"
|
|
"github.com/stretchr/testify/require"
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
"github.com/vmware-tanzu/velero/pkg/builder"
|
|
"github.com/vmware-tanzu/velero/pkg/datapath"
|
|
"github.com/vmware-tanzu/velero/pkg/uploader"
|
|
|
|
veleroshared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
|
|
|
clientFake "sigs.k8s.io/controller-runtime/pkg/client/fake"
|
|
|
|
velerotest "github.com/vmware-tanzu/velero/pkg/test"
|
|
|
|
kbclient "sigs.k8s.io/controller-runtime/pkg/client"
|
|
|
|
datapathmockes "github.com/vmware-tanzu/velero/pkg/datapath/mocks"
|
|
)
|
|
|
|
type backupMsTestHelper struct {
|
|
eventReason string
|
|
eventMsg string
|
|
marshalErr error
|
|
marshalBytes []byte
|
|
withEvent bool
|
|
eventLock sync.Mutex
|
|
}
|
|
|
|
func (bt *backupMsTestHelper) Event(_ runtime.Object, _ bool, reason string, message string, a ...any) {
|
|
bt.eventLock.Lock()
|
|
defer bt.eventLock.Unlock()
|
|
|
|
bt.withEvent = true
|
|
bt.eventReason = reason
|
|
bt.eventMsg = fmt.Sprintf(message, a...)
|
|
}
|
|
|
|
func (bt *backupMsTestHelper) EndingEvent(_ runtime.Object, _ bool, reason string, message string, a ...any) {
|
|
bt.eventLock.Lock()
|
|
defer bt.eventLock.Unlock()
|
|
|
|
bt.withEvent = true
|
|
bt.eventReason = reason
|
|
bt.eventMsg = fmt.Sprintf(message, a...)
|
|
}
|
|
func (bt *backupMsTestHelper) Shutdown() {}
|
|
|
|
func (bt *backupMsTestHelper) Marshal(v any) ([]byte, error) {
|
|
if bt.marshalErr != nil {
|
|
return nil, bt.marshalErr
|
|
}
|
|
|
|
return bt.marshalBytes, nil
|
|
}
|
|
|
|
func (bt *backupMsTestHelper) EventReason() string {
|
|
bt.eventLock.Lock()
|
|
defer bt.eventLock.Unlock()
|
|
|
|
return bt.eventReason
|
|
}
|
|
|
|
func (bt *backupMsTestHelper) EventMessage() string {
|
|
bt.eventLock.Lock()
|
|
defer bt.eventLock.Unlock()
|
|
|
|
return bt.eventMsg
|
|
}
|
|
|
|
func TestOnDataPathFailed(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
bt := &backupMsTestHelper{}
|
|
|
|
bs := &BackupMicroService{
|
|
pvbName: pvbName,
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
expectedErr := "Data path for PVB fake-pvb failed: fake-error"
|
|
expectedEventReason := datapath.EventReasonFailed
|
|
expectedEventMsg := "Data path for PVB fake-pvb failed, error fake-error"
|
|
|
|
go bs.OnDataPathFailed(t.Context(), velerov1api.DefaultNamespace, pvbName, errors.New("fake-error"))
|
|
|
|
result := <-bs.resultSignal
|
|
require.EqualError(t, result.err, expectedErr)
|
|
assert.Equal(t, expectedEventReason, bt.EventReason())
|
|
assert.Equal(t, expectedEventMsg, bt.EventMessage())
|
|
}
|
|
|
|
func TestOnDataPathCancelled(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
bt := &backupMsTestHelper{}
|
|
|
|
bs := &BackupMicroService{
|
|
pvbName: pvbName,
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
expectedErr := datapath.ErrCancelled
|
|
expectedEventReason := datapath.EventReasonCancelled
|
|
expectedEventMsg := "Data path for PVB fake-pvb canceled"
|
|
|
|
go bs.OnDataPathCancelled(t.Context(), velerov1api.DefaultNamespace, pvbName)
|
|
|
|
result := <-bs.resultSignal
|
|
require.EqualError(t, result.err, expectedErr)
|
|
assert.Equal(t, expectedEventReason, bt.EventReason())
|
|
assert.Equal(t, expectedEventMsg, bt.EventMessage())
|
|
}
|
|
|
|
func TestOnDataPathCompleted(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
expectedErr string
|
|
expectedEventReason string
|
|
expectedEventMsg string
|
|
marshalErr error
|
|
marshallStr string
|
|
}{
|
|
{
|
|
name: "marshal fail",
|
|
marshalErr: errors.New("fake-marshal-error"),
|
|
expectedErr: "Failed to marshal backup result { false { } 0 <nil>}: fake-marshal-error",
|
|
},
|
|
{
|
|
name: "succeed",
|
|
marshallStr: "fake-complete-string",
|
|
expectedEventReason: datapath.EventReasonCompleted,
|
|
expectedEventMsg: "fake-complete-string",
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
|
|
bt := &backupMsTestHelper{
|
|
marshalErr: test.marshalErr,
|
|
marshalBytes: []byte(test.marshallStr),
|
|
}
|
|
|
|
bs := &BackupMicroService{
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
funcMarshal = bt.Marshal
|
|
|
|
go bs.OnDataPathCompleted(t.Context(), velerov1api.DefaultNamespace, pvbName, datapath.Result{})
|
|
|
|
result := <-bs.resultSignal
|
|
if test.marshalErr != nil {
|
|
assert.EqualError(t, result.err, test.expectedErr)
|
|
} else {
|
|
require.NoError(t, result.err)
|
|
assert.Equal(t, test.expectedEventReason, bt.EventReason())
|
|
assert.Equal(t, test.expectedEventMsg, bt.EventMessage())
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestOnDataPathProgress(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
expectedErr string
|
|
expectedEventReason string
|
|
expectedEventMsg string
|
|
marshalErr error
|
|
marshallStr string
|
|
}{
|
|
{
|
|
name: "marshal fail",
|
|
marshalErr: errors.New("fake-marshal-error"),
|
|
expectedErr: "Failed to marshal backup result",
|
|
},
|
|
{
|
|
name: "succeed",
|
|
marshallStr: "fake-progress-string",
|
|
expectedEventReason: datapath.EventReasonProgress,
|
|
expectedEventMsg: "fake-progress-string",
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
|
|
bt := &backupMsTestHelper{
|
|
marshalErr: test.marshalErr,
|
|
marshalBytes: []byte(test.marshallStr),
|
|
}
|
|
|
|
bs := &BackupMicroService{
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
funcMarshal = bt.Marshal
|
|
|
|
bs.OnDataPathProgress(t.Context(), velerov1api.DefaultNamespace, pvbName, &uploader.Progress{})
|
|
|
|
if test.marshalErr != nil {
|
|
assert.False(t, bt.withEvent)
|
|
} else {
|
|
assert.True(t, bt.withEvent)
|
|
assert.Equal(t, test.expectedEventReason, bt.EventReason())
|
|
assert.Equal(t, test.expectedEventMsg, bt.EventMessage())
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestCancelPodVolumeBackup(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
expectedEventReason string
|
|
expectedEventMsg string
|
|
expectedErr string
|
|
}{
|
|
{
|
|
name: "no fs backup",
|
|
expectedEventReason: datapath.EventReasonStopped,
|
|
expectedEventMsg: "Data path for fake-pvb exited without start",
|
|
expectedErr: datapath.ErrCancelled,
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
pvb := builder.ForPodVolumeBackup(velerov1api.DefaultNamespace, pvbName).Result()
|
|
|
|
bt := &backupMsTestHelper{}
|
|
|
|
bs := &BackupMicroService{
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
go bs.cancelPodVolumeBackup(pvb)
|
|
|
|
result := <-bs.resultSignal
|
|
|
|
require.EqualError(t, result.err, test.expectedErr)
|
|
assert.True(t, bt.withEvent)
|
|
assert.Equal(t, test.expectedEventReason, bt.EventReason())
|
|
assert.Equal(t, test.expectedEventMsg, bt.EventMessage())
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestRunCancelableDataPath(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
pvb := builder.ForPodVolumeBackup(velerov1api.DefaultNamespace, pvbName).Phase(velerov1api.PodVolumeBackupPhaseNew).Result()
|
|
pvbInProgress := builder.ForPodVolumeBackup(velerov1api.DefaultNamespace, pvbName).Phase(velerov1api.PodVolumeBackupPhaseInProgress).Result()
|
|
ctxTimeout, cancel := context.WithTimeout(t.Context(), time.Second)
|
|
|
|
tests := []struct {
|
|
name string
|
|
ctx context.Context
|
|
result *dataPathResult
|
|
dataPathMgr *datapath.Manager
|
|
kubeClientObj []runtime.Object
|
|
initErr error
|
|
startErr error
|
|
dataPathStarted bool
|
|
expectedEventMsg string
|
|
expectedErr string
|
|
}{
|
|
{
|
|
name: "no pvb",
|
|
ctx: ctxTimeout,
|
|
expectedErr: "error waiting for PVB: context deadline exceeded",
|
|
},
|
|
{
|
|
name: "pvb not in in-progress",
|
|
ctx: ctxTimeout,
|
|
kubeClientObj: []runtime.Object{pvb},
|
|
expectedErr: "error waiting for PVB: context deadline exceeded",
|
|
},
|
|
{
|
|
name: "create data path fail",
|
|
ctx: t.Context(),
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
dataPathMgr: datapath.NewManager(0),
|
|
expectedErr: "error to create data path: Concurrent number exceeds",
|
|
},
|
|
{
|
|
name: "init data path fail",
|
|
ctx: t.Context(),
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
initErr: errors.New("fake-init-error"),
|
|
expectedErr: "error to initialize data path: fake-init-error",
|
|
},
|
|
{
|
|
name: "start data path fail",
|
|
ctx: t.Context(),
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
startErr: errors.New("fake-start-error"),
|
|
expectedErr: "error starting data path backup: fake-start-error",
|
|
},
|
|
{
|
|
name: "data path timeout",
|
|
ctx: ctxTimeout,
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
dataPathStarted: true,
|
|
expectedEventMsg: fmt.Sprintf("Data path for %s stopped", pvbName),
|
|
expectedErr: "timed out waiting for fs backup to complete",
|
|
},
|
|
{
|
|
name: "data path returns error",
|
|
ctx: t.Context(),
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
dataPathStarted: true,
|
|
result: &dataPathResult{
|
|
err: errors.New("fake-data-path-error"),
|
|
},
|
|
expectedEventMsg: fmt.Sprintf("Data path for %s stopped", pvbName),
|
|
expectedErr: "fake-data-path-error",
|
|
},
|
|
{
|
|
name: "succeed",
|
|
ctx: t.Context(),
|
|
kubeClientObj: []runtime.Object{pvbInProgress},
|
|
dataPathStarted: true,
|
|
result: &dataPathResult{
|
|
result: "fake-succeed-result",
|
|
},
|
|
expectedEventMsg: fmt.Sprintf("Data path for %s stopped", pvbName),
|
|
},
|
|
}
|
|
|
|
scheme := runtime.NewScheme()
|
|
velerov1api.AddToScheme(scheme)
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
fakeClientBuilder := clientFake.NewClientBuilder()
|
|
fakeClientBuilder = fakeClientBuilder.WithScheme(scheme)
|
|
|
|
fakeClient := fakeClientBuilder.WithRuntimeObjects(test.kubeClientObj...).Build()
|
|
|
|
bt := &backupMsTestHelper{}
|
|
|
|
bs := &BackupMicroService{
|
|
namespace: velerov1api.DefaultNamespace,
|
|
pvbName: pvbName,
|
|
ctx: t.Context(),
|
|
client: fakeClient,
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: bt,
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
if test.ctx != nil {
|
|
bs.ctx = test.ctx
|
|
}
|
|
|
|
if test.dataPathMgr != nil {
|
|
bs.dataPathMgr = test.dataPathMgr
|
|
}
|
|
|
|
datapath.VGDPCreator = func(string, string, kbclient.Client, string, datapath.Callbacks, logrus.FieldLogger) datapath.AsyncBR {
|
|
fsBR := datapathmockes.NewAsyncBR(t)
|
|
if test.initErr != nil {
|
|
fsBR.On("Init", mock.Anything, mock.Anything).Return(test.initErr)
|
|
}
|
|
|
|
if test.startErr != nil {
|
|
fsBR.On("Init", mock.Anything, mock.Anything).Return(nil)
|
|
fsBR.On("StartBackup", mock.Anything, mock.Anything, mock.Anything).Return(test.startErr)
|
|
}
|
|
|
|
if test.dataPathStarted {
|
|
fsBR.On("Init", mock.Anything, mock.Anything).Return(nil)
|
|
fsBR.On("StartBackup", mock.Anything, mock.Anything, mock.Anything).Return(nil)
|
|
}
|
|
|
|
return fsBR
|
|
}
|
|
|
|
if test.result != nil {
|
|
go func() {
|
|
time.Sleep(time.Millisecond * 500)
|
|
bs.resultSignal <- *test.result
|
|
}()
|
|
}
|
|
|
|
result, err := bs.RunCancelableDataPath(test.ctx)
|
|
|
|
if test.expectedErr != "" {
|
|
require.EqualError(t, err, test.expectedErr)
|
|
} else {
|
|
require.NoError(t, err)
|
|
assert.Equal(t, test.result.result, result)
|
|
}
|
|
|
|
if test.expectedEventMsg != "" {
|
|
assert.True(t, bt.withEvent)
|
|
assert.Equal(t, test.expectedEventMsg, bt.EventMessage())
|
|
}
|
|
})
|
|
}
|
|
|
|
cancel()
|
|
}
|
|
|
|
func TestRunCancelableDataPathParentSnapshot(t *testing.T) {
|
|
pvbName := "fake-pvb"
|
|
|
|
tests := []struct {
|
|
name string
|
|
parentSnapshot string
|
|
expectedParentSnapshot string
|
|
expectedForceFull bool
|
|
}{
|
|
{
|
|
name: "empty lets the data mover search for a parent",
|
|
parentSnapshot: "",
|
|
expectedParentSnapshot: "",
|
|
expectedForceFull: false,
|
|
},
|
|
{
|
|
name: "auto lets the data mover search for a parent",
|
|
parentSnapshot: veleroshared.ParentSnapshotAuto,
|
|
expectedParentSnapshot: "",
|
|
expectedForceFull: false,
|
|
},
|
|
{
|
|
name: "none forces a full backup",
|
|
parentSnapshot: veleroshared.ParentSnapshotNone,
|
|
expectedParentSnapshot: "",
|
|
expectedForceFull: true,
|
|
},
|
|
{
|
|
name: "a specific snapshot ID is passed through unchanged",
|
|
parentSnapshot: "fake-parent-snapshot-id",
|
|
expectedParentSnapshot: "fake-parent-snapshot-id",
|
|
expectedForceFull: false,
|
|
},
|
|
}
|
|
|
|
scheme := runtime.NewScheme()
|
|
velerov1api.AddToScheme(scheme)
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pvbInProgress := builder.ForPodVolumeBackup(velerov1api.DefaultNamespace, pvbName).
|
|
Phase(velerov1api.PodVolumeBackupPhaseInProgress).
|
|
Result()
|
|
pvbInProgress.Spec.ParentSnapshot = test.parentSnapshot
|
|
|
|
fakeClient := clientFake.NewClientBuilder().WithScheme(scheme).
|
|
WithRuntimeObjects(pvbInProgress).Build()
|
|
|
|
bs := &BackupMicroService{
|
|
namespace: velerov1api.DefaultNamespace,
|
|
pvbName: pvbName,
|
|
ctx: t.Context(),
|
|
client: fakeClient,
|
|
dataPathMgr: datapath.NewManager(1),
|
|
eventRecorder: &backupMsTestHelper{},
|
|
resultSignal: make(chan dataPathResult),
|
|
logger: velerotest.NewLogger(),
|
|
}
|
|
|
|
var startParam *datapath.BackupStartParam
|
|
datapath.VGDPCreator = func(string, string, kbclient.Client, string, datapath.Callbacks, logrus.FieldLogger) datapath.AsyncBR {
|
|
fsBR := datapathmockes.NewAsyncBR(t)
|
|
fsBR.On("Init", mock.Anything, mock.Anything).Return(nil)
|
|
fsBR.On("StartBackup", mock.Anything, mock.Anything, mock.Anything).
|
|
Run(func(args mock.Arguments) {
|
|
startParam = args.Get(2).(*datapath.BackupStartParam)
|
|
}).Return(nil)
|
|
return fsBR
|
|
}
|
|
|
|
go func() {
|
|
time.Sleep(time.Millisecond * 500)
|
|
bs.resultSignal <- dataPathResult{result: "fake-succeed-result"}
|
|
}()
|
|
|
|
_, err := bs.RunCancelableDataPath(t.Context())
|
|
require.NoError(t, err)
|
|
|
|
require.NotNil(t, startParam)
|
|
assert.Equal(t, test.expectedParentSnapshot, startParam.ParentSnapshot)
|
|
assert.Equal(t, test.expectedForceFull, startParam.ForceFull)
|
|
})
|
|
}
|
|
}
|