<!-- PR description--> The concurrency limiter middleware is enabled by default for exchange backups. Adding a hidden --disable-concurrency-limiter flag to disable this middleware. Reasons for adding this flag: We have done limited perf testing with the concurrency limiter. In addition, our understanding of exchange concurrency limits is also a bit fuzzy. This flag acts as a killswitch in case we start to see perf regressions in prod. I see this as a temporary flag. Ideally we would never have to use it. Also, once we have a better way to configure concurrency limiter, we can eliminate this flag. --- #### Does this PR need a docs update or release note? - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature #### 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.--> - [ ] ⚡ Unit test
64 lines
1.5 KiB
Go
64 lines
1.5 KiB
Go
package options
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/alcionai/clues"
|
|
"github.com/spf13/cobra"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/alcionai/corso/src/internal/tester"
|
|
)
|
|
|
|
type OptionsUnitSuite struct {
|
|
tester.Suite
|
|
}
|
|
|
|
func TestOptionsUnitSuite(t *testing.T) {
|
|
suite.Run(t, &OptionsUnitSuite{Suite: tester.NewUnitSuite(t)})
|
|
}
|
|
|
|
func (suite *OptionsUnitSuite) TestAddExchangeCommands() {
|
|
t := suite.T()
|
|
|
|
cmd := &cobra.Command{
|
|
Use: "test",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
assert.True(t, failFastFV, FailFastFN)
|
|
assert.True(t, disableIncrementalsFV, DisableIncrementalsFN)
|
|
assert.True(t, noStatsFV, NoStatsFN)
|
|
assert.True(t, restorePermissionsFV, RestorePermissionsFN)
|
|
assert.True(t, skipReduceFV, SkipReduceFN)
|
|
assert.Equal(t, 2, fetchParallelismFV, FetchParallelismFN)
|
|
assert.True(t, disableConcurrencyLimiterFV, DisableConcurrencyLimiterFN)
|
|
},
|
|
}
|
|
|
|
// adds no-stats
|
|
AddGlobalOperationFlags(cmd)
|
|
|
|
AddFailFastFlag(cmd)
|
|
AddDisableIncrementalsFlag(cmd)
|
|
AddRestorePermissionsFlag(cmd)
|
|
AddSkipReduceFlag(cmd)
|
|
AddFetchParallelismFlag(cmd)
|
|
AddDisableConcurrencyLimiterFlag(cmd)
|
|
|
|
// Test arg parsing for few args
|
|
cmd.SetArgs([]string{
|
|
"test",
|
|
"--" + FailFastFN,
|
|
"--" + DisableIncrementalsFN,
|
|
"--" + NoStatsFN,
|
|
"--" + RestorePermissionsFN,
|
|
"--" + SkipReduceFN,
|
|
"--" + FetchParallelismFN, "2",
|
|
"--" + DisableConcurrencyLimiterFN,
|
|
})
|
|
|
|
err := cmd.Execute()
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
}
|