Fix disable-incrementals flag in OneDrive (#3104)
It seems to have been accidentally removed in e4be050. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
ec064e539b
commit
f65df4b039
@ -9,20 +9,21 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/cli/options"
|
||||||
"github.com/alcionai/corso/src/cli/utils"
|
"github.com/alcionai/corso/src/cli/utils"
|
||||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExchangeSuite struct {
|
type ExchangeUnitSuite struct {
|
||||||
tester.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExchangeSuite(t *testing.T) {
|
func TestExchangeUnitSuite(t *testing.T) {
|
||||||
suite.Run(t, &ExchangeSuite{Suite: tester.NewUnitSuite(t)})
|
suite.Run(t, &ExchangeUnitSuite{Suite: tester.NewUnitSuite(t)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeSuite) TestAddExchangeCommands() {
|
func (suite *ExchangeUnitSuite) TestAddExchangeCommands() {
|
||||||
expectUse := exchangeServiceCommand
|
expectUse := exchangeServiceCommand
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -30,23 +31,71 @@ func (suite *ExchangeSuite) TestAddExchangeCommands() {
|
|||||||
use string
|
use string
|
||||||
expectUse string
|
expectUse string
|
||||||
expectShort string
|
expectShort string
|
||||||
|
flags []string
|
||||||
expectRunE func(*cobra.Command, []string) error
|
expectRunE func(*cobra.Command, []string) error
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"create exchange", createCommand, expectUse + " " + exchangeServiceCommandCreateUseSuffix,
|
"create exchange",
|
||||||
exchangeCreateCmd().Short, createExchangeCmd,
|
createCommand,
|
||||||
|
expectUse + " " + exchangeServiceCommandCreateUseSuffix,
|
||||||
|
exchangeCreateCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.UserFN,
|
||||||
|
utils.CategoryDataFN,
|
||||||
|
options.DisableIncrementalsFN,
|
||||||
|
options.FailFastFN,
|
||||||
|
options.FetchParallelismFN,
|
||||||
|
options.SkipReduceFN,
|
||||||
|
options.NoStatsFN,
|
||||||
|
},
|
||||||
|
createExchangeCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"list exchange", listCommand, expectUse,
|
"list exchange",
|
||||||
exchangeListCmd().Short, listExchangeCmd,
|
listCommand,
|
||||||
|
expectUse,
|
||||||
|
exchangeListCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
failedItemsFN,
|
||||||
|
skippedItemsFN,
|
||||||
|
recoveredErrorsFN,
|
||||||
|
},
|
||||||
|
listExchangeCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"details exchange", detailsCommand, expectUse + " " + exchangeServiceCommandDetailsUseSuffix,
|
"details exchange",
|
||||||
exchangeDetailsCmd().Short, detailsExchangeCmd,
|
detailsCommand,
|
||||||
|
expectUse + " " + exchangeServiceCommandDetailsUseSuffix,
|
||||||
|
exchangeDetailsCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
utils.ContactFN,
|
||||||
|
utils.ContactFolderFN,
|
||||||
|
utils.ContactNameFN,
|
||||||
|
utils.EmailFN,
|
||||||
|
utils.EmailFolderFN,
|
||||||
|
utils.EmailReceivedAfterFN,
|
||||||
|
utils.EmailReceivedBeforeFN,
|
||||||
|
utils.EmailSenderFN,
|
||||||
|
utils.EmailSubjectFN,
|
||||||
|
utils.EventFN,
|
||||||
|
utils.EventCalendarFN,
|
||||||
|
utils.EventOrganizerFN,
|
||||||
|
utils.EventRecursFN,
|
||||||
|
utils.EventStartsAfterFN,
|
||||||
|
utils.EventStartsBeforeFN,
|
||||||
|
utils.EventSubjectFN,
|
||||||
|
},
|
||||||
|
detailsExchangeCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"delete exchange", deleteCommand, expectUse + " " + exchangeServiceCommandDeleteUseSuffix,
|
"delete exchange",
|
||||||
exchangeDeleteCmd().Short, deleteExchangeCmd,
|
deleteCommand,
|
||||||
|
expectUse + " " + exchangeServiceCommandDeleteUseSuffix,
|
||||||
|
exchangeDeleteCmd().Short,
|
||||||
|
[]string{utils.BackupFN},
|
||||||
|
deleteExchangeCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
@ -69,7 +118,7 @@ func (suite *ExchangeSuite) TestAddExchangeCommands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeSuite) TestValidateBackupCreateFlags() {
|
func (suite *ExchangeUnitSuite) TestValidateBackupCreateFlags() {
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
user, data []string
|
user, data []string
|
||||||
@ -106,7 +155,7 @@ func (suite *ExchangeSuite) TestValidateBackupCreateFlags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeSuite) TestExchangeBackupCreateSelectors() {
|
func (suite *ExchangeUnitSuite) TestExchangeBackupCreateSelectors() {
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
user, data []string
|
user, data []string
|
||||||
@ -221,7 +270,7 @@ func (suite *ExchangeSuite) TestExchangeBackupCreateSelectors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeSuite) TestExchangeBackupDetailsSelectors() {
|
func (suite *ExchangeUnitSuite) TestExchangeBackupDetailsSelectors() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -241,7 +290,7 @@ func (suite *ExchangeSuite) TestExchangeBackupDetailsSelectors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ExchangeSuite) TestExchangeBackupDetailsSelectorsBadFormats() {
|
func (suite *ExchangeUnitSuite) TestExchangeBackupDetailsSelectorsBadFormats() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,7 @@ func addOneDriveCommands(cmd *cobra.Command) *cobra.Command {
|
|||||||
|
|
||||||
utils.AddUserFlag(c)
|
utils.AddUserFlag(c)
|
||||||
options.AddFailFastFlag(c)
|
options.AddFailFastFlag(c)
|
||||||
|
options.AddDisableIncrementalsFlag(c)
|
||||||
|
|
||||||
case listCommand:
|
case listCommand:
|
||||||
c, fs = utils.AddCommand(cmd, oneDriveListCmd())
|
c, fs = utils.AddCommand(cmd, oneDriveListCmd())
|
||||||
|
|||||||
@ -9,19 +9,21 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/cli/options"
|
||||||
|
"github.com/alcionai/corso/src/cli/utils"
|
||||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OneDriveSuite struct {
|
type OneDriveUnitSuite struct {
|
||||||
tester.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOneDriveSuite(t *testing.T) {
|
func TestOneDriveUnitSuite(t *testing.T) {
|
||||||
suite.Run(t, &OneDriveSuite{Suite: tester.NewUnitSuite(t)})
|
suite.Run(t, &OneDriveUnitSuite{Suite: tester.NewUnitSuite(t)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *OneDriveSuite) TestAddOneDriveCommands() {
|
func (suite *OneDriveUnitSuite) TestAddOneDriveCommands() {
|
||||||
expectUse := oneDriveServiceCommand
|
expectUse := oneDriveServiceCommand
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -29,25 +31,60 @@ func (suite *OneDriveSuite) TestAddOneDriveCommands() {
|
|||||||
use string
|
use string
|
||||||
expectUse string
|
expectUse string
|
||||||
expectShort string
|
expectShort string
|
||||||
|
flags []string
|
||||||
expectRunE func(*cobra.Command, []string) error
|
expectRunE func(*cobra.Command, []string) error
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"create onedrive", createCommand, expectUse + " " + oneDriveServiceCommandCreateUseSuffix,
|
"create onedrive",
|
||||||
oneDriveCreateCmd().Short, createOneDriveCmd,
|
createCommand,
|
||||||
|
expectUse + " " + oneDriveServiceCommandCreateUseSuffix,
|
||||||
|
oneDriveCreateCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.UserFN,
|
||||||
|
options.DisableIncrementalsFN,
|
||||||
|
options.FailFastFN,
|
||||||
|
},
|
||||||
|
createOneDriveCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"list onedrive", listCommand, expectUse,
|
"list onedrive",
|
||||||
oneDriveListCmd().Short, listOneDriveCmd,
|
listCommand,
|
||||||
|
expectUse,
|
||||||
|
oneDriveListCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
failedItemsFN,
|
||||||
|
skippedItemsFN,
|
||||||
|
recoveredErrorsFN,
|
||||||
|
},
|
||||||
|
listOneDriveCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"details onedrive", detailsCommand, expectUse + " " + oneDriveServiceCommandDetailsUseSuffix,
|
"details onedrive",
|
||||||
oneDriveDetailsCmd().Short, detailsOneDriveCmd,
|
detailsCommand,
|
||||||
|
expectUse + " " + oneDriveServiceCommandDetailsUseSuffix,
|
||||||
|
oneDriveDetailsCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
utils.FolderFN,
|
||||||
|
utils.FileFN,
|
||||||
|
utils.FileCreatedAfterFN,
|
||||||
|
utils.FileCreatedBeforeFN,
|
||||||
|
utils.FileModifiedAfterFN,
|
||||||
|
utils.FileModifiedBeforeFN,
|
||||||
|
},
|
||||||
|
detailsOneDriveCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"delete onedrive", deleteCommand, expectUse + " " + oneDriveServiceCommandDeleteUseSuffix,
|
"delete onedrive",
|
||||||
oneDriveDeleteCmd().Short, deleteOneDriveCmd,
|
deleteCommand,
|
||||||
|
expectUse + " " + oneDriveServiceCommandDeleteUseSuffix,
|
||||||
|
oneDriveDeleteCmd().Short,
|
||||||
|
[]string{utils.BackupFN},
|
||||||
|
deleteOneDriveCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
@ -64,11 +101,15 @@ func (suite *OneDriveSuite) TestAddOneDriveCommands() {
|
|||||||
assert.Equal(t, test.expectUse, child.Use)
|
assert.Equal(t, test.expectUse, child.Use)
|
||||||
assert.Equal(t, test.expectShort, child.Short)
|
assert.Equal(t, test.expectShort, child.Short)
|
||||||
tester.AreSameFunc(t, test.expectRunE, child.RunE)
|
tester.AreSameFunc(t, test.expectRunE, child.RunE)
|
||||||
|
|
||||||
|
for _, f := range test.flags {
|
||||||
|
assert.NotNil(t, c.Flag(f), f+" flag")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *OneDriveSuite) TestValidateOneDriveBackupCreateFlags() {
|
func (suite *OneDriveUnitSuite) TestValidateOneDriveBackupCreateFlags() {
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
user []string
|
user []string
|
||||||
@ -92,7 +133,7 @@ func (suite *OneDriveSuite) TestValidateOneDriveBackupCreateFlags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *OneDriveSuite) TestOneDriveBackupDetailsSelectors() {
|
func (suite *OneDriveUnitSuite) TestOneDriveBackupDetailsSelectors() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -112,7 +153,7 @@ func (suite *OneDriveSuite) TestOneDriveBackupDetailsSelectors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *OneDriveSuite) TestOneDriveBackupDetailsSelectorsBadFormats() {
|
func (suite *OneDriveUnitSuite) TestOneDriveBackupDetailsSelectorsBadFormats() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
|
|||||||
@ -84,6 +84,7 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
|
|||||||
utils.AddSiteIDFlag(c)
|
utils.AddSiteIDFlag(c)
|
||||||
utils.AddDataFlag(c, []string{dataLibraries}, true)
|
utils.AddDataFlag(c, []string{dataLibraries}, true)
|
||||||
options.AddFailFastFlag(c)
|
options.AddFailFastFlag(c)
|
||||||
|
options.AddDisableIncrementalsFlag(c)
|
||||||
|
|
||||||
case listCommand:
|
case listCommand:
|
||||||
c, fs = utils.AddCommand(cmd, sharePointListCmd())
|
c, fs = utils.AddCommand(cmd, sharePointListCmd())
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/cli/options"
|
||||||
"github.com/alcionai/corso/src/cli/utils"
|
"github.com/alcionai/corso/src/cli/utils"
|
||||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
@ -16,15 +17,15 @@ import (
|
|||||||
"github.com/alcionai/corso/src/pkg/selectors"
|
"github.com/alcionai/corso/src/pkg/selectors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SharePointSuite struct {
|
type SharePointUnitSuite struct {
|
||||||
tester.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSharePointSuite(t *testing.T) {
|
func TestSharePointUnitSuite(t *testing.T) {
|
||||||
suite.Run(t, &SharePointSuite{tester.NewUnitSuite(t)})
|
suite.Run(t, &SharePointUnitSuite{tester.NewUnitSuite(t)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SharePointSuite) TestAddSharePointCommands() {
|
func (suite *SharePointUnitSuite) TestAddSharePointCommands() {
|
||||||
expectUse := sharePointServiceCommand
|
expectUse := sharePointServiceCommand
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -32,23 +33,58 @@ func (suite *SharePointSuite) TestAddSharePointCommands() {
|
|||||||
use string
|
use string
|
||||||
expectUse string
|
expectUse string
|
||||||
expectShort string
|
expectShort string
|
||||||
|
flags []string
|
||||||
expectRunE func(*cobra.Command, []string) error
|
expectRunE func(*cobra.Command, []string) error
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"create sharepoint", createCommand, expectUse + " " + sharePointServiceCommandCreateUseSuffix,
|
"create sharepoint",
|
||||||
sharePointCreateCmd().Short, createSharePointCmd,
|
createCommand,
|
||||||
|
expectUse + " " + sharePointServiceCommandCreateUseSuffix,
|
||||||
|
sharePointCreateCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.SiteFN,
|
||||||
|
options.DisableIncrementalsFN,
|
||||||
|
options.FailFastFN,
|
||||||
|
},
|
||||||
|
createSharePointCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"list sharepoint", listCommand, expectUse,
|
"list sharepoint",
|
||||||
sharePointListCmd().Short, listSharePointCmd,
|
listCommand,
|
||||||
|
expectUse,
|
||||||
|
sharePointListCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
failedItemsFN,
|
||||||
|
skippedItemsFN,
|
||||||
|
recoveredErrorsFN,
|
||||||
|
},
|
||||||
|
listSharePointCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"details sharepoint", detailsCommand, expectUse + " " + sharePointServiceCommandDetailsUseSuffix,
|
"details sharepoint",
|
||||||
sharePointDetailsCmd().Short, detailsSharePointCmd,
|
detailsCommand,
|
||||||
|
expectUse + " " + sharePointServiceCommandDetailsUseSuffix,
|
||||||
|
sharePointDetailsCmd().Short,
|
||||||
|
[]string{
|
||||||
|
utils.BackupFN,
|
||||||
|
utils.LibraryFN,
|
||||||
|
utils.FolderFN,
|
||||||
|
utils.FileFN,
|
||||||
|
utils.FileCreatedAfterFN,
|
||||||
|
utils.FileCreatedBeforeFN,
|
||||||
|
utils.FileModifiedAfterFN,
|
||||||
|
utils.FileModifiedBeforeFN,
|
||||||
|
},
|
||||||
|
detailsSharePointCmd,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"delete sharepoint", deleteCommand, expectUse + " " + sharePointServiceCommandDeleteUseSuffix,
|
"delete sharepoint",
|
||||||
sharePointDeleteCmd().Short, deleteSharePointCmd,
|
deleteCommand,
|
||||||
|
expectUse + " " + sharePointServiceCommandDeleteUseSuffix,
|
||||||
|
sharePointDeleteCmd().Short,
|
||||||
|
[]string{utils.BackupFN},
|
||||||
|
deleteSharePointCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
@ -67,11 +103,15 @@ func (suite *SharePointSuite) TestAddSharePointCommands() {
|
|||||||
assert.Equal(t, test.expectUse, child.Use)
|
assert.Equal(t, test.expectUse, child.Use)
|
||||||
assert.Equal(t, test.expectShort, child.Short)
|
assert.Equal(t, test.expectShort, child.Short)
|
||||||
tester.AreSameFunc(t, test.expectRunE, child.RunE)
|
tester.AreSameFunc(t, test.expectRunE, child.RunE)
|
||||||
|
|
||||||
|
for _, f := range test.flags {
|
||||||
|
assert.NotNil(t, c.Flag(f), f+" flag")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SharePointSuite) TestValidateSharePointBackupCreateFlags() {
|
func (suite *SharePointUnitSuite) TestValidateSharePointBackupCreateFlags() {
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
site []string
|
site []string
|
||||||
@ -107,7 +147,7 @@ func (suite *SharePointSuite) TestValidateSharePointBackupCreateFlags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SharePointSuite) TestSharePointBackupCreateSelectors() {
|
func (suite *SharePointUnitSuite) TestSharePointBackupCreateSelectors() {
|
||||||
const (
|
const (
|
||||||
id1 = "id_1"
|
id1 = "id_1"
|
||||||
id2 = "id_2"
|
id2 = "id_2"
|
||||||
@ -215,7 +255,7 @@ func (suite *SharePointSuite) TestSharePointBackupCreateSelectors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SharePointSuite) TestSharePointBackupDetailsSelectors() {
|
func (suite *SharePointUnitSuite) TestSharePointBackupDetailsSelectors() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -235,7 +275,7 @@ func (suite *SharePointSuite) TestSharePointBackupDetailsSelectors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SharePointSuite) TestSharePointBackupDetailsSelectorsBadFormats() {
|
func (suite *SharePointUnitSuite) TestSharePointBackupDetailsSelectorsBadFormats() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
|
|||||||
@ -28,11 +28,12 @@ func Control() control.Options {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const (
|
const (
|
||||||
failFastFN = "fail-fast"
|
FailFastFN = "fail-fast"
|
||||||
fetchParallelismFN = "fetch-parallelism"
|
FetchParallelismFN = "fetch-parallelism"
|
||||||
noStatsFN = "no-stats"
|
NoStatsFN = "no-stats"
|
||||||
restorePermissionsFN = "restore-permissions"
|
RestorePermissionsFN = "restore-permissions"
|
||||||
skipReduceFN = "skip-reduce"
|
SkipReduceFN = "skip-reduce"
|
||||||
|
DisableIncrementalsFN = "disable-incrementals"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -46,29 +47,29 @@ var (
|
|||||||
// AddGlobalOperationFlags adds the global operations flag set.
|
// AddGlobalOperationFlags adds the global operations flag set.
|
||||||
func AddGlobalOperationFlags(cmd *cobra.Command) {
|
func AddGlobalOperationFlags(cmd *cobra.Command) {
|
||||||
fs := cmd.PersistentFlags()
|
fs := cmd.PersistentFlags()
|
||||||
fs.BoolVar(&noStatsFV, noStatsFN, false, "disable anonymous usage statistics gathering")
|
fs.BoolVar(&noStatsFV, NoStatsFN, false, "disable anonymous usage statistics gathering")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddFailFastFlag adds a flag to toggle fail-fast error handling behavior.
|
// AddFailFastFlag adds a flag to toggle fail-fast error handling behavior.
|
||||||
func AddFailFastFlag(cmd *cobra.Command) {
|
func AddFailFastFlag(cmd *cobra.Command) {
|
||||||
fs := cmd.Flags()
|
fs := cmd.Flags()
|
||||||
fs.BoolVar(&failFastFV, failFastFN, false, "stop processing immediately if any error occurs")
|
fs.BoolVar(&failFastFV, FailFastFN, false, "stop processing immediately if any error occurs")
|
||||||
// TODO: reveal this flag when fail-fast support is implemented
|
// TODO: reveal this flag when fail-fast support is implemented
|
||||||
cobra.CheckErr(fs.MarkHidden(failFastFN))
|
cobra.CheckErr(fs.MarkHidden(FailFastFN))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddRestorePermissionsFlag adds OneDrive flag for restoring permissions
|
// AddRestorePermissionsFlag adds OneDrive flag for restoring permissions
|
||||||
func AddRestorePermissionsFlag(cmd *cobra.Command) {
|
func AddRestorePermissionsFlag(cmd *cobra.Command) {
|
||||||
fs := cmd.Flags()
|
fs := cmd.Flags()
|
||||||
fs.BoolVar(&restorePermissionsFV, restorePermissionsFN, false, "Restore permissions for files and folders")
|
fs.BoolVar(&restorePermissionsFV, RestorePermissionsFN, false, "Restore permissions for files and folders")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddSkipReduceFlag adds a hidden flag that allows callers to skip the selector
|
// AddSkipReduceFlag adds a hidden flag that allows callers to skip the selector
|
||||||
// reduction step. Currently only intended for details commands, not restore.
|
// reduction step. Currently only intended for details commands, not restore.
|
||||||
func AddSkipReduceFlag(cmd *cobra.Command) {
|
func AddSkipReduceFlag(cmd *cobra.Command) {
|
||||||
fs := cmd.Flags()
|
fs := cmd.Flags()
|
||||||
fs.BoolVar(&skipReduceFV, skipReduceFN, false, "Skip the selector reduce filtering")
|
fs.BoolVar(&skipReduceFV, SkipReduceFN, false, "Skip the selector reduce filtering")
|
||||||
cobra.CheckErr(fs.MarkHidden(skipReduceFN))
|
cobra.CheckErr(fs.MarkHidden(SkipReduceFN))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddFetchParallelismFlag adds a hidden flag that allows callers to reduce call
|
// AddFetchParallelismFlag adds a hidden flag that allows callers to reduce call
|
||||||
@ -77,18 +78,16 @@ func AddFetchParallelismFlag(cmd *cobra.Command) {
|
|||||||
fs := cmd.Flags()
|
fs := cmd.Flags()
|
||||||
fs.IntVar(
|
fs.IntVar(
|
||||||
&fetchParallelismFV,
|
&fetchParallelismFV,
|
||||||
fetchParallelismFN,
|
FetchParallelismFN,
|
||||||
4,
|
4,
|
||||||
"Control the number of concurrent data fetches for Exchange. Valid range is [1-4]. Default: 4")
|
"Control the number of concurrent data fetches for Exchange. Valid range is [1-4]. Default: 4")
|
||||||
cobra.CheckErr(fs.MarkHidden(fetchParallelismFN))
|
cobra.CheckErr(fs.MarkHidden(FetchParallelismFN))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Feature Flags
|
// Feature Flags
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const disableIncrementalsFN = "disable-incrementals"
|
|
||||||
|
|
||||||
var disableIncrementalsFV bool
|
var disableIncrementalsFV bool
|
||||||
|
|
||||||
// Adds the hidden '--disable-incrementals' cli flag which, when set, disables
|
// Adds the hidden '--disable-incrementals' cli flag which, when set, disables
|
||||||
@ -97,8 +96,8 @@ func AddDisableIncrementalsFlag(cmd *cobra.Command) {
|
|||||||
fs := cmd.Flags()
|
fs := cmd.Flags()
|
||||||
fs.BoolVar(
|
fs.BoolVar(
|
||||||
&disableIncrementalsFV,
|
&disableIncrementalsFV,
|
||||||
disableIncrementalsFN,
|
DisableIncrementalsFN,
|
||||||
false,
|
false,
|
||||||
"Disable incremental data retrieval in backups.")
|
"Disable incremental data retrieval in backups.")
|
||||||
cobra.CheckErr(fs.MarkHidden(disableIncrementalsFN))
|
cobra.CheckErr(fs.MarkHidden(DisableIncrementalsFN))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,12 +26,12 @@ func (suite *OptionsUnitSuite) TestAddExchangeCommands() {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "test",
|
Use: "test",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
assert.True(t, failFastFV, failFastFN)
|
assert.True(t, failFastFV, FailFastFN)
|
||||||
assert.True(t, disableIncrementalsFV, disableIncrementalsFN)
|
assert.True(t, disableIncrementalsFV, DisableIncrementalsFN)
|
||||||
assert.True(t, noStatsFV, noStatsFN)
|
assert.True(t, noStatsFV, NoStatsFN)
|
||||||
assert.True(t, restorePermissionsFV, restorePermissionsFN)
|
assert.True(t, restorePermissionsFV, RestorePermissionsFN)
|
||||||
assert.True(t, skipReduceFV, skipReduceFN)
|
assert.True(t, skipReduceFV, SkipReduceFN)
|
||||||
assert.Equal(t, 2, fetchParallelismFV, fetchParallelismFN)
|
assert.Equal(t, 2, fetchParallelismFV, FetchParallelismFN)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +48,13 @@ func (suite *OptionsUnitSuite) TestAddExchangeCommands() {
|
|||||||
// Test arg parsing for few args
|
// Test arg parsing for few args
|
||||||
cmd.SetArgs([]string{
|
cmd.SetArgs([]string{
|
||||||
"test",
|
"test",
|
||||||
"--" + failFastFN,
|
"--" + FailFastFN,
|
||||||
"--" + disableIncrementalsFN,
|
"--" + DisableIncrementalsFN,
|
||||||
"--" + noStatsFN,
|
"--" + NoStatsFN,
|
||||||
"--" + restorePermissionsFN,
|
"--" + RestorePermissionsFN,
|
||||||
"--" + skipReduceFN,
|
"--" + SkipReduceFN,
|
||||||
|
|
||||||
"--" + fetchParallelismFN, "2",
|
"--" + FetchParallelismFN, "2",
|
||||||
})
|
})
|
||||||
|
|
||||||
err := cmd.Execute()
|
err := cmd.Execute()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user