The fetch paralellism checks and logs occur on every item streamed from GC. This is a bit chatty, and has been moved upstream in the process for a more centralized behavior. --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Test Plan - [x] 💪 Manual - [x] ⚡ Unit test
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package backup_test
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/alcionai/clues"
|
|
"github.com/spf13/viper"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/alcionai/corso/src/cli/config"
|
|
"github.com/alcionai/corso/src/internal/tester"
|
|
"github.com/alcionai/corso/src/pkg/account"
|
|
"github.com/alcionai/corso/src/pkg/control"
|
|
"github.com/alcionai/corso/src/pkg/repository"
|
|
"github.com/alcionai/corso/src/pkg/storage"
|
|
)
|
|
|
|
func prepM365Test(
|
|
t *testing.T,
|
|
ctx context.Context, //revive:disable-line:context-as-argument
|
|
) (
|
|
account.Account,
|
|
storage.Storage,
|
|
repository.Repository,
|
|
*viper.Viper,
|
|
strings.Builder,
|
|
string,
|
|
) {
|
|
var (
|
|
acct = tester.NewM365Account(t)
|
|
st = tester.NewPrefixedS3Storage(t)
|
|
recorder = strings.Builder{}
|
|
)
|
|
|
|
cfg, err := st.S3Config()
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
force := map[string]string{
|
|
tester.TestCfgAccountProvider: "M365",
|
|
tester.TestCfgStorageProvider: "S3",
|
|
tester.TestCfgPrefix: cfg.Prefix,
|
|
}
|
|
|
|
vpr, cfgFP := tester.MakeTempTestConfigClone(t, force)
|
|
ctx = config.SetViper(ctx, vpr)
|
|
|
|
repo, err := repository.Initialize(ctx, acct, st, control.Defaults())
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
return acct, st, repo, vpr, recorder, cfgFP
|
|
}
|