When the user's mailbox is full, we cannot make use of delta apis. This adds initial changes needed to create separate delta and non delta pagers for all of exchange. *I would suggest looking commit wise when reviewing the PR.* --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ 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
67 lines
1.6 KiB
Go
67 lines
1.6 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, disableDeltaFV, DisableDeltaFN)
|
|
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)
|
|
AddDisableDeltaFlag(cmd)
|
|
AddRestorePermissionsFlag(cmd)
|
|
AddSkipReduceFlag(cmd)
|
|
AddFetchParallelismFlag(cmd)
|
|
AddDisableConcurrencyLimiterFlag(cmd)
|
|
|
|
// Test arg parsing for few args
|
|
cmd.SetArgs([]string{
|
|
"test",
|
|
"--" + FailFastFN,
|
|
"--" + DisableIncrementalsFN,
|
|
"--" + DisableDeltaFN,
|
|
"--" + NoStatsFN,
|
|
"--" + RestorePermissionsFN,
|
|
"--" + SkipReduceFN,
|
|
"--" + FetchParallelismFN, "2",
|
|
"--" + DisableConcurrencyLimiterFN,
|
|
})
|
|
|
|
err := cmd.Execute()
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
}
|