From c4f6ad791e64bfc85629a06c52c45e2eb3588166 Mon Sep 17 00:00:00 2001 From: Keepers Date: Mon, 2 Oct 2023 14:44:33 -0600 Subject: [PATCH] provide expected repo cfg in e2e tests (#4420) nightly tests were missing expected repo config due to, breaking api expectations, causing unexpected failures due to test env setup. --- #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :bug: Bugfix - [x] :robot: Supportability/Tests #### Test Plan - [x] :green_heart: E2E --- src/cli/backup/exchange_e2e_test.go | 8 ++++---- src/cli/backup/groups_e2e_test.go | 8 ++++---- src/cli/backup/helpers_test.go | 6 +++++- src/cli/backup/onedrive_e2e_test.go | 5 +++-- src/cli/backup/sharepoint_e2e_test.go | 5 +++-- src/cli/repo/filesystem_e2e_test.go | 2 +- src/cli/repo/s3_e2e_test.go | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/cli/backup/exchange_e2e_test.go b/src/cli/backup/exchange_e2e_test.go index 2175a50e6..0807addc6 100644 --- a/src/cli/backup/exchange_e2e_test.go +++ b/src/cli/backup/exchange_e2e_test.go @@ -55,7 +55,7 @@ func (suite *NoBackupExchangeE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.ExchangeService) } func (suite *NoBackupExchangeE2ESuite) TestExchangeBackupListCmd_noBackups() { @@ -109,7 +109,7 @@ func (suite *BackupExchangeE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.ExchangeService) } func (suite *BackupExchangeE2ESuite) TestExchangeBackupCmd_email() { @@ -336,7 +336,7 @@ func (suite *PreparedBackupExchangeE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.ExchangeService) suite.backupOps = make(map[path.CategoryType]string) var ( @@ -579,7 +579,7 @@ func (suite *BackupDeleteExchangeE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.ExchangeService) m365UserID := tconfig.M365UserID(t) users := []string{m365UserID} diff --git a/src/cli/backup/groups_e2e_test.go b/src/cli/backup/groups_e2e_test.go index 986979a4f..87ef93d2b 100644 --- a/src/cli/backup/groups_e2e_test.go +++ b/src/cli/backup/groups_e2e_test.go @@ -56,7 +56,7 @@ func (suite *NoBackupGroupsE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.GroupsService) } func (suite *NoBackupGroupsE2ESuite) TestGroupsBackupListCmd_noBackups() { @@ -110,7 +110,7 @@ func (suite *BackupGroupsE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.GroupsService) } func (suite *BackupGroupsE2ESuite) TestGroupsBackupCmd_channelMessages() { @@ -287,7 +287,7 @@ func (suite *PreparedBackupGroupsE2ESuite) SetupSuite() { defer flush() suite.its = newIntegrationTesterSetup(t) - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.GroupsService) suite.backupOps = make(map[path.CategoryType]string) var ( @@ -515,7 +515,7 @@ func (suite *BackupDeleteGroupsE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.GroupsService) m365GroupID := tconfig.M365GroupID(t) groups := []string{m365GroupID} diff --git a/src/cli/backup/helpers_test.go b/src/cli/backup/helpers_test.go index 14486f703..e3023f834 100644 --- a/src/cli/backup/helpers_test.go +++ b/src/cli/backup/helpers_test.go @@ -21,6 +21,7 @@ import ( "github.com/alcionai/corso/src/internal/tester/tconfig" "github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/control" + "github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/repository" "github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/alcionai/corso/src/pkg/services/m365/api/mock" @@ -132,6 +133,7 @@ type dependencies struct { func prepM365Test( t *testing.T, ctx context.Context, //revive:disable-line:context-as-argument + pst path.ServiceType, ) dependencies { var ( acct = tconfig.NewM365Account(t) @@ -159,7 +161,9 @@ func prepM365Test( repository.NewRepoID) require.NoError(t, err, clues.ToCore(err)) - err = repo.Initialize(ctx, repository.InitConfig{}) + err = repo.Initialize(ctx, repository.InitConfig{ + Service: pst, + }) require.NoError(t, err, clues.ToCore(err)) return dependencies{ diff --git a/src/cli/backup/onedrive_e2e_test.go b/src/cli/backup/onedrive_e2e_test.go index f4b2c0bdc..a2bac18b6 100644 --- a/src/cli/backup/onedrive_e2e_test.go +++ b/src/cli/backup/onedrive_e2e_test.go @@ -20,6 +20,7 @@ import ( "github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig" + "github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/selectors" selTD "github.com/alcionai/corso/src/pkg/selectors/testdata" storeTD "github.com/alcionai/corso/src/pkg/storage/testdata" @@ -48,7 +49,7 @@ func (suite *NoBackupOneDriveE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.OneDriveService) } func (suite *NoBackupOneDriveE2ESuite) TestOneDriveBackupListCmd_empty() { @@ -139,7 +140,7 @@ func (suite *BackupDeleteOneDriveE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.OneDriveService) var ( m365UserID = tconfig.M365UserID(t) diff --git a/src/cli/backup/sharepoint_e2e_test.go b/src/cli/backup/sharepoint_e2e_test.go index bfb67f85a..7d7728020 100644 --- a/src/cli/backup/sharepoint_e2e_test.go +++ b/src/cli/backup/sharepoint_e2e_test.go @@ -20,6 +20,7 @@ import ( "github.com/alcionai/corso/src/internal/operations" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig" + "github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/selectors" "github.com/alcionai/corso/src/pkg/selectors/testdata" storeTD "github.com/alcionai/corso/src/pkg/storage/testdata" @@ -46,7 +47,7 @@ func (suite *NoBackupSharePointE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.SharePointService) } func (suite *NoBackupSharePointE2ESuite) TestSharePointBackupListCmd_empty() { @@ -103,7 +104,7 @@ func (suite *BackupDeleteSharePointE2ESuite) SetupSuite() { ctx, flush := tester.NewContext(t) defer flush() - suite.dpnd = prepM365Test(t, ctx) + suite.dpnd = prepM365Test(t, ctx, path.SharePointService) var ( m365SiteID = tconfig.M365SiteID(t) diff --git a/src/cli/repo/filesystem_e2e_test.go b/src/cli/repo/filesystem_e2e_test.go index 6a76e3fa8..faeb5a5b1 100644 --- a/src/cli/repo/filesystem_e2e_test.go +++ b/src/cli/repo/filesystem_e2e_test.go @@ -131,7 +131,7 @@ func (suite *FilesystemE2ESuite) TestConnectFilesystemCmd() { // init the repo first r, err := repository.New( ctx, - account.Account{}, + tconfig.NewM365Account(t), st, control.DefaultOptions(), repository.NewRepoID) diff --git a/src/cli/repo/s3_e2e_test.go b/src/cli/repo/s3_e2e_test.go index e1d65c4f3..2c19b48c8 100644 --- a/src/cli/repo/s3_e2e_test.go +++ b/src/cli/repo/s3_e2e_test.go @@ -207,7 +207,7 @@ func (suite *S3E2ESuite) TestConnectS3Cmd() { // init the repo first r, err := repository.New( ctx, - account.Account{}, + tconfig.NewM365Account(t), st, control.DefaultOptions(), repository.NewRepoID)