split tester into separate files (#3762)

This is primarily an exercise in reducing the number of circular imports we get from adding the tester package to other packages.

No logic changes.  Purely movement/renaming.

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Keepers 2023-07-06 09:43:57 -06:00 committed by GitHub
parent 5ff4ce9b19
commit 8ba79709a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 427 additions and 347 deletions

View File

@ -18,15 +18,18 @@ import (
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
"github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/cli/print"
cliTD "github.com/alcionai/corso/src/cli/testdata"
"github.com/alcionai/corso/src/internal/common/idname" "github.com/alcionai/corso/src/internal/common/idname"
"github.com/alcionai/corso/src/internal/m365/exchange" "github.com/alcionai/corso/src/internal/m365/exchange"
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
var ( var (
@ -51,10 +54,11 @@ type ExchangeCMDWithFlagsE2ESuite struct {
} }
func TestExchangeCMDWithFlagsE2ESuite(t *testing.T) { func TestExchangeCMDWithFlagsE2ESuite(t *testing.T) {
suite.Run(t, &ExchangeCMDWithFlagsE2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &ExchangeCMDWithFlagsE2ESuite{
t, Suite: tester.NewE2ESuite(
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, t,
)}) [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
})
} }
func (suite *ExchangeCMDWithFlagsE2ESuite) SetupSuite() { func (suite *ExchangeCMDWithFlagsE2ESuite) SetupSuite() {
@ -71,7 +75,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) SetupSuite() {
suite.vpr = vpr suite.vpr = vpr
suite.recorder = recorder suite.recorder = recorder
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365UserID = tester.M365UserID(t) suite.m365UserID = tconfig.M365UserID(t)
} }
func (suite *ExchangeCMDWithFlagsE2ESuite) TestBackupCreateExchange_badAzureClientID() { func (suite *ExchangeCMDWithFlagsE2ESuite) TestBackupCreateExchange_badAzureClientID() {
@ -82,7 +86,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestBackupCreateExchange_badAzureClie
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--user", suite.m365UserID, "--user", suite.m365UserID,
"--azure-client-id", "invalid-value", "--azure-client-id", "invalid-value",
@ -107,7 +111,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestBackupCreateExchange_azureIDFromC
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--user", suite.m365UserID, "--user", suite.m365UserID,
"--config-file", suite.cfgFP) "--config-file", suite.cfgFP)
@ -137,7 +141,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupValueFromEnvCmd_emp
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--user", suite.m365UserID) "--user", suite.m365UserID)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -166,7 +170,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupInvalidAWSClientIDC
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--user", suite.m365UserID, "--user", suite.m365UserID,
"--aws-access-key", "invalid-value", "--aws-access-key", "invalid-value",
@ -193,7 +197,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupAWSValueFromEnvCmd_
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--user", suite.m365UserID) "--user", suite.m365UserID)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -231,7 +235,7 @@ type NoBackupExchangeE2ESuite struct {
func TestNoBackupExchangeE2ESuite(t *testing.T) { func TestNoBackupExchangeE2ESuite(t *testing.T) {
suite.Run(t, &NoBackupExchangeE2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &NoBackupExchangeE2ESuite{Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -249,7 +253,7 @@ func (suite *NoBackupExchangeE2ESuite) SetupSuite() {
suite.vpr = vpr suite.vpr = vpr
suite.recorder = recorder suite.recorder = recorder
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365UserID = tester.M365UserID(t) suite.m365UserID = tconfig.M365UserID(t)
} }
func (suite *NoBackupExchangeE2ESuite) TestExchangeBackupListCmd_empty() { func (suite *NoBackupExchangeE2ESuite) TestExchangeBackupListCmd_empty() {
@ -261,7 +265,7 @@ func (suite *NoBackupExchangeE2ESuite) TestExchangeBackupListCmd_empty() {
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "exchange", "backup", "list", "exchange",
"--config-file", suite.cfgFP) "--config-file", suite.cfgFP)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -297,7 +301,7 @@ type BackupExchangeE2ESuite struct {
func TestBackupExchangeE2ESuite(t *testing.T) { func TestBackupExchangeE2ESuite(t *testing.T) {
suite.Run(t, &BackupExchangeE2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &BackupExchangeE2ESuite{Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -314,7 +318,7 @@ func (suite *BackupExchangeE2ESuite) SetupSuite() {
suite.repo = repo suite.repo = repo
suite.vpr = vpr suite.vpr = vpr
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365UserID = tester.M365UserID(t) suite.m365UserID = tconfig.M365UserID(t)
} }
func (suite *BackupExchangeE2ESuite) TestExchangeBackupCmd_email() { func (suite *BackupExchangeE2ESuite) TestExchangeBackupCmd_email() {
@ -373,7 +377,7 @@ func runExchangeBackupServiceNotEnabledTest(suite *BackupExchangeE2ESuite, categ
cmd, ctx := buildExchangeBackupCmd( cmd, ctx := buildExchangeBackupCmd(
ctx, ctx,
suite.cfgFP, suite.cfgFP,
fmt.Sprintf("%s,%s", tester.UnlicensedM365UserID(suite.T()), suite.m365UserID), fmt.Sprintf("%s,%s", tconfig.UnlicensedM365UserID(suite.T()), suite.m365UserID),
category, category,
&recorder) &recorder)
err := cmd.ExecuteContext(ctx) err := cmd.ExecuteContext(ctx)
@ -445,7 +449,7 @@ type PreparedBackupExchangeE2ESuite struct {
func TestPreparedBackupExchangeE2ESuite(t *testing.T) { func TestPreparedBackupExchangeE2ESuite(t *testing.T) {
suite.Run(t, &PreparedBackupExchangeE2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &PreparedBackupExchangeE2ESuite{Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -463,7 +467,7 @@ func (suite *PreparedBackupExchangeE2ESuite) SetupSuite() {
suite.vpr = vpr suite.vpr = vpr
suite.recorder = recorder suite.recorder = recorder
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365UserID = tester.M365UserID(t) suite.m365UserID = tconfig.M365UserID(t)
suite.backupOps = make(map[path.CategoryType]string) suite.backupOps = make(map[path.CategoryType]string)
var ( var (
@ -534,7 +538,7 @@ func runExchangeListCmdTest(suite *PreparedBackupExchangeE2ESuite, category path
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "exchange", "backup", "list", "exchange",
"--config-file", suite.cfgFP) "--config-file", suite.cfgFP)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -575,7 +579,7 @@ func runExchangeListSingleCmdTest(suite *PreparedBackupExchangeE2ESuite, categor
bID := suite.backupOps[category] bID := suite.backupOps[category]
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "exchange", "backup", "list", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--backup", string(bID)) "--backup", string(bID))
@ -602,7 +606,7 @@ func (suite *PreparedBackupExchangeE2ESuite) TestExchangeListCmd_badID() {
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "exchange", "backup", "list", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--backup", "smarfs") "--backup", "smarfs")
@ -644,7 +648,7 @@ func runExchangeDetailsCmdTest(suite *PreparedBackupExchangeE2ESuite, category p
require.NoError(t, errs.Failure(), clues.ToCore(errs.Failure())) require.NoError(t, errs.Failure(), clues.ToCore(errs.Failure()))
require.Empty(t, errs.Recovered()) require.Empty(t, errs.Recovered())
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "details", "exchange", "backup", "details", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(bID)) "--"+flags.BackupFN, string(bID))
@ -700,7 +704,7 @@ func TestBackupDeleteExchangeE2ESuite(t *testing.T) {
suite.Run(t, &BackupDeleteExchangeE2ESuite{ suite.Run(t, &BackupDeleteExchangeE2ESuite{
Suite: tester.NewE2ESuite( Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -719,7 +723,7 @@ func (suite *BackupDeleteExchangeE2ESuite) SetupSuite() {
suite.vpr = vpr suite.vpr = vpr
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
m365UserID := tester.M365UserID(t) m365UserID := tconfig.M365UserID(t)
users := []string{m365UserID} users := []string{m365UserID}
// some tests require an existing backup // some tests require an existing backup
@ -743,7 +747,7 @@ func (suite *BackupDeleteExchangeE2ESuite) TestExchangeBackupDeleteCmd() {
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "exchange", "backup", "delete", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOp.Results.BackupID)) "--"+flags.BackupFN, string(suite.backupOp.Results.BackupID))
@ -754,7 +758,7 @@ func (suite *BackupDeleteExchangeE2ESuite) TestExchangeBackupDeleteCmd() {
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
// a follow-up details call should fail, due to the backup ID being deleted // a follow-up details call should fail, due to the backup ID being deleted
cmd = tester.StubRootCmd( cmd = cliTD.StubRootCmd(
"backup", "details", "exchange", "backup", "details", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--backup", string(suite.backupOp.Results.BackupID)) "--backup", string(suite.backupOp.Results.BackupID))
@ -772,7 +776,7 @@ func (suite *BackupDeleteExchangeE2ESuite) TestExchangeBackupDeleteCmd_UnknownID
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "exchange", "backup", "delete", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, uuid.NewString()) "--"+flags.BackupFN, uuid.NewString())
@ -792,7 +796,7 @@ func buildExchangeBackupCmd(
configFile, user, category string, configFile, user, category string,
recorder *strings.Builder, recorder *strings.Builder,
) (*cobra.Command, context.Context) { ) (*cobra.Command, context.Context) {
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "exchange", "backup", "create", "exchange",
"--config-file", configFile, "--config-file", configFile,
"--"+flags.UserFN, user, "--"+flags.UserFN, user,

View File

@ -10,11 +10,12 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
"github.com/alcionai/corso/src/pkg/storage/testdata"
) )
func prepM365Test( func prepM365Test(
@ -29,8 +30,8 @@ func prepM365Test(
string, string,
) { ) {
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
st = tester.NewPrefixedS3Storage(t) st = testdata.NewPrefixedS3Storage(t)
recorder = strings.Builder{} recorder = strings.Builder{}
) )
@ -38,12 +39,12 @@ func prepM365Test(
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
force := map[string]string{ force := map[string]string{
tester.TestCfgAccountProvider: "M365", tconfig.TestCfgAccountProvider: "M365",
tester.TestCfgStorageProvider: "S3", tconfig.TestCfgStorageProvider: "S3",
tester.TestCfgPrefix: cfg.Prefix, tconfig.TestCfgPrefix: cfg.Prefix,
} }
vpr, cfgFP := tester.MakeTempTestConfigClone(t, force) vpr, cfgFP := tconfig.MakeTempTestConfigClone(t, force)
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
repo, err := repository.Initialize(ctx, acct, st, control.Defaults()) repo, err := repository.Initialize(ctx, acct, st, control.Defaults())

View File

@ -16,14 +16,17 @@ import (
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
"github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/cli/print"
cliTD "github.com/alcionai/corso/src/cli/testdata"
"github.com/alcionai/corso/src/internal/common/idname" "github.com/alcionai/corso/src/internal/common/idname"
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
selTD "github.com/alcionai/corso/src/pkg/selectors/testdata" selTD "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -45,7 +48,7 @@ func TestNoBackupOneDriveE2ESuite(t *testing.T) {
suite.Run(t, &NoBackupOneDriveE2ESuite{ suite.Run(t, &NoBackupOneDriveE2ESuite{
Suite: tester.NewE2ESuite( Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -63,7 +66,7 @@ func (suite *NoBackupOneDriveE2ESuite) SetupSuite() {
suite.recorder = recorder suite.recorder = recorder
suite.vpr = vpr suite.vpr = vpr
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365UserID = tester.M365UserID(t) suite.m365UserID = tconfig.M365UserID(t)
} }
func (suite *NoBackupOneDriveE2ESuite) TestOneDriveBackupListCmd_empty() { func (suite *NoBackupOneDriveE2ESuite) TestOneDriveBackupListCmd_empty() {
@ -76,7 +79,7 @@ func (suite *NoBackupOneDriveE2ESuite) TestOneDriveBackupListCmd_empty() {
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "onedrive", "backup", "list", "onedrive",
"--config-file", suite.cfgFP) "--config-file", suite.cfgFP)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -105,7 +108,7 @@ func (suite *NoBackupOneDriveE2ESuite) TestOneDriveBackupCmd_UserNotInTenant() {
ctx = config.SetViper(ctx, suite.vpr) ctx = config.SetViper(ctx, suite.vpr)
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "create", "onedrive", "backup", "create", "onedrive",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.UserFN, "foo@nothere.com") "--"+flags.UserFN, "foo@nothere.com")
@ -149,7 +152,7 @@ func TestBackupDeleteOneDriveE2ESuite(t *testing.T) {
suite.Run(t, &BackupDeleteOneDriveE2ESuite{ suite.Run(t, &BackupDeleteOneDriveE2ESuite{
Suite: tester.NewE2ESuite( Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -169,7 +172,7 @@ func (suite *BackupDeleteOneDriveE2ESuite) SetupSuite() {
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
var ( var (
m365UserID = tester.M365UserID(t) m365UserID = tconfig.M365UserID(t)
users = []string{m365UserID} users = []string{m365UserID}
ins = idname.NewCache(map[string]string{m365UserID: m365UserID}) ins = idname.NewCache(map[string]string{m365UserID: m365UserID})
) )
@ -197,7 +200,7 @@ func (suite *BackupDeleteOneDriveE2ESuite) TestOneDriveBackupDeleteCmd() {
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "onedrive", "backup", "delete", "onedrive",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOp.Results.BackupID)) "--"+flags.BackupFN, string(suite.backupOp.Results.BackupID))
@ -219,7 +222,7 @@ func (suite *BackupDeleteOneDriveE2ESuite) TestOneDriveBackupDeleteCmd() {
) )
// a follow-up details call should fail, due to the backup ID being deleted // a follow-up details call should fail, due to the backup ID being deleted
cmd = tester.StubRootCmd( cmd = cliTD.StubRootCmd(
"backup", "details", "onedrive", "backup", "details", "onedrive",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--backup", string(suite.backupOp.Results.BackupID)) "--backup", string(suite.backupOp.Results.BackupID))
@ -237,7 +240,7 @@ func (suite *BackupDeleteOneDriveE2ESuite) TestOneDriveBackupDeleteCmd_unknownID
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "onedrive", "backup", "delete", "onedrive",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, uuid.NewString()) "--"+flags.BackupFN, uuid.NewString())

View File

@ -16,14 +16,17 @@ import (
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
"github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/cli/print"
cliTD "github.com/alcionai/corso/src/cli/testdata"
"github.com/alcionai/corso/src/internal/common/idname" "github.com/alcionai/corso/src/internal/common/idname"
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/selectors/testdata" "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -44,7 +47,7 @@ type NoBackupSharePointE2ESuite struct {
func TestNoBackupSharePointE2ESuite(t *testing.T) { func TestNoBackupSharePointE2ESuite(t *testing.T) {
suite.Run(t, &NoBackupSharePointE2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &NoBackupSharePointE2ESuite{Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -62,7 +65,7 @@ func (suite *NoBackupSharePointE2ESuite) SetupSuite() {
suite.vpr = vpr suite.vpr = vpr
suite.recorder = recorder suite.recorder = recorder
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
suite.m365SiteID = tester.M365SiteID(t) suite.m365SiteID = tconfig.M365SiteID(t)
} }
func (suite *NoBackupSharePointE2ESuite) TestSharePointBackupListCmd_empty() { func (suite *NoBackupSharePointE2ESuite) TestSharePointBackupListCmd_empty() {
@ -75,7 +78,7 @@ func (suite *NoBackupSharePointE2ESuite) TestSharePointBackupListCmd_empty() {
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "list", "sharepoint", "backup", "list", "sharepoint",
"--config-file", suite.cfgFP) "--config-file", suite.cfgFP)
cli.BuildCommandTree(cmd) cli.BuildCommandTree(cmd)
@ -113,7 +116,7 @@ func TestBackupDeleteSharePointE2ESuite(t *testing.T) {
suite.Run(t, &BackupDeleteSharePointE2ESuite{ suite.Run(t, &BackupDeleteSharePointE2ESuite{
Suite: tester.NewE2ESuite( Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -133,7 +136,7 @@ func (suite *BackupDeleteSharePointE2ESuite) SetupSuite() {
suite.cfgFP = cfgFilePath suite.cfgFP = cfgFilePath
var ( var (
m365SiteID = tester.M365SiteID(t) m365SiteID = tconfig.M365SiteID(t)
sites = []string{m365SiteID} sites = []string{m365SiteID}
ins = idname.NewCache(map[string]string{m365SiteID: m365SiteID}) ins = idname.NewCache(map[string]string{m365SiteID: m365SiteID})
) )
@ -161,7 +164,7 @@ func (suite *BackupDeleteSharePointE2ESuite) TestSharePointBackupDeleteCmd() {
suite.recorder.Reset() suite.recorder.Reset()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "sharepoint", "backup", "delete", "sharepoint",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOp.Results.BackupID)) "--"+flags.BackupFN, string(suite.backupOp.Results.BackupID))
@ -185,7 +188,7 @@ func (suite *BackupDeleteSharePointE2ESuite) TestSharePointBackupDeleteCmd() {
// moved out of the func above to make the linter happy // moved out of the func above to make the linter happy
// // a follow-up details call should fail, due to the backup ID being deleted // // a follow-up details call should fail, due to the backup ID being deleted
// cmd = tester.StubRootCmd( // cmd = cliTD.StubRootCmd(
// "backup", "details", "sharepoint", // "backup", "details", "sharepoint",
// "--config-file", suite.cfgFP, // "--config-file", suite.cfgFP,
// "--backup", string(suite.backupOp.Results.BackupID)) // "--backup", string(suite.backupOp.Results.BackupID))
@ -202,7 +205,7 @@ func (suite *BackupDeleteSharePointE2ESuite) TestSharePointBackupDeleteCmd_unkno
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"backup", "delete", "sharepoint", "backup", "delete", "sharepoint",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, uuid.NewString()) "--"+flags.BackupFN, uuid.NewString())

View File

@ -16,9 +16,11 @@ import (
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
"github.com/alcionai/corso/src/internal/common/str" "github.com/alcionai/corso/src/internal/common/str"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/credentials" "github.com/alcionai/corso/src/pkg/credentials"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
const ( const (
@ -351,7 +353,7 @@ type ConfigIntegrationSuite struct {
func TestConfigIntegrationSuite(t *testing.T) { func TestConfigIntegrationSuite(t *testing.T) {
suite.Run(t, &ConfigIntegrationSuite{Suite: tester.NewIntegrationSuite( suite.Run(t, &ConfigIntegrationSuite{Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -387,23 +389,23 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() {
err = vpr.ReadInConfig() err = vpr.ReadInConfig()
require.NoError(t, err, "reading repo config", clues.ToCore(err)) require.NoError(t, err, "reading repo config", clues.ToCore(err))
config, err := getStorageAndAccountWithViper(vpr, true, true, nil) cfg, err := getStorageAndAccountWithViper(vpr, true, true, nil)
require.NoError(t, err, "getting storage and account from config", clues.ToCore(err)) require.NoError(t, err, "getting storage and account from config", clues.ToCore(err))
readS3Cfg, err := config.Storage.S3Config() readS3Cfg, err := cfg.Storage.S3Config()
require.NoError(t, err, "reading s3 config from storage", clues.ToCore(err)) require.NoError(t, err, "reading s3 config from storage", clues.ToCore(err))
assert.Equal(t, readS3Cfg.Bucket, s3Cfg.Bucket) assert.Equal(t, readS3Cfg.Bucket, s3Cfg.Bucket)
assert.Equal(t, readS3Cfg.Endpoint, s3Cfg.Endpoint) assert.Equal(t, readS3Cfg.Endpoint, s3Cfg.Endpoint)
assert.Equal(t, readS3Cfg.Prefix, s3Cfg.Prefix) assert.Equal(t, readS3Cfg.Prefix, s3Cfg.Prefix)
assert.Equal(t, readS3Cfg.DoNotUseTLS, s3Cfg.DoNotUseTLS) assert.Equal(t, readS3Cfg.DoNotUseTLS, s3Cfg.DoNotUseTLS)
assert.Equal(t, readS3Cfg.DoNotVerifyTLS, s3Cfg.DoNotVerifyTLS) assert.Equal(t, readS3Cfg.DoNotVerifyTLS, s3Cfg.DoNotVerifyTLS)
assert.Equal(t, config.RepoID, "repoid") assert.Equal(t, cfg.RepoID, "repoid")
common, err := config.Storage.CommonConfig() common, err := cfg.Storage.CommonConfig()
require.NoError(t, err, "reading common config from storage", clues.ToCore(err)) require.NoError(t, err, "reading common config from storage", clues.ToCore(err))
assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase)) assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase))
readM365, err := config.Account.M365Config() readM365, err := cfg.Account.M365Config()
require.NoError(t, err, "reading m365 config from account", clues.ToCore(err)) require.NoError(t, err, "reading m365 config from account", clues.ToCore(err))
// Env var gets preference here. Where to get env tenantID from // Env var gets preference here. Where to get env tenantID from
// assert.Equal(t, readM365.AzureTenantID, m365.AzureTenantID) // assert.Equal(t, readM365.AzureTenantID, m365.AzureTenantID)
@ -435,23 +437,23 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount_noFileOnlyOverride
StorageProviderTypeKey: storage.ProviderS3.String(), StorageProviderTypeKey: storage.ProviderS3.String(),
} }
config, err := getStorageAndAccountWithViper(vpr, false, false, overrides) cfg, err := getStorageAndAccountWithViper(vpr, false, false, overrides)
require.NoError(t, err, "getting storage and account from config", clues.ToCore(err)) require.NoError(t, err, "getting storage and account from config", clues.ToCore(err))
readS3Cfg, err := config.Storage.S3Config() readS3Cfg, err := cfg.Storage.S3Config()
require.NoError(t, err, "reading s3 config from storage", clues.ToCore(err)) require.NoError(t, err, "reading s3 config from storage", clues.ToCore(err))
assert.Equal(t, readS3Cfg.Bucket, bkt) assert.Equal(t, readS3Cfg.Bucket, bkt)
assert.Equal(t, config.RepoID, "") assert.Equal(t, cfg.RepoID, "")
assert.Equal(t, readS3Cfg.Endpoint, end) assert.Equal(t, readS3Cfg.Endpoint, end)
assert.Equal(t, readS3Cfg.Prefix, pfx) assert.Equal(t, readS3Cfg.Prefix, pfx)
assert.True(t, readS3Cfg.DoNotUseTLS) assert.True(t, readS3Cfg.DoNotUseTLS)
assert.True(t, readS3Cfg.DoNotVerifyTLS) assert.True(t, readS3Cfg.DoNotVerifyTLS)
common, err := config.Storage.CommonConfig() common, err := cfg.Storage.CommonConfig()
require.NoError(t, err, "reading common config from storage", clues.ToCore(err)) require.NoError(t, err, "reading common config from storage", clues.ToCore(err))
assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase)) assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase))
readM365, err := config.Account.M365Config() readM365, err := cfg.Account.M365Config()
require.NoError(t, err, "reading m365 config from account", clues.ToCore(err)) require.NoError(t, err, "reading m365 config from account", clues.ToCore(err))
assert.Equal(t, readM365.AzureTenantID, m365.AzureTenantID) assert.Equal(t, readM365.AzureTenantID, m365.AzureTenantID)
assert.Equal(t, readM365.AzureClientID, os.Getenv(credentials.AzureClientID)) assert.Equal(t, readM365.AzureClientID, os.Getenv(credentials.AzureClientID))

View File

@ -11,10 +11,13 @@ import (
"github.com/alcionai/corso/src/cli" "github.com/alcionai/corso/src/cli"
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
cliTD "github.com/alcionai/corso/src/cli/testdata"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type S3E2ESuite struct { type S3E2ESuite struct {
@ -24,7 +27,7 @@ type S3E2ESuite struct {
func TestS3E2ESuite(t *testing.T) { func TestS3E2ESuite(t *testing.T) {
suite.Run(t, &S3E2ESuite{Suite: tester.NewE2ESuite( suite.Run(t, &S3E2ESuite{Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
)}) )})
} }
@ -58,11 +61,11 @@ func (suite *S3E2ESuite) TestInitS3Cmd() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
vpr, configFP := tester.MakeTempTestConfigClone(t, nil) vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil)
if !test.hasConfigFile { if !test.hasConfigFile {
// Ideally we could use `/dev/null`, but you need a // Ideally we could use `/dev/null`, but you need a
// toml file plus this works cross platform // toml file plus this works cross platform
@ -71,7 +74,7 @@ func (suite *S3E2ESuite) TestInitS3Cmd() {
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "init", "s3", "repo", "init", "s3",
"--config-file", configFP, "--config-file", configFP,
"--bucket", test.bucketPrefix+cfg.Bucket, "--bucket", test.bucketPrefix+cfg.Bucket,
@ -95,16 +98,16 @@ func (suite *S3E2ESuite) TestInitMultipleTimes() {
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
vpr, configFP := tester.MakeTempTestConfigClone(t, nil) vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil)
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "init", "s3", "repo", "init", "s3",
"--config-file", configFP, "--config-file", configFP,
"--bucket", cfg.Bucket, "--bucket", cfg.Bucket,
@ -125,15 +128,15 @@ func (suite *S3E2ESuite) TestInitS3Cmd_missingBucket() {
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
vpr, configFP := tester.MakeTempTestConfigClone(t, nil) vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil)
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "init", "s3", "repo", "init", "s3",
"--config-file", configFP, "--config-file", configFP,
"--prefix", cfg.Prefix) "--prefix", cfg.Prefix)
@ -174,16 +177,16 @@ func (suite *S3E2ESuite) TestConnectS3Cmd() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
force := map[string]string{ force := map[string]string{
tester.TestCfgAccountProvider: "M365", tconfig.TestCfgAccountProvider: "M365",
tester.TestCfgStorageProvider: "S3", tconfig.TestCfgStorageProvider: "S3",
tester.TestCfgPrefix: cfg.Prefix, tconfig.TestCfgPrefix: cfg.Prefix,
} }
vpr, configFP := tester.MakeTempTestConfigClone(t, force) vpr, configFP := tconfig.MakeTempTestConfigClone(t, force)
if !test.hasConfigFile { if !test.hasConfigFile {
// Ideally we could use `/dev/null`, but you need a // Ideally we could use `/dev/null`, but you need a
// toml file plus this works cross platform // toml file plus this works cross platform
@ -197,7 +200,7 @@ func (suite *S3E2ESuite) TestConnectS3Cmd() {
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
// then test it // then test it
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "connect", "s3", "repo", "connect", "s3",
"--config-file", configFP, "--config-file", configFP,
"--bucket", test.bucketPrefix+cfg.Bucket, "--bucket", test.bucketPrefix+cfg.Bucket,
@ -218,15 +221,15 @@ func (suite *S3E2ESuite) TestConnectS3Cmd_BadBucket() {
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
vpr, configFP := tester.MakeTempTestConfigClone(t, nil) vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil)
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "connect", "s3", "repo", "connect", "s3",
"--config-file", configFP, "--config-file", configFP,
"--bucket", "wrong", "--bucket", "wrong",
@ -244,15 +247,15 @@ func (suite *S3E2ESuite) TestConnectS3Cmd_BadPrefix() {
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
cfg, err := st.S3Config() cfg, err := st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
vpr, configFP := tester.MakeTempTestConfigClone(t, nil) vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil)
ctx = config.SetViper(ctx, vpr) ctx = config.SetViper(ctx, vpr)
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"repo", "connect", "s3", "repo", "connect", "s3",
"--config-file", configFP, "--config-file", configFP,
"--bucket", cfg.Bucket, "--bucket", cfg.Bucket,

View File

@ -13,16 +13,19 @@ import (
"github.com/alcionai/corso/src/cli" "github.com/alcionai/corso/src/cli"
"github.com/alcionai/corso/src/cli/config" "github.com/alcionai/corso/src/cli/config"
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
cliTD "github.com/alcionai/corso/src/cli/testdata"
"github.com/alcionai/corso/src/internal/common/idname" "github.com/alcionai/corso/src/internal/common/idname"
"github.com/alcionai/corso/src/internal/m365/exchange" "github.com/alcionai/corso/src/internal/m365/exchange"
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
var ( var (
@ -48,7 +51,7 @@ func TestRestoreExchangeE2ESuite(t *testing.T) {
suite.Run(t, &RestoreExchangeE2ESuite{ suite.Run(t, &RestoreExchangeE2ESuite{
Suite: tester.NewE2ESuite( Suite: tester.NewE2ESuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -59,20 +62,20 @@ func (suite *RestoreExchangeE2ESuite) SetupSuite() {
defer flush() defer flush()
// aggregate required details // aggregate required details
suite.acct = tester.NewM365Account(t) suite.acct = tconfig.NewM365Account(t)
suite.st = tester.NewPrefixedS3Storage(t) suite.st = storeTD.NewPrefixedS3Storage(t)
cfg, err := suite.st.S3Config() cfg, err := suite.st.S3Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
force := map[string]string{ force := map[string]string{
tester.TestCfgAccountProvider: "M365", tconfig.TestCfgAccountProvider: "M365",
tester.TestCfgStorageProvider: "S3", tconfig.TestCfgStorageProvider: "S3",
tester.TestCfgPrefix: cfg.Prefix, tconfig.TestCfgPrefix: cfg.Prefix,
} }
suite.vpr, suite.cfgFP = tester.MakeTempTestConfigClone(t, force) suite.vpr, suite.cfgFP = tconfig.MakeTempTestConfigClone(t, force)
suite.m365UserID = strings.ToLower(tester.M365UserID(t)) suite.m365UserID = strings.ToLower(tconfig.M365UserID(t))
var ( var (
users = []string{suite.m365UserID} users = []string{suite.m365UserID}
@ -132,7 +135,7 @@ func (suite *RestoreExchangeE2ESuite) TestExchangeRestoreCmd() {
defer flush() defer flush()
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"restore", "exchange", "restore", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID)) "--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID))
@ -167,7 +170,7 @@ func (suite *RestoreExchangeE2ESuite) TestExchangeRestoreCmd_badTimeFlags() {
timeFilter = "--" + flags.EventStartsAfterFN timeFilter = "--" + flags.EventStartsAfterFN
} }
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"restore", "exchange", "restore", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID), "--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID),
@ -201,7 +204,7 @@ func (suite *RestoreExchangeE2ESuite) TestExchangeRestoreCmd_badBoolFlags() {
timeFilter = "--" + flags.EventRecursFN timeFilter = "--" + flags.EventRecursFN
} }
cmd := tester.StubRootCmd( cmd := cliTD.StubRootCmd(
"restore", "exchange", "restore", "exchange",
"--config-file", suite.cfgFP, "--config-file", suite.cfgFP,
"--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID), "--"+flags.BackupFN, string(suite.backupOps[set].Results.BackupID),

View File

@ -1,4 +1,4 @@
package tester package testdata
import ( import (
"fmt" "fmt"

View File

@ -18,7 +18,7 @@ import (
"github.com/alcionai/corso/src/internal/common/dttm" "github.com/alcionai/corso/src/internal/common/dttm"
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/filters" "github.com/alcionai/corso/src/pkg/filters"
"github.com/alcionai/corso/src/pkg/logger" "github.com/alcionai/corso/src/pkg/logger"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
@ -56,7 +56,7 @@ func main() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
adapter, err := graph.CreateAdapter( adapter, err := graph.CreateAdapter(
tester.GetM365TenantID(ctx), tconfig.GetM365TenantID(ctx),
os.Getenv("AZURE_CLIENT_ID"), os.Getenv("AZURE_CLIENT_ID"),
os.Getenv("AZURE_CLIENT_SECRET")) os.Getenv("AZURE_CLIENT_SECRET"))
if err != nil { if err != nil {
@ -65,8 +65,8 @@ func main() {
var ( var (
client = msgraphsdk.NewGraphServiceClient(adapter) client = msgraphsdk.NewGraphServiceClient(adapter)
testUser = tester.GetM365UserID(ctx) testUser = tconfig.GetM365UserID(ctx)
testSite = tester.GetM365SiteID(ctx) testSite = tconfig.GetM365SiteID(ctx)
testService = os.Getenv("SANITY_RESTORE_SERVICE") testService = os.Getenv("SANITY_RESTORE_SERVICE")
folder = strings.TrimSpace(os.Getenv("SANITY_RESTORE_FOLDER")) folder = strings.TrimSpace(os.Getenv("SANITY_RESTORE_FOLDER"))
startTime, _ = mustGetTimeFromName(ctx, folder) startTime, _ = mustGetTimeFromName(ctx, folder)

View File

@ -16,13 +16,14 @@ import (
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/control/repository" "github.com/alcionai/corso/src/pkg/control/repository"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
func openKopiaRepo( func openKopiaRepo(
t *testing.T, t *testing.T,
ctx context.Context, //revive:disable-line:context-as-argument ctx context.Context, //revive:disable-line:context-as-argument
) (*conn, error) { ) (*conn, error) {
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
k := NewConn(st) k := NewConn(st)
if err := k.Initialize(ctx, repository.Options{}); err != nil { if err := k.Initialize(ctx, repository.Options{}); err != nil {
@ -67,7 +68,7 @@ func TestWrapperIntegrationSuite(t *testing.T) {
suite.Run(t, &WrapperIntegrationSuite{ suite.Run(t, &WrapperIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }
@ -78,7 +79,7 @@ func (suite *WrapperIntegrationSuite) TestRepoExistsError() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
k := NewConn(st) k := NewConn(st)
err := k.Initialize(ctx, repository.Options{}) err := k.Initialize(ctx, repository.Options{})
@ -98,7 +99,7 @@ func (suite *WrapperIntegrationSuite) TestBadProviderErrors() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
st.Provider = storage.ProviderUnknown st.Provider = storage.ProviderUnknown
k := NewConn(st) k := NewConn(st)
@ -112,7 +113,7 @@ func (suite *WrapperIntegrationSuite) TestConnectWithoutInitErrors() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
k := NewConn(st) k := NewConn(st)
err := k.Connect(ctx, repository.Options{}) err := k.Connect(ctx, repository.Options{})
@ -409,7 +410,7 @@ func (suite *WrapperIntegrationSuite) TestSetUserAndHost() {
Host: "bar", Host: "bar",
} }
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
k := NewConn(st) k := NewConn(st)
err := k.Initialize(ctx, opts) err := k.Initialize(ctx, opts)

View File

@ -18,6 +18,7 @@ import (
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/control/repository" "github.com/alcionai/corso/src/pkg/control/repository"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type fooModel struct { type fooModel struct {
@ -70,7 +71,7 @@ func TestModelStoreIntegrationSuite(t *testing.T) {
suite.Run(t, &ModelStoreIntegrationSuite{ suite.Run(t, &ModelStoreIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }
@ -731,7 +732,7 @@ func TestModelStoreRegressionSuite(t *testing.T) {
suite.Run(t, &ModelStoreRegressionSuite{ suite.Run(t, &ModelStoreRegressionSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }
@ -804,7 +805,7 @@ func openConnAndModelStore(
t *testing.T, t *testing.T,
ctx context.Context, //revive:disable-line:context-as-argument ctx context.Context, //revive:disable-line:context-as-argument
) (*conn, *ModelStore) { ) (*conn, *ModelStore) {
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
c := NewConn(st) c := NewConn(st)
err := c.Initialize(ctx, repository.Options{}) err := c.Initialize(ctx, repository.Options{})

View File

@ -29,6 +29,7 @@ import (
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/logger" "github.com/alcionai/corso/src/pkg/logger"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
const ( const (
@ -167,7 +168,7 @@ func TestBasicKopiaIntegrationSuite(t *testing.T) {
suite.Run(t, &BasicKopiaIntegrationSuite{ suite.Run(t, &BasicKopiaIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }
@ -295,7 +296,7 @@ func TestKopiaIntegrationSuite(t *testing.T) {
suite.Run(t, &KopiaIntegrationSuite{ suite.Run(t, &KopiaIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }
@ -930,7 +931,7 @@ func TestKopiaSimpleRepoIntegrationSuite(t *testing.T) {
suite.Run(t, &KopiaSimpleRepoIntegrationSuite{ suite.Run(t, &KopiaSimpleRepoIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs},
), ),
}) })
} }

View File

@ -15,6 +15,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/resource" "github.com/alcionai/corso/src/internal/m365/resource"
"github.com/alcionai/corso/src/internal/m365/sharepoint" "github.com/alcionai/corso/src/internal/m365/sharepoint"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -40,17 +41,17 @@ func TestDataCollectionIntgSuite(t *testing.T) {
suite.Run(t, &DataCollectionIntgSuite{ suite.Run(t, &DataCollectionIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
func (suite *DataCollectionIntgSuite) SetupSuite() { func (suite *DataCollectionIntgSuite) SetupSuite() {
t := suite.T() t := suite.T()
suite.user = tester.M365UserID(t) suite.user = tconfig.M365UserID(t)
suite.site = tester.M365SiteID(t) suite.site = tconfig.M365SiteID(t)
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
creds, err := acct.M365Config() creds, err := acct.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -339,7 +340,7 @@ func TestSPCollectionIntgSuite(t *testing.T) {
suite.Run(t, &SPCollectionIntgSuite{ suite.Run(t, &SPCollectionIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -349,7 +350,7 @@ func (suite *SPCollectionIntgSuite) SetupSuite() {
defer flush() defer flush()
suite.connector = newController(ctx, suite.T(), resource.Sites, path.SharePointService) suite.connector = newController(ctx, suite.T(), resource.Sites, path.SharePointService)
suite.user = tester.M365UserID(suite.T()) suite.user = tconfig.M365UserID(suite.T())
tester.LogTimeOfTest(suite.T()) tester.LogTimeOfTest(suite.T())
} }
@ -361,7 +362,7 @@ func (suite *SPCollectionIntgSuite) TestCreateSharePointCollection_Libraries() {
defer flush() defer flush()
var ( var (
siteID = tester.M365SiteID(t) siteID = tconfig.M365SiteID(t)
ctrl = newController(ctx, t, resource.Sites, path.SharePointService) ctrl = newController(ctx, t, resource.Sites, path.SharePointService)
siteIDs = []string{siteID} siteIDs = []string{siteID}
) )
@ -408,7 +409,7 @@ func (suite *SPCollectionIntgSuite) TestCreateSharePointCollection_Lists() {
defer flush() defer flush()
var ( var (
siteID = tester.M365SiteID(t) siteID = tconfig.M365SiteID(t)
ctrl = newController(ctx, t, resource.Sites, path.SharePointService) ctrl = newController(ctx, t, resource.Sites, path.SharePointService)
siteIDs = []string{siteID} siteIDs = []string{siteID}
) )

View File

@ -20,6 +20,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/stub" "github.com/alcionai/corso/src/internal/m365/stub"
"github.com/alcionai/corso/src/internal/m365/support" "github.com/alcionai/corso/src/internal/m365/support"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
@ -272,7 +273,7 @@ func TestControllerIntegrationSuite(t *testing.T) {
suite.Run(t, &ControllerIntegrationSuite{ suite.Run(t, &ControllerIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -284,8 +285,8 @@ func (suite *ControllerIntegrationSuite) SetupSuite() {
defer flush() defer flush()
suite.ctrl = newController(ctx, t, resource.Users, path.ExchangeService) suite.ctrl = newController(ctx, t, resource.Users, path.ExchangeService)
suite.user = tester.M365UserID(t) suite.user = tconfig.M365UserID(t)
suite.secondaryUser = tester.SecondaryM365UserID(t) suite.secondaryUser = tconfig.SecondaryM365UserID(t)
tester.LogTimeOfTest(t) tester.LogTimeOfTest(t)
} }
@ -410,26 +411,26 @@ func (suite *ControllerIntegrationSuite) TestEmptyCollections() {
func runRestore( func runRestore(
t *testing.T, t *testing.T,
ctx context.Context, //revive:disable-line:context-as-argument ctx context.Context, //revive:disable-line:context-as-argument
config stub.ConfigInfo, sci stub.ConfigInfo,
backupVersion int, backupVersion int,
collections []data.RestoreCollection, collections []data.RestoreCollection,
numRestoreItems int, numRestoreItems int,
) { ) {
t.Logf( t.Logf(
"Restoring collections to %s for resourceOwners(s) %v\n", "Restoring collections to %s for resourceOwners(s) %v\n",
config.RestoreCfg.Location, sci.RestoreCfg.Location,
config.ResourceOwners) sci.ResourceOwners)
start := time.Now() start := time.Now()
restoreCtrl := newController(ctx, t, config.Resource, path.ExchangeService) restoreCtrl := newController(ctx, t, sci.Resource, path.ExchangeService)
restoreSel := getSelectorWith(t, config.Service, config.ResourceOwners, true) restoreSel := getSelectorWith(t, sci.Service, sci.ResourceOwners, true)
deets, err := restoreCtrl.ConsumeRestoreCollections( deets, err := restoreCtrl.ConsumeRestoreCollections(
ctx, ctx,
backupVersion, backupVersion,
restoreSel, restoreSel,
config.RestoreCfg, sci.RestoreCfg,
config.Opts, sci.Opts,
collections, collections,
fault.New(true)) fault.New(true))
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -453,7 +454,7 @@ func runRestore(
func runBackupAndCompare( func runBackupAndCompare(
t *testing.T, t *testing.T,
ctx context.Context, //revive:disable-line:context-as-argument ctx context.Context, //revive:disable-line:context-as-argument
config stub.ConfigInfo, sci stub.ConfigInfo,
expectedData map[string]map[string][]byte, expectedData map[string]map[string][]byte,
totalItems int, totalItems int,
totalKopiaItems int, totalKopiaItems int,
@ -468,15 +469,15 @@ func runBackupAndCompare(
} }
var ( var (
expectedDests = make([]destAndCats, 0, len(config.ResourceOwners)) expectedDests = make([]destAndCats, 0, len(sci.ResourceOwners))
idToName = map[string]string{} idToName = map[string]string{}
nameToID = map[string]string{} nameToID = map[string]string{}
) )
for _, ro := range config.ResourceOwners { for _, ro := range sci.ResourceOwners {
expectedDests = append(expectedDests, destAndCats{ expectedDests = append(expectedDests, destAndCats{
resourceOwner: ro, resourceOwner: ro,
dest: config.RestoreCfg.Location, dest: sci.RestoreCfg.Location,
cats: cats, cats: cats,
}) })
@ -484,10 +485,10 @@ func runBackupAndCompare(
nameToID[ro] = ro nameToID[ro] = ro
} }
backupCtrl := newController(ctx, t, config.Resource, path.ExchangeService) backupCtrl := newController(ctx, t, sci.Resource, path.ExchangeService)
backupCtrl.IDNameLookup = inMock.NewCache(idToName, nameToID) backupCtrl.IDNameLookup = inMock.NewCache(idToName, nameToID)
backupSel := backupSelectorForExpected(t, config.Service, expectedDests) backupSel := backupSelectorForExpected(t, sci.Service, expectedDests)
t.Logf("Selective backup of %s\n", backupSel) t.Logf("Selective backup of %s\n", backupSel)
start := time.Now() start := time.Now()
@ -497,7 +498,7 @@ func runBackupAndCompare(
backupSel, backupSel,
nil, nil,
version.NoBackup, version.NoBackup,
config.Opts, sci.Opts,
fault.New(true)) fault.New(true))
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
assert.True(t, canUsePreviousBackup, "can use previous backup") assert.True(t, canUsePreviousBackup, "can use previous backup")
@ -514,7 +515,7 @@ func runBackupAndCompare(
totalKopiaItems, totalKopiaItems,
expectedData, expectedData,
dcs, dcs,
config) sci)
status := backupCtrl.Wait() status := backupCtrl.Wait()
@ -534,7 +535,7 @@ func runRestoreBackupTest(
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
config := stub.ConfigInfo{ cfg := stub.ConfigInfo{
Opts: opts, Opts: opts,
Resource: test.resourceCat, Resource: test.resourceCat,
Service: test.service, Service: test.service,
@ -544,7 +545,7 @@ func runRestoreBackupTest(
} }
totalItems, totalKopiaItems, collections, expectedData, err := stub.GetCollectionsAndExpected( totalItems, totalKopiaItems, collections, expectedData, err := stub.GetCollectionsAndExpected(
config, cfg,
test.collections, test.collections,
version.Backup) version.Backup)
@ -553,7 +554,7 @@ func runRestoreBackupTest(
runRestore( runRestore(
t, t,
ctx, ctx,
config, cfg,
version.Backup, version.Backup,
collections, collections,
totalItems) totalItems)
@ -561,7 +562,7 @@ func runRestoreBackupTest(
runBackupAndCompare( runBackupAndCompare(
t, t,
ctx, ctx,
config, cfg,
expectedData, expectedData,
totalItems, totalItems,
totalKopiaItems, totalKopiaItems,
@ -579,7 +580,7 @@ func runRestoreTestWithVersion(
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
config := stub.ConfigInfo{ cfg := stub.ConfigInfo{
Opts: opts, Opts: opts,
Resource: test.resourceCat, Resource: test.resourceCat,
Service: test.service, Service: test.service,
@ -589,7 +590,7 @@ func runRestoreTestWithVersion(
} }
totalItems, _, collections, _, err := stub.GetCollectionsAndExpected( totalItems, _, collections, _, err := stub.GetCollectionsAndExpected(
config, cfg,
test.collectionsPrevious, test.collectionsPrevious,
test.backupVersion) test.backupVersion)
require.NoError(t, err) require.NoError(t, err)
@ -597,7 +598,7 @@ func runRestoreTestWithVersion(
runRestore( runRestore(
t, t,
ctx, ctx,
config, cfg,
test.backupVersion, test.backupVersion,
collections, collections,
totalItems) totalItems)
@ -616,7 +617,7 @@ func runRestoreBackupTestVersions(
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
config := stub.ConfigInfo{ cfg := stub.ConfigInfo{
Opts: opts, Opts: opts,
Resource: test.resourceCat, Resource: test.resourceCat,
Service: test.service, Service: test.service,
@ -626,7 +627,7 @@ func runRestoreBackupTestVersions(
} }
totalItems, _, collections, _, err := stub.GetCollectionsAndExpected( totalItems, _, collections, _, err := stub.GetCollectionsAndExpected(
config, cfg,
test.collectionsPrevious, test.collectionsPrevious,
test.backupVersion) test.backupVersion)
require.NoError(t, err) require.NoError(t, err)
@ -634,14 +635,14 @@ func runRestoreBackupTestVersions(
runRestore( runRestore(
t, t,
ctx, ctx,
config, cfg,
test.backupVersion, test.backupVersion,
collections, collections,
totalItems) totalItems)
// Get expected output for new version. // Get expected output for new version.
totalItems, totalKopiaItems, _, expectedData, err := stub.GetCollectionsAndExpected( totalItems, totalKopiaItems, _, expectedData, err := stub.GetCollectionsAndExpected(
config, cfg,
test.collectionsLatest, test.collectionsLatest,
version.Backup) version.Backup)
require.NoError(t, err) require.NoError(t, err)
@ -649,7 +650,7 @@ func runRestoreBackupTestVersions(
runBackupAndCompare( runBackupAndCompare(
t, t,
ctx, ctx,
config, cfg,
expectedData, expectedData,
totalItems, totalItems,
totalKopiaItems, totalKopiaItems,
@ -1181,7 +1182,7 @@ func (suite *ControllerIntegrationSuite) TestBackup_CreatesPrefixCollections() {
name: "SharePoint", name: "SharePoint",
resourceCat: resource.Sites, resourceCat: resource.Sites,
selectorFunc: func(t *testing.T) selectors.Selector { selectorFunc: func(t *testing.T) selectors.Selector {
sel := selectors.NewSharePointBackup([]string{tester.M365SiteID(t)}) sel := selectors.NewSharePointBackup([]string{tconfig.M365SiteID(t)})
sel.Include( sel.Include(
sel.LibraryFolders([]string{selectors.NoneTgt}), sel.LibraryFolders([]string{selectors.NoneTgt}),
// not yet in use // not yet in use

View File

@ -17,6 +17,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/m365/support" "github.com/alcionai/corso/src/internal/m365/support"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -394,7 +395,7 @@ func TestBackupIntgSuite(t *testing.T) {
suite.Run(t, &BackupIntgSuite{ suite.Run(t, &BackupIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -406,10 +407,10 @@ func (suite *BackupIntgSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
suite.user = tester.M365UserID(t) suite.user = tconfig.M365UserID(t)
suite.site = tester.M365SiteID(t) suite.site = tconfig.M365SiteID(t)
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
creds, err := acct.M365Config() creds, err := acct.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -423,7 +424,7 @@ func (suite *BackupIntgSuite) SetupSuite() {
func (suite *BackupIntgSuite) TestMailFetch() { func (suite *BackupIntgSuite) TestMailFetch() {
var ( var (
userID = tester.M365UserID(suite.T()) userID = tconfig.M365UserID(suite.T())
users = []string{userID} users = []string{userID}
handlers = BackupHandlers(suite.ac) handlers = BackupHandlers(suite.ac)
) )
@ -507,7 +508,7 @@ func (suite *BackupIntgSuite) TestMailFetch() {
func (suite *BackupIntgSuite) TestDelta() { func (suite *BackupIntgSuite) TestDelta() {
var ( var (
userID = tester.M365UserID(suite.T()) userID = tconfig.M365UserID(suite.T())
users = []string{userID} users = []string{userID}
handlers = BackupHandlers(suite.ac) handlers = BackupHandlers(suite.ac)
) )
@ -878,7 +879,7 @@ func TestServiceIteratorsUnitSuite(t *testing.T) {
} }
func (suite *CollectionPopulationSuite) SetupSuite() { func (suite *CollectionPopulationSuite) SetupSuite() {
a := tester.NewMockM365Account(suite.T()) a := tconfig.NewFakeM365Account(suite.T())
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(suite.T(), err, clues.ToCore(err)) require.NoError(suite.T(), err, clues.ToCore(err))
suite.creds = m365 suite.creds = m365

View File

@ -13,6 +13,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/exchange/mock" "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -59,7 +60,7 @@ func TestContactsRestoreIntgSuite(t *testing.T) {
suite.Run(t, &ContactsRestoreIntgSuite{ suite.Run(t, &ContactsRestoreIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -15,6 +15,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
@ -682,14 +683,14 @@ func TestContainerResolverIntegrationSuite(t *testing.T) {
suite.Run(t, &ContainerResolverSuite{ suite.Run(t, &ContainerResolverSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
func (suite *ContainerResolverSuite) SetupSuite() { func (suite *ContainerResolverSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -702,7 +703,7 @@ func (suite *ContainerResolverSuite) TestPopulate() {
eventFunc := func(t *testing.T) graph.ContainerResolver { eventFunc := func(t *testing.T) graph.ContainerResolver {
return &eventContainerCache{ return &eventContainerCache{
userID: tester.M365UserID(t), userID: tconfig.M365UserID(t),
enumer: ac.Events(), enumer: ac.Events(),
getter: ac.Events(), getter: ac.Events(),
} }
@ -710,7 +711,7 @@ func (suite *ContainerResolverSuite) TestPopulate() {
contactFunc := func(t *testing.T) graph.ContainerResolver { contactFunc := func(t *testing.T) graph.ContainerResolver {
return &contactContainerCache{ return &contactContainerCache{
userID: tester.M365UserID(t), userID: tconfig.M365UserID(t),
enumer: ac.Contacts(), enumer: ac.Contacts(),
getter: ac.Contacts(), getter: ac.Contacts(),
} }

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/exchange/mock" "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -107,7 +108,7 @@ func TestEventsRestoreIntgSuite(t *testing.T) {
suite.Run(t, &EventsRestoreIntgSuite{ suite.Run(t, &EventsRestoreIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -23,7 +24,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
creds, err := a.M365Config() creds, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -32,7 +33,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
its.ac, err = api.NewClient(creds) its.ac, err = api.NewClient(creds)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
its.userID = tester.GetM365UserID(ctx) its.userID = tconfig.GetM365UserID(ctx)
return its return its
} }

View File

@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
@ -36,7 +37,7 @@ func TestMailFolderCacheIntegrationSuite(t *testing.T) {
suite.Run(t, &MailFolderCacheIntegrationSuite{ suite.Run(t, &MailFolderCacheIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -44,7 +45,7 @@ func TestMailFolderCacheIntegrationSuite(t *testing.T) {
func (suite *MailFolderCacheIntegrationSuite) SetupSuite() { func (suite *MailFolderCacheIntegrationSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -73,7 +74,7 @@ func (suite *MailFolderCacheIntegrationSuite) TestDeltaFetch() {
path: []string{"some", "leading", "path"}, path: []string{"some", "leading", "path"},
}, },
} }
userID := tester.M365UserID(suite.T()) userID := tconfig.M365UserID(suite.T())
for _, test := range tests { for _, test := range tests {
suite.Run(test.name, func() { suite.Run(test.name, func() {

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/exchange/mock" "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -77,7 +78,7 @@ func TestMailRestoreIntgSuite(t *testing.T) {
suite.Run(t, &MailRestoreIntgSuite{ suite.Run(t, &MailRestoreIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -12,6 +12,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock" exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
@ -30,14 +31,14 @@ func TestRestoreIntgSuite(t *testing.T) {
suite.Run(t, &RestoreIntgSuite{ suite.Run(t, &RestoreIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
func (suite *RestoreIntgSuite) SetupSuite() { func (suite *RestoreIntgSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -55,7 +56,7 @@ func (suite *RestoreIntgSuite) TestRestoreContact() {
defer flush() defer flush()
var ( var (
userID = tester.M365UserID(t) userID = tconfig.M365UserID(t)
folderName = testdata.DefaultRestoreConfig("contact").Location folderName = testdata.DefaultRestoreConfig("contact").Location
handler = newContactRestoreHandler(suite.ac) handler = newContactRestoreHandler(suite.ac)
) )
@ -91,7 +92,7 @@ func (suite *RestoreIntgSuite) TestRestoreEvent() {
defer flush() defer flush()
var ( var (
userID = tester.M365UserID(t) userID = tconfig.M365UserID(t)
subject = testdata.DefaultRestoreConfig("event").Location subject = testdata.DefaultRestoreConfig("event").Location
handler = newEventRestoreHandler(suite.ac) handler = newEventRestoreHandler(suite.ac)
) )
@ -164,7 +165,7 @@ func (suite *RestoreIntgSuite) TestRestoreExchangeObject() {
handlers := restoreHandlers(suite.ac) handlers := restoreHandlers(suite.ac)
userID := tester.M365UserID(suite.T()) userID := tconfig.M365UserID(suite.T())
tests := []struct { tests := []struct {
name string name string
@ -395,7 +396,7 @@ func (suite *RestoreIntgSuite) TestRestoreAndBackupEvent_recurringInstancesWithA
defer flush() defer flush()
var ( var (
userID = tester.M365UserID(t) userID = tconfig.M365UserID(t)
subject = testdata.DefaultRestoreConfig("event").Location subject = testdata.DefaultRestoreConfig("event").Location
handler = newEventRestoreHandler(suite.ac) handler = newEventRestoreHandler(suite.ac)
) )

View File

@ -10,6 +10,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
) )
@ -20,7 +21,7 @@ type BetaClientSuite struct {
func TestBetaClientSuite(t *testing.T) { func TestBetaClientSuite(t *testing.T) {
suite.Run(t, &BetaClientSuite{ suite.Run(t, &BetaClientSuite{
Suite: tester.NewIntegrationSuite(t, [][]string{tester.M365AcctCredEnvs}), Suite: tester.NewIntegrationSuite(t, [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -32,7 +33,7 @@ func (suite *BetaClientSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, false, 4) graph.InitializeConcurrencyLimiter(ctx, false, 4)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -71,7 +72,7 @@ func (suite *BetaClientSuite) TestBasicClientGetFunctionality() {
client := NewBetaClient(adpt) client := NewBetaClient(adpt)
require.NotNil(t, client) require.NotNil(t, client)
siteID := tester.M365SiteID(t) siteID := tconfig.M365SiteID(t)
// TODO(dadams39) document allowable calls in main // TODO(dadams39) document allowable calls in main
collection, err := client.SitesById(siteID).Pages().Get(ctx, nil) collection, err := client.SitesById(siteID).Pages().Get(ctx, nil)

View File

@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
) )
type HTTPWrapperIntgSuite struct { type HTTPWrapperIntgSuite struct {
@ -21,7 +22,7 @@ func TestHTTPWrapperIntgSuite(t *testing.T) {
suite.Run(t, &HTTPWrapperIntgSuite{ suite.Run(t, &HTTPWrapperIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -22,6 +22,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
) )
@ -125,13 +126,13 @@ func TestRetryMWIntgSuite(t *testing.T) {
suite.Run(t, &RetryMWIntgSuite{ suite.Run(t, &RetryMWIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
func (suite *RetryMWIntgSuite) SetupSuite() { func (suite *RetryMWIntgSuite) SetupSuite() {
var ( var (
a = tester.NewM365Account(suite.T()) a = tconfig.NewM365Account(suite.T())
err error err error
) )

View File

@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
) )
@ -26,7 +27,7 @@ func TestGraphUnitSuite(t *testing.T) {
func (suite *GraphUnitSuite) SetupSuite() { func (suite *GraphUnitSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewMockM365Account(t) a := tconfig.NewFakeM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -22,7 +22,7 @@ import (
odStub "github.com/alcionai/corso/src/internal/m365/onedrive/stub" odStub "github.com/alcionai/corso/src/internal/m365/onedrive/stub"
"github.com/alcionai/corso/src/internal/m365/resource" "github.com/alcionai/corso/src/internal/m365/resource"
m365Stub "github.com/alcionai/corso/src/internal/m365/stub" m365Stub "github.com/alcionai/corso/src/internal/m365/stub"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
@ -716,7 +716,7 @@ func compareDriveItem(
t *testing.T, t *testing.T,
expected map[string][]byte, expected map[string][]byte,
item data.Stream, item data.Stream,
config m365Stub.ConfigInfo, mci m365Stub.ConfigInfo,
rootDir bool, rootDir bool,
) bool { ) bool {
// Skip Drive permissions in the folder that used to be the root. We don't // Skip Drive permissions in the folder that used to be the root. We don't
@ -796,7 +796,7 @@ func compareDriveItem(
assert.Equal(t, expectedMeta.FileName, itemMeta.FileName) assert.Equal(t, expectedMeta.FileName, itemMeta.FileName)
} }
if !config.Opts.RestorePermissions { if !mci.Opts.RestorePermissions {
assert.Equal(t, 0, len(itemMeta.Permissions)) assert.Equal(t, 0, len(itemMeta.Permissions))
return true return true
} }
@ -819,7 +819,7 @@ func compareDriveItem(
// sharepoint retrieves a superset of permissions // sharepoint retrieves a superset of permissions
// (all site admins, site groups, built in by default) // (all site admins, site groups, built in by default)
// relative to the permissions changed by the test. // relative to the permissions changed by the test.
config.Service == path.SharePointService, mci.Service == path.SharePointService,
permissionEqual) permissionEqual)
testElementsMatch( testElementsMatch(
@ -868,7 +868,7 @@ func compareItem(
service path.ServiceType, service path.ServiceType,
category path.CategoryType, category path.CategoryType,
item data.Stream, item data.Stream,
config m365Stub.ConfigInfo, mci m365Stub.ConfigInfo,
rootDir bool, rootDir bool,
) bool { ) bool {
if mt, ok := item.(data.StreamModTime); ok { if mt, ok := item.(data.StreamModTime); ok {
@ -889,7 +889,7 @@ func compareItem(
} }
case path.OneDriveService: case path.OneDriveService:
return compareDriveItem(t, expected, item, config, rootDir) return compareDriveItem(t, expected, item, mci, rootDir)
case path.SharePointService: case path.SharePointService:
if category != path.LibrariesCategory { if category != path.LibrariesCategory {
@ -897,7 +897,7 @@ func compareItem(
} }
// SharePoint libraries reuses OneDrive code. // SharePoint libraries reuses OneDrive code.
return compareDriveItem(t, expected, item, config, rootDir) return compareDriveItem(t, expected, item, mci, rootDir)
default: default:
assert.FailNowf(t, "unexpected service: %s", service.String()) assert.FailNowf(t, "unexpected service: %s", service.String())
@ -962,7 +962,7 @@ func checkCollections(
expectedItems int, expectedItems int,
expected map[string]map[string][]byte, expected map[string]map[string][]byte,
got []data.BackupCollection, got []data.BackupCollection,
config m365Stub.ConfigInfo, mci m365Stub.ConfigInfo,
) int { ) int {
collectionsWithItems := []data.BackupCollection{} collectionsWithItems := []data.BackupCollection{}
@ -976,7 +976,7 @@ func checkCollections(
category = returned.FullPath().Category() category = returned.FullPath().Category()
expectedColData = expected[returned.FullPath().String()] expectedColData = expected[returned.FullPath().String()]
folders = returned.FullPath().Elements() folders = returned.FullPath().Elements()
rootDir = folders[len(folders)-1] == config.RestoreCfg.Location rootDir = folders[len(folders)-1] == mci.RestoreCfg.Location
) )
// Need to iterate through all items even if we don't expect to find a match // Need to iterate through all items even if we don't expect to find a match
@ -1009,7 +1009,7 @@ func checkCollections(
service, service,
category, category,
item, item,
config, mci,
rootDir) { rootDir) {
gotItems-- gotItems--
} }
@ -1197,7 +1197,7 @@ func newController(
r resource.Category, r resource.Category,
pst path.ServiceType, pst path.ServiceType,
) *Controller { ) *Controller {
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
controller, err := NewController(ctx, a, r, pst, control.Options{}) controller, err := NewController(ctx, a, r, pst, control.Options{})
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -18,6 +18,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -292,7 +293,7 @@ func TestOneDriveSuite(t *testing.T) {
suite.Run(t, &OneDriveIntgSuite{ suite.Run(t, &OneDriveIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -304,9 +305,9 @@ func (suite *OneDriveIntgSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
suite.userID = tester.SecondaryM365UserID(t) suite.userID = tconfig.SecondaryM365UserID(t)
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
creds, err := acct.M365Config() creds, err := acct.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -424,7 +425,7 @@ func (suite *OneDriveIntgSuite) TestCreateGetDeleteFolder() {
} }
func (suite *OneDriveIntgSuite) TestOneDriveNewCollections() { func (suite *OneDriveIntgSuite) TestOneDriveNewCollections() {
creds, err := tester.NewM365Account(suite.T()).M365Config() creds, err := tconfig.NewM365Account(suite.T()).M365Config()
require.NoError(suite.T(), err, clues.ToCore(err)) require.NoError(suite.T(), err, clues.ToCore(err))
tests := []struct { tests := []struct {

View File

@ -15,6 +15,7 @@ import (
"github.com/alcionai/corso/src/internal/common/dttm" "github.com/alcionai/corso/src/internal/common/dttm"
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -33,8 +34,7 @@ func TestItemIntegrationSuite(t *testing.T) {
suite.Run(t, &ItemIntegrationSuite{ suite.Run(t, &ItemIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs}),
),
}) })
} }
@ -45,7 +45,7 @@ func (suite *ItemIntegrationSuite) SetupSuite() {
defer flush() defer flush()
suite.service = loadTestService(t) suite.service = loadTestService(t)
suite.user = tester.SecondaryM365UserID(t) suite.user = tconfig.SecondaryM365UserID(t)
pager := suite.service.ac.Drives().NewUserDrivePager(suite.user, nil) pager := suite.service.ac.Drives().NewUserDrivePager(suite.user, nil)

View File

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/alcionai/corso/src/internal/m365/support" "github.com/alcionai/corso/src/internal/m365/support"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -42,7 +42,7 @@ func (ods *oneDriveService) updateStatus(status *support.ControllerOperationStat
} }
func loadTestService(t *testing.T) *oneDriveService { func loadTestService(t *testing.T) *oneDriveService {
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
creds, err := a.M365Config() creds, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -18,6 +18,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -35,7 +36,7 @@ func TestURLCacheIntegrationSuite(t *testing.T) {
suite.Run(t, &URLCacheIntegrationSuite{ suite.Run(t, &URLCacheIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -45,9 +46,9 @@ func (suite *URLCacheIntegrationSuite) SetupSuite() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
suite.user = tester.SecondaryM365UserID(t) suite.user = tconfig.SecondaryM365UserID(t)
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
creds, err := acct.M365Config() creds, err := acct.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -19,6 +19,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/onedrive/stub" "github.com/alcionai/corso/src/internal/m365/onedrive/stub"
"github.com/alcionai/corso/src/internal/m365/resource" "github.com/alcionai/corso/src/internal/m365/resource"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
@ -128,10 +129,10 @@ func NewSuiteInfoImpl(
controller: ctrl, controller: ctrl,
resourceOwner: resourceOwner, resourceOwner: resourceOwner,
resourceCategory: rsc, resourceCategory: rsc,
secondaryUser: tester.SecondaryM365UserID(t), secondaryUser: tconfig.SecondaryM365UserID(t),
service: service, service: service,
tertiaryUser: tester.TertiaryM365UserID(t), tertiaryUser: tconfig.TertiaryM365UserID(t),
user: tester.M365UserID(t), user: tconfig.M365UserID(t),
} }
} }
@ -183,7 +184,7 @@ func TestSharePointIntegrationSuite(t *testing.T) {
suite.Run(t, &SharePointIntegrationSuite{ suite.Run(t, &SharePointIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -193,7 +194,7 @@ func (suite *SharePointIntegrationSuite) SetupSuite() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
si := NewSuiteInfoImpl(suite.T(), ctx, tester.M365SiteID(suite.T()), path.SharePointService) si := NewSuiteInfoImpl(suite.T(), ctx, tconfig.M365SiteID(suite.T()), path.SharePointService)
// users needed for permissions // users needed for permissions
user, err := si.controller.AC.Users().GetByID(ctx, si.user) user, err := si.controller.AC.Users().GetByID(ctx, si.user)
@ -253,7 +254,7 @@ func TestOneDriveIntegrationSuite(t *testing.T) {
suite.Run(t, &OneDriveIntegrationSuite{ suite.Run(t, &OneDriveIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -263,7 +264,7 @@ func (suite *OneDriveIntegrationSuite) SetupSuite() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
si := NewSuiteInfoImpl(t, ctx, tester.M365UserID(t), path.OneDriveService) si := NewSuiteInfoImpl(t, ctx, tconfig.M365UserID(t), path.OneDriveService)
user, err := si.controller.AC.Users().GetByID(ctx, si.user) user, err := si.controller.AC.Users().GetByID(ctx, si.user)
require.NoError(t, err, "fetching user", si.user, clues.ToCore(err)) require.NoError(t, err, "fetching user", si.user, clues.ToCore(err))
@ -317,7 +318,7 @@ func TestOneDriveNightlySuite(t *testing.T) {
suite.Run(t, &OneDriveNightlySuite{ suite.Run(t, &OneDriveNightlySuite{
Suite: tester.NewNightlySuite( Suite: tester.NewNightlySuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -327,7 +328,7 @@ func (suite *OneDriveNightlySuite) SetupSuite() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
si := NewSuiteInfoImpl(t, ctx, tester.M365UserID(t), path.OneDriveService) si := NewSuiteInfoImpl(t, ctx, tconfig.M365UserID(t), path.OneDriveService)
user, err := si.controller.AC.Users().GetByID(ctx, si.user) user, err := si.controller.AC.Users().GetByID(ctx, si.user)
require.NoError(t, err, "fetching user", si.user, clues.ToCore(err)) require.NoError(t, err, "fetching user", si.user, clues.ToCore(err))

View File

@ -11,6 +11,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/m365/graph/betasdk/models" "github.com/alcionai/corso/src/internal/m365/graph/betasdk/models"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
) )
type BetaUnitSuite struct { type BetaUnitSuite struct {
@ -23,7 +24,7 @@ func TestBetaUnitSuite(t *testing.T) {
func (suite *BetaUnitSuite) TestBetaService_Adapter() { func (suite *BetaUnitSuite) TestBetaService_Adapter() {
t := suite.T() t := suite.T()
a := tester.NewMockM365Account(t) a := tconfig.NewFakeM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -15,6 +15,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/sharepoint/api" "github.com/alcionai/corso/src/internal/m365/sharepoint/api"
spMock "github.com/alcionai/corso/src/internal/m365/sharepoint/mock" spMock "github.com/alcionai/corso/src/internal/m365/sharepoint/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -45,8 +46,8 @@ func (suite *SharePointPageSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
suite.siteID = tester.M365SiteID(t) suite.siteID = tconfig.M365SiteID(t)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -56,7 +57,7 @@ func (suite *SharePointPageSuite) SetupSuite() {
func TestSharePointPageSuite(t *testing.T) { func TestSharePointPageSuite(t *testing.T) {
suite.Run(t, &SharePointPageSuite{ suite.Run(t, &SharePointPageSuite{
Suite: tester.NewIntegrationSuite(t, [][]string{tester.M365AcctCredEnvs}), Suite: tester.NewIntegrationSuite(t, [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/onedrive" "github.com/alcionai/corso/src/internal/m365/onedrive"
odConsts "github.com/alcionai/corso/src/internal/m365/onedrive/consts" odConsts "github.com/alcionai/corso/src/internal/m365/onedrive/consts"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
@ -175,7 +176,7 @@ func TestSharePointPagesSuite(t *testing.T) {
suite.Run(t, &SharePointPagesSuite{ suite.Run(t, &SharePointPagesSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -193,8 +194,8 @@ func (suite *SharePointPagesSuite) TestCollectPages() {
defer flush() defer flush()
var ( var (
siteID = tester.M365SiteID(t) siteID = tconfig.M365SiteID(t)
a = tester.NewM365Account(t) a = tconfig.NewM365Account(t)
) )
creds, err := a.M365Config() creds, err := a.M365Config()

View File

@ -17,6 +17,7 @@ import (
betaAPI "github.com/alcionai/corso/src/internal/m365/sharepoint/api" betaAPI "github.com/alcionai/corso/src/internal/m365/sharepoint/api"
spMock "github.com/alcionai/corso/src/internal/m365/sharepoint/mock" spMock "github.com/alcionai/corso/src/internal/m365/sharepoint/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
@ -35,8 +36,8 @@ type SharePointCollectionSuite struct {
func (suite *SharePointCollectionSuite) SetupSuite() { func (suite *SharePointCollectionSuite) SetupSuite() {
t := suite.T() t := suite.T()
suite.siteID = tester.M365SiteID(t) suite.siteID = tconfig.M365SiteID(t)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -52,7 +53,7 @@ func TestSharePointCollectionSuite(t *testing.T) {
suite.Run(t, &SharePointCollectionSuite{ suite.Run(t, &SharePointCollectionSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }

View File

@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -22,7 +23,7 @@ type ListsUnitSuite struct {
func (suite *ListsUnitSuite) SetupSuite() { func (suite *ListsUnitSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -33,7 +34,7 @@ func TestListsUnitSuite(t *testing.T) {
suite.Run(t, &ListsUnitSuite{ suite.Run(t, &ListsUnitSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }

View File

@ -23,6 +23,7 @@ import (
"github.com/alcionai/corso/src/internal/operations/inject" "github.com/alcionai/corso/src/internal/operations/inject"
ssmock "github.com/alcionai/corso/src/internal/streamstore/mock" ssmock "github.com/alcionai/corso/src/internal/streamstore/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
@ -31,6 +32,7 @@ import (
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
"github.com/alcionai/corso/src/pkg/store" "github.com/alcionai/corso/src/pkg/store"
) )
@ -1209,7 +1211,7 @@ func TestBackupOpIntegrationSuite(t *testing.T) {
suite.Run(t, &BackupOpIntegrationSuite{ suite.Run(t, &BackupOpIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -1221,10 +1223,10 @@ func (suite *BackupOpIntegrationSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
suite.user = tester.M365UserID(t) suite.user = tconfig.M365UserID(t)
suite.site = tester.M365SiteID(t) suite.site = tconfig.M365SiteID(t)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
creds, err := a.M365Config() creds, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -1238,7 +1240,7 @@ func (suite *BackupOpIntegrationSuite) TestNewBackupOperation() {
kw = &kopia.Wrapper{} kw = &kopia.Wrapper{}
sw = &store.Wrapper{} sw = &store.Wrapper{}
ctrl = &mock.Controller{} ctrl = &mock.Controller{}
acct = tester.NewM365Account(suite.T()) acct = tconfig.NewM365Account(suite.T())
opts = control.Defaults() opts = control.Defaults()
) )

View File

@ -11,8 +11,10 @@ import (
evmock "github.com/alcionai/corso/src/internal/events/mock" evmock "github.com/alcionai/corso/src/internal/events/mock"
"github.com/alcionai/corso/src/internal/kopia" "github.com/alcionai/corso/src/internal/kopia"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/repository" "github.com/alcionai/corso/src/pkg/control/repository"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type MaintenanceOpIntegrationSuite struct { type MaintenanceOpIntegrationSuite struct {
@ -23,7 +25,7 @@ func TestMaintenanceOpIntegrationSuite(t *testing.T) {
suite.Run(t, &MaintenanceOpIntegrationSuite{ suite.Run(t, &MaintenanceOpIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -31,7 +33,7 @@ func (suite *MaintenanceOpIntegrationSuite) TestRepoMaintenance() {
var ( var (
t = suite.T() t = suite.T()
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st = tester.NewPrefixedS3Storage(t) st = storeTD.NewPrefixedS3Storage(t)
k = kopia.NewConn(st) k = kopia.NewConn(st)
) )

View File

@ -26,12 +26,14 @@ import (
"github.com/alcionai/corso/src/internal/operations/inject" "github.com/alcionai/corso/src/internal/operations/inject"
"github.com/alcionai/corso/src/internal/stats" "github.com/alcionai/corso/src/internal/stats"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/repository" "github.com/alcionai/corso/src/pkg/control/repository"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
"github.com/alcionai/corso/src/pkg/store" "github.com/alcionai/corso/src/pkg/store"
) )
@ -161,7 +163,7 @@ func TestRestoreOpIntegrationSuite(t *testing.T) {
suite.Run(t, &RestoreOpIntegrationSuite{ suite.Run(t, &RestoreOpIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -174,11 +176,11 @@ func (suite *RestoreOpIntegrationSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
var ( var (
st = tester.NewPrefixedS3Storage(t) st = storeTD.NewPrefixedS3Storage(t)
k = kopia.NewConn(st) k = kopia.NewConn(st)
) )
suite.acct = tester.NewM365Account(t) suite.acct = tconfig.NewM365Account(t)
err := k.Initialize(ctx, repository.Options{}) err := k.Initialize(ctx, repository.Options{})
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -253,7 +255,7 @@ func (suite *RestoreOpIntegrationSuite) TestNewRestoreOperation() {
test.kw, test.kw,
test.sw, test.sw,
test.rc, test.rc,
tester.NewM365Account(t), tconfig.NewM365Account(t),
"backup-id", "backup-id",
selectors.Selector{DiscreteOwner: "test"}, selectors.Selector{DiscreteOwner: "test"},
restoreCfg, restoreCfg,
@ -381,7 +383,7 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run() {
}{ }{
{ {
name: "Exchange_Restore", name: "Exchange_Restore",
owner: tester.M365UserID(suite.T()), owner: tconfig.M365UserID(suite.T()),
restoreCfg: testdata.DefaultRestoreConfig(""), restoreCfg: testdata.DefaultRestoreConfig(""),
getSelector: func(t *testing.T, owners []string) selectors.Selector { getSelector: func(t *testing.T, owners []string) selectors.Selector {
rsel := selectors.NewExchangeRestore(owners) rsel := selectors.NewExchangeRestore(owners)
@ -393,7 +395,7 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run() {
}, },
{ {
name: "SharePoint_Restore", name: "SharePoint_Restore",
owner: tester.M365SiteID(suite.T()), owner: tconfig.M365SiteID(suite.T()),
restoreCfg: control.DefaultRestoreConfig(dttm.SafeForTesting), restoreCfg: control.DefaultRestoreConfig(dttm.SafeForTesting),
getSelector: func(t *testing.T, owners []string) selectors.Selector { getSelector: func(t *testing.T, owners []string) selectors.Selector {
rsel := selectors.NewSharePointRestore(owners) rsel := selectors.NewSharePointRestore(owners)
@ -425,7 +427,7 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run() {
suite.kw, suite.kw,
suite.sw, suite.sw,
bup.ctrl, bup.ctrl,
tester.NewM365Account(t), tconfig.NewM365Account(t),
bup.backupID, bup.backupID,
test.getSelector(t, bup.selectorResourceOwners), test.getSelector(t, bup.selectorResourceOwners),
test.restoreCfg, test.restoreCfg,
@ -479,7 +481,7 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run_errorNoBackup() {
suite.kw, suite.kw,
suite.sw, suite.sw,
ctrl, ctrl,
tester.NewM365Account(t), tconfig.NewM365Account(t),
"backupID", "backupID",
rsel.Selector, rsel.Selector,
restoreCfg, restoreCfg,

View File

@ -23,6 +23,7 @@ import (
exchTD "github.com/alcionai/corso/src/internal/m365/exchange/testdata" exchTD "github.com/alcionai/corso/src/internal/m365/exchange/testdata"
"github.com/alcionai/corso/src/internal/m365/resource" "github.com/alcionai/corso/src/internal/m365/resource"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
deeTD "github.com/alcionai/corso/src/pkg/backup/details/testdata" deeTD "github.com/alcionai/corso/src/pkg/backup/details/testdata"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
@ -30,6 +31,7 @@ import (
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type ExchangeBackupIntgSuite struct { type ExchangeBackupIntgSuite struct {
@ -41,7 +43,7 @@ func TestExchangeBackupIntgSuite(t *testing.T) {
suite.Run(t, &ExchangeBackupIntgSuite{ suite.Run(t, &ExchangeBackupIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs, tester.AWSStorageCredEnvs}), [][]string{tconfig.M365AcctCredEnvs, storeTD.AWSStorageCredEnvs}),
}) })
} }
@ -234,7 +236,7 @@ func testExchangeContinuousBackups(suite *ExchangeBackupIntgSuite, toggles contr
tester.LogTimeOfTest(t) tester.LogTimeOfTest(t)
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
mb = evmock.NewBus() mb = evmock.NewBus()
now = dttm.Now() now = dttm.Now()
service = path.ExchangeService service = path.ExchangeService

View File

@ -27,6 +27,7 @@ import (
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/streamstore" "github.com/alcionai/corso/src/internal/streamstore"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
@ -38,6 +39,7 @@ import (
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
"github.com/alcionai/corso/src/pkg/services/m365/api/mock" "github.com/alcionai/corso/src/pkg/services/m365/api/mock"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
"github.com/alcionai/corso/src/pkg/store" "github.com/alcionai/corso/src/pkg/store"
) )
@ -91,8 +93,8 @@ func prepNewTestBackupOp(
*backupOpDependencies, *backupOpDependencies,
) { ) {
bod := &backupOpDependencies{ bod := &backupOpDependencies{
acct: tester.NewM365Account(t), acct: tconfig.NewM365Account(t),
st: tester.NewPrefixedS3Storage(t), st: storeTD.NewPrefixedS3Storage(t),
} }
k := kopia.NewConn(bod.st) k := kopia.NewConn(bod.st)
@ -585,7 +587,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
creds, err := a.M365Config() creds, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -597,7 +599,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
// user drive // user drive
its.userID = tester.M365UserID(t) its.userID = tconfig.M365UserID(t)
userDrive, err := its.ac.Users().GetDefaultDrive(ctx, its.userID) userDrive, err := its.ac.Users().GetDefaultDrive(ctx, its.userID)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -609,7 +611,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
its.userDriveRootFolderID = ptr.Val(userDriveRootFolder.GetId()) its.userDriveRootFolderID = ptr.Val(userDriveRootFolder.GetId())
its.siteID = tester.M365SiteID(t) its.siteID = tconfig.M365SiteID(t)
// site // site

View File

@ -26,6 +26,7 @@ import (
"github.com/alcionai/corso/src/internal/model" "github.com/alcionai/corso/src/internal/model"
"github.com/alcionai/corso/src/internal/streamstore" "github.com/alcionai/corso/src/internal/streamstore"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
@ -36,6 +37,7 @@ import (
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
selTD "github.com/alcionai/corso/src/pkg/selectors/testdata" selTD "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type OneDriveBackupIntgSuite struct { type OneDriveBackupIntgSuite struct {
@ -47,7 +49,7 @@ func TestOneDriveBackupIntgSuite(t *testing.T) {
suite.Run(t, &OneDriveBackupIntgSuite{ suite.Run(t, &OneDriveBackupIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs, tester.AWSStorageCredEnvs}), [][]string{tconfig.M365AcctCredEnvs, storeTD.AWSStorageCredEnvs}),
}) })
} }
@ -62,9 +64,9 @@ func (suite *OneDriveBackupIntgSuite) TestBackup_Run_oneDrive() {
defer flush() defer flush()
var ( var (
tenID = tester.M365TenantID(t) tenID = tconfig.M365TenantID(t)
mb = evmock.NewBus() mb = evmock.NewBus()
userID = tester.SecondaryM365UserID(t) userID = tconfig.SecondaryM365UserID(t)
osel = selectors.NewOneDriveBackup([]string{userID}) osel = selectors.NewOneDriveBackup([]string{userID})
ws = deeTD.DriveIDFromRepoRef ws = deeTD.DriveIDFromRepoRef
svc = path.OneDriveService svc = path.OneDriveService
@ -160,7 +162,7 @@ func runDriveIncrementalTest(
defer flush() defer flush()
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
ffs = control.Toggles{} ffs = control.Toggles{}
mb = evmock.NewBus() mb = evmock.NewBus()
ws = deeTD.DriveIDFromRepoRef ws = deeTD.DriveIDFromRepoRef
@ -698,7 +700,7 @@ func (suite *OneDriveBackupIntgSuite) TestBackup_Run_oneDriveOwnerMigration() {
defer flush() defer flush()
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
ffs = control.Toggles{} ffs = control.Toggles{}
mb = evmock.NewBus() mb = evmock.NewBus()

View File

@ -15,12 +15,14 @@ import (
"github.com/alcionai/corso/src/internal/m365/resource" "github.com/alcionai/corso/src/internal/m365/resource"
"github.com/alcionai/corso/src/internal/m365/sharepoint" "github.com/alcionai/corso/src/internal/m365/sharepoint"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
selTD "github.com/alcionai/corso/src/pkg/selectors/testdata" selTD "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type SharePointBackupIntgSuite struct { type SharePointBackupIntgSuite struct {
@ -32,7 +34,7 @@ func TestSharePointBackupIntgSuite(t *testing.T) {
suite.Run(t, &SharePointBackupIntgSuite{ suite.Run(t, &SharePointBackupIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs, tester.AWSStorageCredEnvs}), [][]string{tconfig.M365AcctCredEnvs, storeTD.AWSStorageCredEnvs}),
}) })
} }

View File

@ -16,6 +16,7 @@ import (
"github.com/alcionai/corso/src/pkg/control/repository" "github.com/alcionai/corso/src/pkg/control/repository"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
type StreamStoreIntgSuite struct { type StreamStoreIntgSuite struct {
@ -29,7 +30,7 @@ func TestStreamStoreIntgSuite(t *testing.T) {
suite.Run(t, &StreamStoreIntgSuite{ suite.Run(t, &StreamStoreIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs}),
}) })
} }
@ -40,7 +41,7 @@ func (suite *StreamStoreIntgSuite) SetupSubTest() {
defer flush() defer flush()
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
k := kopia.NewConn(st) k := kopia.NewConn(st)
require.NoError(t, k.Initialize(ctx, repository.Options{})) require.NoError(t, k.Initialize(ctx, repository.Options{}))

View File

@ -1,4 +1,4 @@
package tester package tconfig
import ( import (
"testing" "testing"
@ -18,7 +18,7 @@ var M365AcctCredEnvs = []string{
// NewM365Account returns an account.Account object initialized with environment // NewM365Account returns an account.Account object initialized with environment
// variables used for integration tests that use the m365 Controller. // variables used for integration tests that use the m365 Controller.
func NewM365Account(t *testing.T) account.Account { func NewM365Account(t *testing.T) account.Account {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "configuring m365 account from test configuration", clues.ToCore(err)) require.NoError(t, err, "configuring m365 account from test configuration", clues.ToCore(err))
acc, err := account.NewAccount( acc, err := account.NewAccount(
@ -33,7 +33,7 @@ func NewM365Account(t *testing.T) account.Account {
return acc return acc
} }
func NewMockM365Account(t *testing.T) account.Account { func NewFakeM365Account(t *testing.T) account.Account {
acc, err := account.NewAccount( acc, err := account.NewAccount(
account.ProviderM365, account.ProviderM365,
account.M365Config{ account.M365Config{

View File

@ -1,4 +1,4 @@
package tester package tconfig
import ( import (
"os" "os"
@ -87,7 +87,7 @@ func NewTestViper() (*viper.Viper, error) {
// reads a corso configuration file with values specific to // reads a corso configuration file with values specific to
// local integration test controls. Populates values with // local integration test controls. Populates values with
// defaults where standard. // defaults where standard.
func readTestConfig() (map[string]string, error) { func ReadTestConfig() (map[string]string, error) {
if testConfig != nil { if testConfig != nil {
return cloneTestConfig(), nil return cloneTestConfig(), nil
} }
@ -177,7 +177,7 @@ func readTestConfig() (map[string]string, error) {
// //
// Returns a filepath string pointing to the location of the temp file. // Returns a filepath string pointing to the location of the temp file.
func MakeTempTestConfigClone(t *testing.T, overrides map[string]string) (*viper.Viper, string) { func MakeTempTestConfigClone(t *testing.T, overrides map[string]string) (*viper.Viper, string) {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "reading tester config", clues.ToCore(err)) require.NoError(t, err, "reading tester config", clues.ToCore(err))
fName := filepath.Base(os.Getenv(EnvCorsoTestConfigFilePath)) fName := filepath.Base(os.Getenv(EnvCorsoTestConfigFilePath))

View File

@ -1,4 +1,4 @@
package tester package tconfig
import ( import (
"context" "context"
@ -17,7 +17,7 @@ import (
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func M365TenantID(t *testing.T) string { func M365TenantID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving m365 tenant ID from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving m365 tenant ID from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgAzureTenantID]) return strings.ToLower(cfg[TestCfgAzureTenantID])
@ -28,7 +28,7 @@ func M365TenantID(t *testing.T) string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func GetM365TenantID(ctx context.Context) string { func GetM365TenantID(ctx context.Context) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
if err != nil { if err != nil {
logger.Ctx(ctx).Error(err, "retrieving m365 tenant ID from test configuration") logger.Ctx(ctx).Error(err, "retrieving m365 tenant ID from test configuration")
} }
@ -41,7 +41,7 @@ func GetM365TenantID(ctx context.Context) string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func M365UserID(t *testing.T) string { func M365UserID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving m365 user id from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving m365 user id from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgUserID]) return strings.ToLower(cfg[TestCfgUserID])
@ -52,7 +52,7 @@ func M365UserID(t *testing.T) string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func GetM365UserID(ctx context.Context) string { func GetM365UserID(ctx context.Context) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
if err != nil { if err != nil {
logger.Ctx(ctx).Error(err, "retrieving m365 user id from test configuration") logger.Ctx(ctx).Error(err, "retrieving m365 user id from test configuration")
} }
@ -66,7 +66,7 @@ func GetM365UserID(ctx context.Context) string {
// The default is a last-attempt fallback that will only work on alcion's // The default is a last-attempt fallback that will only work on alcion's
// testing org. // testing org.
func SecondaryM365UserID(t *testing.T) string { func SecondaryM365UserID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving secondary m365 user id from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving secondary m365 user id from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgSecondaryUserID]) return strings.ToLower(cfg[TestCfgSecondaryUserID])
@ -78,7 +78,7 @@ func SecondaryM365UserID(t *testing.T) string {
// The default is a last-attempt fallback that will only work on alcion's // The default is a last-attempt fallback that will only work on alcion's
// testing org. // testing org.
func TertiaryM365UserID(t *testing.T) string { func TertiaryM365UserID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving tertiary m365 user id from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving tertiary m365 user id from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgTertiaryUserID]) return strings.ToLower(cfg[TestCfgTertiaryUserID])
@ -90,7 +90,7 @@ func TertiaryM365UserID(t *testing.T) string {
// The default is a last-attempt fallback that will only work on alcion's // The default is a last-attempt fallback that will only work on alcion's
// testing org. // testing org.
func LoadTestM365SiteID(t *testing.T) string { func LoadTestM365SiteID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving load test m365 site id from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving load test m365 site id from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgSiteID]) return strings.ToLower(cfg[TestCfgSiteID])
@ -102,7 +102,7 @@ func LoadTestM365SiteID(t *testing.T) string {
// The default is a last-attempt fallback that will only work on alcion's // The default is a last-attempt fallback that will only work on alcion's
// testing org. // testing org.
func LoadTestM365UserID(t *testing.T) string { func LoadTestM365UserID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving load test m365 user id from test configuration", clues.ToCore(err)) require.NoError(t, err, "retrieving load test m365 user id from test configuration", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgLoadTestUserID]) return strings.ToLower(cfg[TestCfgLoadTestUserID])
@ -112,7 +112,7 @@ func LoadTestM365UserID(t *testing.T) string {
// ["site1\,uuid","site2\,uuid"] // ["site1\,uuid","site2\,uuid"]
// the delimiter must be a |. // the delimiter must be a |.
func LoadTestM365OrgSites(t *testing.T) []string { func LoadTestM365OrgSites(t *testing.T) []string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving load test m365 org sites from test configuration %+v", clues.ToCore(err)) require.NoError(t, err, "retrieving load test m365 org sites from test configuration %+v", clues.ToCore(err))
// TODO: proper handling of site slice input. // TODO: proper handling of site slice input.
@ -132,7 +132,7 @@ func LoadTestM365OrgSites(t *testing.T) []string {
// ["foo@example.com","bar@example.com"] // ["foo@example.com","bar@example.com"]
// the delimiter may be either a , or |. // the delimiter may be either a , or |.
func LoadTestM365OrgUsers(t *testing.T) []string { func LoadTestM365OrgUsers(t *testing.T) []string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving load test m365 org users from test configuration %+v", clues.ToCore(err)) require.NoError(t, err, "retrieving load test m365 org users from test configuration %+v", clues.ToCore(err))
users := cfg[TestCfgLoadTestOrgUsers] users := cfg[TestCfgLoadTestOrgUsers]
@ -168,7 +168,7 @@ func LoadTestM365OrgUsers(t *testing.T) []string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func M365SiteID(t *testing.T) string { func M365SiteID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving m365 site id from test configuration: %+v", clues.ToCore(err)) require.NoError(t, err, "retrieving m365 site id from test configuration: %+v", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgSiteID]) return strings.ToLower(cfg[TestCfgSiteID])
@ -179,7 +179,7 @@ func M365SiteID(t *testing.T) string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func M365SiteURL(t *testing.T) string { func M365SiteURL(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving m365 site url from test configuration: %+v", clues.ToCore(err)) require.NoError(t, err, "retrieving m365 site url from test configuration: %+v", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgSiteURL]) return strings.ToLower(cfg[TestCfgSiteURL])
@ -190,7 +190,7 @@ func M365SiteURL(t *testing.T) string {
// file or the default value (in that order of priority). The default is a // file or the default value (in that order of priority). The default is a
// last-attempt fallback that will only work on alcion's testing org. // last-attempt fallback that will only work on alcion's testing org.
func GetM365SiteID(ctx context.Context) string { func GetM365SiteID(ctx context.Context) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
if err != nil { if err != nil {
logger.Ctx(ctx).Error(err, "retrieving m365 user id from test configuration") logger.Ctx(ctx).Error(err, "retrieving m365 user id from test configuration")
} }
@ -204,7 +204,7 @@ func GetM365SiteID(ctx context.Context) string {
// The default is a last-attempt fallback that will only work on alcion's // The default is a last-attempt fallback that will only work on alcion's
// testing org. // testing org.
func UnlicensedM365UserID(t *testing.T) string { func UnlicensedM365UserID(t *testing.T) string {
cfg, err := readTestConfig() cfg, err := ReadTestConfig()
require.NoError(t, err, "retrieving unlicensed m365 user id from test configuration: %+v", clues.ToCore(err)) require.NoError(t, err, "retrieving unlicensed m365 user id from test configuration: %+v", clues.ToCore(err))
return strings.ToLower(cfg[TestCfgSecondaryUserID]) return strings.ToLower(cfg[TestCfgSecondaryUserID])

View File

@ -16,6 +16,7 @@ import (
D "github.com/alcionai/corso/src/internal/diagnostics" D "github.com/alcionai/corso/src/internal/diagnostics"
"github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/operations"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
@ -27,26 +28,27 @@ import (
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
selTD "github.com/alcionai/corso/src/pkg/selectors/testdata" selTD "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
//lint:ignore U1000 future test use //lint:ignore U1000 future test use
func orgSiteSet(t *testing.T) []string { func orgSiteSet(t *testing.T) []string {
return tester.LoadTestM365OrgSites(t) return tconfig.LoadTestM365OrgSites(t)
} }
//lint:ignore U1000 future test use //lint:ignore U1000 future test use
func orgUserSet(t *testing.T) []string { func orgUserSet(t *testing.T) []string {
return tester.LoadTestM365OrgUsers(t) return tconfig.LoadTestM365OrgUsers(t)
} }
//lint:ignore U1000 future test use //lint:ignore U1000 future test use
func singleSiteSet(t *testing.T) []string { func singleSiteSet(t *testing.T) []string {
return []string{tester.LoadTestM365SiteID(t)} return []string{tconfig.LoadTestM365SiteID(t)}
} }
//lint:ignore U1000 future test use //lint:ignore U1000 future test use
func singleUserSet(t *testing.T) []string { func singleUserSet(t *testing.T) []string {
return []string{tester.LoadTestM365UserID(t)} return []string{tconfig.LoadTestM365UserID(t)}
} }
var loadCtx context.Context var loadCtx context.Context
@ -88,13 +90,13 @@ func initM365Repo(t *testing.T) (
account.Account, account.Account,
storage.Storage, storage.Storage,
) { ) {
tester.MustGetEnvSets(t, tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs) tester.MustGetEnvSets(t, storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs)
ctx, flush := tester.WithContext(t, loadCtx) ctx, flush := tester.WithContext(t, loadCtx)
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
ac := tester.NewM365Account(t) ac := tconfig.NewM365Account(t)
opts := control.Options{ opts := control.Options{
DisableMetrics: true, DisableMetrics: true,
FailureHandling: control.FailFast, FailureHandling: control.FailFast,
@ -416,7 +418,7 @@ func TestLoadExchangeSuite(t *testing.T) {
suite.Run(t, &LoadExchangeSuite{ suite.Run(t, &LoadExchangeSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -467,7 +469,7 @@ func TestIndividualLoadExchangeSuite(t *testing.T) {
suite.Run(t, &IndividualLoadExchangeSuite{ suite.Run(t, &IndividualLoadExchangeSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -521,7 +523,7 @@ func TestLoadOneDriveSuite(t *testing.T) {
suite.Run(t, &LoadOneDriveSuite{ suite.Run(t, &LoadOneDriveSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -569,7 +571,7 @@ func TestIndividualLoadOneDriveSuite(t *testing.T) {
suite.Run(t, &IndividualLoadOneDriveSuite{ suite.Run(t, &IndividualLoadOneDriveSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -620,7 +622,7 @@ func TestLoadSharePointSuite(t *testing.T) {
suite.Run(t, &LoadSharePointSuite{ suite.Run(t, &LoadSharePointSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -668,7 +670,7 @@ func TestIndividualLoadSharePointSuite(t *testing.T) {
suite.Run(t, &IndividualLoadSharePointSuite{ suite.Run(t, &IndividualLoadSharePointSuite{
Suite: tester.NewLoadSuite( Suite: tester.NewLoadSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}, [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs},
), ),
}) })
} }

View File

@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
ctrlRepo "github.com/alcionai/corso/src/pkg/control/repository" ctrlRepo "github.com/alcionai/corso/src/pkg/control/repository"
@ -18,6 +19,7 @@ import (
"github.com/alcionai/corso/src/pkg/extensions" "github.com/alcionai/corso/src/pkg/extensions"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
) )
// --------------- // ---------------
@ -110,7 +112,7 @@ func TestRepositoryIntegrationSuite(t *testing.T) {
suite.Run(t, &RepositoryIntegrationSuite{ suite.Run(t, &RepositoryIntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -123,7 +125,7 @@ func (suite *RepositoryIntegrationSuite) TestInitialize() {
}{ }{
{ {
name: "success", name: "success",
storage: tester.NewPrefixedS3Storage, storage: storeTD.NewPrefixedS3Storage,
errCheck: assert.NoError, errCheck: assert.NoError,
}, },
} }
@ -161,7 +163,7 @@ func (suite *RepositoryIntegrationSuite) TestInitializeWithRole() {
ctx, flush := tester.NewContext(suite.T()) ctx, flush := tester.NewContext(suite.T())
defer flush() defer flush()
st := tester.NewPrefixedS3Storage(suite.T()) st := storeTD.NewPrefixedS3Storage(suite.T())
st.Role = os.Getenv(roleARNEnvKey) st.Role = os.Getenv(roleARNEnvKey)
st.SessionName = "corso-repository-test" st.SessionName = "corso-repository-test"
@ -182,7 +184,7 @@ func (suite *RepositoryIntegrationSuite) TestConnect() {
defer flush() defer flush()
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
repo, err := Initialize(ctx, account.Account{}, st, control.Defaults()) repo, err := Initialize(ctx, account.Account{}, st, control.Defaults())
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -199,7 +201,7 @@ func (suite *RepositoryIntegrationSuite) TestConnect_sameID() {
defer flush() defer flush()
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
r, err := Initialize(ctx, account.Account{}, st, control.Defaults()) r, err := Initialize(ctx, account.Account{}, st, control.Defaults())
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -221,15 +223,15 @@ func (suite *RepositoryIntegrationSuite) TestNewBackup() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
r, err := Initialize(ctx, acct, st, control.Defaults()) r, err := Initialize(ctx, acct, st, control.Defaults())
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
userID := tester.M365UserID(t) userID := tconfig.M365UserID(t)
bo, err := r.NewBackup(ctx, selectors.Selector{DiscreteOwner: userID}) bo, err := r.NewBackup(ctx, selectors.Selector{DiscreteOwner: userID})
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -242,11 +244,11 @@ func (suite *RepositoryIntegrationSuite) TestNewRestore() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
restoreCfg := testdata.DefaultRestoreConfig("") restoreCfg := testdata.DefaultRestoreConfig("")
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
r, err := Initialize(ctx, acct, st, control.Defaults()) r, err := Initialize(ctx, acct, st, control.Defaults())
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -262,10 +264,10 @@ func (suite *RepositoryIntegrationSuite) TestNewMaintenance() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
r, err := Initialize(ctx, acct, st, control.Defaults()) r, err := Initialize(ctx, acct, st, control.Defaults())
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -282,7 +284,7 @@ func (suite *RepositoryIntegrationSuite) TestConnect_DisableMetrics() {
defer flush() defer flush()
// need to initialize the repository before we can test connecting to it. // need to initialize the repository before we can test connecting to it.
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
repo, err := Initialize(ctx, account.Account{}, st, control.Defaults()) repo, err := Initialize(ctx, account.Account{}, st, control.Defaults())
require.NoError(t, err) require.NoError(t, err)
@ -342,8 +344,8 @@ func (suite *RepositoryIntegrationSuite) Test_Options() {
for _, test := range table { for _, test := range table {
suite.Run(test.name, func() { suite.Run(test.name, func() {
t := suite.T() t := suite.T()
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
st := tester.NewPrefixedS3Storage(t) st := storeTD.NewPrefixedS3Storage(t)
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()

View File

@ -17,6 +17,7 @@ import (
"github.com/alcionai/corso/src/internal/stats" "github.com/alcionai/corso/src/internal/stats"
"github.com/alcionai/corso/src/internal/streamstore" "github.com/alcionai/corso/src/internal/streamstore"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/internal/version"
"github.com/alcionai/corso/src/pkg/backup" "github.com/alcionai/corso/src/pkg/backup"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
@ -24,6 +25,7 @@ import (
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors"
storeTD "github.com/alcionai/corso/src/pkg/storage/testdata"
"github.com/alcionai/corso/src/pkg/store" "github.com/alcionai/corso/src/pkg/store"
"github.com/alcionai/corso/src/pkg/store/mock" "github.com/alcionai/corso/src/pkg/store/mock"
) )
@ -220,7 +222,7 @@ func TestRepositoryModelIntgSuite(t *testing.T) {
suite.Run(t, &RepositoryModelIntgSuite{ suite.Run(t, &RepositoryModelIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs}), [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}),
}) })
} }
@ -231,7 +233,7 @@ func (suite *RepositoryModelIntgSuite) SetupSuite() {
defer flush() defer flush()
var ( var (
s = tester.NewPrefixedS3Storage(t) s = storeTD.NewPrefixedS3Storage(t)
k = kopia.NewConn(s) k = kopia.NewConn(s)
err error err error
) )
@ -285,7 +287,7 @@ func (suite *RepositoryModelIntgSuite) TestGetRepositoryModel() {
defer flush() defer flush()
var ( var (
s = tester.NewPrefixedS3Storage(t) s = storeTD.NewPrefixedS3Storage(t)
k = kopia.NewConn(s) k = kopia.NewConn(s)
) )

View File

@ -11,6 +11,7 @@ import (
exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock" exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
) )
@ -23,7 +24,7 @@ func TestExchangeServiceSuite(t *testing.T) {
suite.Run(t, &ExchangeServiceSuite{ suite.Run(t, &ExchangeServiceSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}, [][]string{tconfig.M365AcctCredEnvs},
), ),
}) })
} }
@ -31,7 +32,7 @@ func TestExchangeServiceSuite(t *testing.T) {
func (suite *ExchangeServiceSuite) SetupSuite() { func (suite *ExchangeServiceSuite) SetupSuite() {
t := suite.T() t := suite.T()
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
m365, err := a.M365Config() m365, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))

View File

@ -10,6 +10,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -22,7 +23,7 @@ func TestContactsPagerIntgSuite(t *testing.T) {
suite.Run(t, &ContactsPagerIntgSuite{ suite.Run(t, &ContactsPagerIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -13,6 +13,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock" exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
@ -119,7 +120,7 @@ func TestContactsAPIntgSuite(t *testing.T) {
suite.Run(t, &ContactsAPIIntgSuite{ suite.Run(t, &ContactsAPIIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -21,7 +22,7 @@ func TestDrivePagerIntgSuite(t *testing.T) {
suite.Run(t, &DrivePagerIntgSuite{ suite.Run(t, &DrivePagerIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
) )
@ -31,7 +32,7 @@ func TestDriveAPIs(t *testing.T) {
suite.Run(t, &DriveAPIIntgSuite{ suite.Run(t, &DriveAPIIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -41,7 +42,7 @@ func (suite *DriveAPIIntgSuite) TestDrives_CreatePagerAndGetPage() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
siteID := tester.M365SiteID(t) siteID := tconfig.M365SiteID(t)
pager := suite.its.ac.Drives().NewSiteDrivePager(siteID, []string{"name"}) pager := suite.its.ac.Drives().NewSiteDrivePager(siteID, []string{"name"})
a, err := pager.GetPage(ctx) a, err := pager.GetPage(ctx)

View File

@ -10,6 +10,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -22,7 +23,7 @@ func TestEventsPagerIntgSuite(t *testing.T) {
suite.Run(t, &EventsPagerIntgSuite{ suite.Run(t, &EventsPagerIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -16,6 +16,7 @@ import (
exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock" exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -228,7 +229,7 @@ func TestEventsAPIIntgSuite(t *testing.T) {
suite.Run(t, &EventsAPIIntgSuite{ suite.Run(t, &EventsAPIIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -242,7 +243,7 @@ func (suite *EventsAPIIntgSuite) TestEvents_RestoreLargeAttachment() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
userID := tester.M365UserID(suite.T()) userID := tconfig.M365UserID(suite.T())
folderName := testdata.DefaultRestoreConfig("eventlargeattachmenttest").Location folderName := testdata.DefaultRestoreConfig("eventlargeattachmenttest").Location
evts := suite.its.ac.Events() evts := suite.its.ac.Events()

View File

@ -15,6 +15,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
"github.com/alcionai/corso/src/pkg/services/m365/api/mock" "github.com/alcionai/corso/src/pkg/services/m365/api/mock"
) )
@ -91,7 +92,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
a := tester.NewM365Account(t) a := tconfig.NewM365Account(t)
creds, err := a.M365Config() creds, err := a.M365Config()
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -103,7 +104,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
// user drive // user drive
its.userID = tester.M365UserID(t) its.userID = tconfig.M365UserID(t)
userDrive, err := its.ac.Users().GetDefaultDrive(ctx, its.userID) userDrive, err := its.ac.Users().GetDefaultDrive(ctx, its.userID)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
@ -115,7 +116,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
its.userDriveRootFolderID = ptr.Val(userDriveRootFolder.GetId()) its.userDriveRootFolderID = ptr.Val(userDriveRootFolder.GetId())
its.siteID = tester.M365SiteID(t) its.siteID = tconfig.M365SiteID(t)
// site // site

View File

@ -10,6 +10,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -22,7 +23,7 @@ func TestMailPagerIntgSuite(t *testing.T) {
suite.Run(t, &MailPagerIntgSuite{ suite.Run(t, &MailPagerIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock" exchMock "github.com/alcionai/corso/src/internal/m365/exchange/mock"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/backup/details"
"github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/control/testdata"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -196,7 +197,7 @@ func TestMailAPIIntgSuite(t *testing.T) {
suite.Run(t, &MailAPIIntgSuite{ suite.Run(t, &MailAPIIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -378,7 +379,7 @@ func (suite *MailAPIIntgSuite) TestMail_RestoreLargeAttachment() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
userID := tester.M365UserID(suite.T()) userID := tconfig.M365UserID(suite.T())
folderName := testdata.DefaultRestoreConfig("maillargeattachmenttest").Location folderName := testdata.DefaultRestoreConfig("maillargeattachmenttest").Location
msgs := suite.its.ac.Mail() msgs := suite.its.ac.Mail()

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -113,7 +114,7 @@ func TestSitesIntgSuite(t *testing.T) {
suite.Run(t, &SitesIntgSuite{ suite.Run(t, &SitesIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -141,10 +142,10 @@ func (suite *SitesIntgSuite) TestGetAll() {
func (suite *SitesIntgSuite) TestSites_GetByID() { func (suite *SitesIntgSuite) TestSites_GetByID() {
var ( var (
t = suite.T() t = suite.T()
siteID = tester.M365SiteID(t) siteID = tconfig.M365SiteID(t)
host = strings.Split(siteID, ",")[0] host = strings.Split(siteID, ",")[0]
shortID = strings.TrimPrefix(siteID, host+",") shortID = strings.TrimPrefix(siteID, host+",")
siteURL = tester.M365SiteURL(t) siteURL = tconfig.M365SiteURL(t)
modifiedSiteURL = siteURL + "foo" modifiedSiteURL = siteURL + "foo"
) )

View File

@ -11,6 +11,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api"
) )
@ -124,7 +125,7 @@ func TestUsersIntgSuite(t *testing.T) {
suite.Run(t, &UsersIntgSuite{ suite.Run(t, &UsersIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }

View File

@ -16,6 +16,7 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/credentials" "github.com/alcionai/corso/src/pkg/credentials"
"github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/fault"
@ -31,7 +32,7 @@ func TestM365IntegrationSuite(t *testing.T) {
suite.Run(t, &M365IntegrationSuite{ suite.Run(t, &M365IntegrationSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -50,7 +51,7 @@ func (suite *M365IntegrationSuite) TestUsers() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
acct := tester.NewM365Account(suite.T()) acct := tconfig.NewM365Account(suite.T())
users, err := Users(ctx, acct, fault.New(true)) users, err := Users(ctx, acct, fault.New(true))
assert.NoError(t, err, clues.ToCore(err)) assert.NoError(t, err, clues.ToCore(err))
@ -74,7 +75,7 @@ func (suite *M365IntegrationSuite) TestUsersCompat_HasNoInfo() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
acct := tester.NewM365Account(suite.T()) acct := tconfig.NewM365Account(suite.T())
users, err := UsersCompatNoInfo(ctx, acct) users, err := UsersCompatNoInfo(ctx, acct)
assert.NoError(t, err, clues.ToCore(err)) assert.NoError(t, err, clues.ToCore(err))
@ -98,8 +99,8 @@ func (suite *M365IntegrationSuite) TestUserHasMailbox() {
defer flush() defer flush()
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
uid = tester.M365UserID(t) uid = tconfig.M365UserID(t)
) )
enabled, err := UserHasMailbox(ctx, acct, uid) enabled, err := UserHasMailbox(ctx, acct, uid)
@ -114,8 +115,8 @@ func (suite *M365IntegrationSuite) TestUserHasDrive() {
defer flush() defer flush()
var ( var (
acct = tester.NewM365Account(t) acct = tconfig.NewM365Account(t)
uid = tester.M365UserID(t) uid = tconfig.M365UserID(t)
) )
enabled, err := UserHasDrives(ctx, acct, uid) enabled, err := UserHasDrives(ctx, acct, uid)
@ -129,7 +130,7 @@ func (suite *M365IntegrationSuite) TestSites() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
acct := tester.NewM365Account(t) acct := tconfig.NewM365Account(t)
sites, err := Sites(ctx, acct, fault.New(true)) sites, err := Sites(ctx, acct, fault.New(true))
assert.NoError(t, err, clues.ToCore(err)) assert.NoError(t, err, clues.ToCore(err))
@ -355,7 +356,7 @@ func TestDiscoveryIntgSuite(t *testing.T) {
suite.Run(t, &DiscoveryIntgSuite{ suite.Run(t, &DiscoveryIntgSuite{
Suite: tester.NewIntegrationSuite( Suite: tester.NewIntegrationSuite(
t, t,
[][]string{tester.M365AcctCredEnvs}), [][]string{tconfig.M365AcctCredEnvs}),
}) })
} }
@ -367,7 +368,7 @@ func (suite *DiscoveryIntgSuite) SetupSuite() {
graph.InitializeConcurrencyLimiter(ctx, true, 4) graph.InitializeConcurrencyLimiter(ctx, true, 4)
suite.acct = tester.NewM365Account(t) suite.acct = tconfig.NewM365Account(t)
} }
func (suite *DiscoveryIntgSuite) TestUsers() { func (suite *DiscoveryIntgSuite) TestUsers() {
@ -482,7 +483,7 @@ func (suite *DiscoveryIntgSuite) TestGetUserInfo() {
}{ }{
{ {
name: "standard test user", name: "standard test user",
user: tester.M365UserID(suite.T()), user: tconfig.M365UserID(suite.T()),
expect: &api.UserInfo{ expect: &api.UserInfo{
ServicesEnabled: map[path.ServiceType]struct{}{ ServicesEnabled: map[path.ServiceType]struct{}{
path.ExchangeService: {}, path.ExchangeService: {},
@ -527,7 +528,7 @@ func (suite *DiscoveryIntgSuite) TestGetUserInfo() {
} }
func (suite *DiscoveryIntgSuite) TestGetUserInfo_userWithoutDrive() { func (suite *DiscoveryIntgSuite) TestGetUserInfo_userWithoutDrive() {
userID := tester.M365UserID(suite.T()) userID := tconfig.M365UserID(suite.T())
table := []struct { table := []struct {
name string name string

View File

@ -1,4 +1,4 @@
package tester package testdata
import ( import (
"os" "os"
@ -9,6 +9,8 @@ import (
"github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/cli/flags"
"github.com/alcionai/corso/src/internal/common/str" "github.com/alcionai/corso/src/internal/common/str"
"github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/credentials" "github.com/alcionai/corso/src/pkg/credentials"
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
) )
@ -28,18 +30,18 @@ var AWSStorageCredEnvs = []string{
// test. Suites that need to identify this value can retrieve it again from the common // test. Suites that need to identify this value can retrieve it again from the common
// configs. // configs.
func NewPrefixedS3Storage(t *testing.T) storage.Storage { func NewPrefixedS3Storage(t *testing.T) storage.Storage {
now := LogTimeOfTest(t) now := tester.LogTimeOfTest(t)
cfg, err := readTestConfig() cfg, err := tconfig.ReadTestConfig()
require.NoError(t, err, "configuring storage from test file", clues.ToCore(err)) require.NoError(t, err, "configuring storage from test file", clues.ToCore(err))
prefix := testRepoRootPrefix + t.Name() + "-" + now prefix := testRepoRootPrefix + t.Name() + "-" + now
t.Logf("testing at s3 bucket [%s] prefix [%s]", cfg[TestCfgBucket], prefix) t.Logf("testing at s3 bucket [%s] prefix [%s]", cfg[tconfig.TestCfgBucket], prefix)
st, err := storage.NewStorage( st, err := storage.NewStorage(
storage.ProviderS3, storage.ProviderS3,
storage.S3Config{ storage.S3Config{
Bucket: cfg[TestCfgBucket], Bucket: cfg[tconfig.TestCfgBucket],
Prefix: prefix, Prefix: prefix,
}, },
storage.CommonConfig{ storage.CommonConfig{