mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-23 16:34:16 +00:00
* Update code to support namespace mapping when perform the in-place restore with block data mover Update code to support namespace mapping when perform the in-p lace restore with block data mover Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/spf13/pflag"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetDefaultConfig(t *testing.T) {
|
|
config := GetDefaultConfig()
|
|
assert.Equal(t, 1, config.ItemBlockWorkerCount)
|
|
assert.Equal(t, 10*time.Minute, config.DefaultBackupCSISnapshotTimeout)
|
|
assert.Equal(t, 30*time.Minute, config.DefaultRestoreCSISnapshotTimeout)
|
|
}
|
|
|
|
func TestBindFlags(t *testing.T) {
|
|
config := GetDefaultConfig()
|
|
config.BindFlags(pflag.CommandLine)
|
|
assert.Equal(t, 1, config.ItemBlockWorkerCount)
|
|
}
|
|
|
|
func TestGlobalBackupVolumePoliciesConfigMapFlag(t *testing.T) {
|
|
config := GetDefaultConfig()
|
|
// Opt-in: defaults to empty.
|
|
assert.Empty(t, config.GlobalBackupVolumePoliciesConfigMap)
|
|
|
|
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
|
config.BindFlags(flags)
|
|
require.NoError(t, flags.Parse([]string{"--global-backup-volume-policies-configmap", "global-volume-policy"}))
|
|
assert.Equal(t, "global-volume-policy", config.GlobalBackupVolumePoliciesConfigMap)
|
|
}
|