From eb357e105159434d00e772fc8ce4e6f2f8572b29 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Mon, 18 Sep 2023 19:21:43 +0530 Subject: [PATCH] Move MetadataFileNames to test file (#4279) This is not used in live code and so moving to tests. Ref: https://github.com/alcionai/corso/pull/4248/files#r1326490460 --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [x] :broom: Tech Debt/Cleanup #### Issue(s) * # #### Test Plan - [ ] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .../m365/collection/exchange/metadata.go | 12 ----------- src/internal/operations/test/exchange_test.go | 20 +++++++++++++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/internal/m365/collection/exchange/metadata.go b/src/internal/m365/collection/exchange/metadata.go index 569573a6e..e6ec64f84 100644 --- a/src/internal/m365/collection/exchange/metadata.go +++ b/src/internal/m365/collection/exchange/metadata.go @@ -13,18 +13,6 @@ import ( "github.com/alcionai/corso/src/pkg/path" ) -// MetadataFileNames produces the category-specific set of filenames used to -// store graph metadata such as delta tokens and folderID->path references. -func MetadataFileNames(cat path.CategoryType) [][]string { - switch cat { - // TODO: should this include events? - case path.EmailCategory, path.ContactsCategory: - return [][]string{{metadata.DeltaURLsFileName}, {metadata.PreviousPathFileName}} - default: - return [][]string{{metadata.PreviousPathFileName}} - } -} - // ParseMetadataCollections produces a map of structs holding delta // and path lookup maps. func ParseMetadataCollections( diff --git a/src/internal/operations/test/exchange_test.go b/src/internal/operations/test/exchange_test.go index 070bd33ae..5143103fb 100644 --- a/src/internal/operations/test/exchange_test.go +++ b/src/internal/operations/test/exchange_test.go @@ -18,7 +18,6 @@ import ( "github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/events" evmock "github.com/alcionai/corso/src/internal/events/mock" - "github.com/alcionai/corso/src/internal/m365/collection/exchange" "github.com/alcionai/corso/src/internal/m365/graph" exchMock "github.com/alcionai/corso/src/internal/m365/service/exchange/mock" exchTD "github.com/alcionai/corso/src/internal/m365/service/exchange/testdata" @@ -27,6 +26,7 @@ import ( "github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/pkg/backup/details" deeTD "github.com/alcionai/corso/src/pkg/backup/details/testdata" + "github.com/alcionai/corso/src/pkg/backup/metadata" "github.com/alcionai/corso/src/pkg/control" ctrlTD "github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/count" @@ -54,6 +54,18 @@ func (suite *ExchangeBackupIntgSuite) SetupSuite() { suite.its = newIntegrationTesterSetup(suite.T()) } +// MetadataFileNames produces the category-specific set of filenames used to +// store graph metadata such as delta tokens and folderID->path references. +func MetadataFileNames(cat path.CategoryType) [][]string { + switch cat { + // TODO: should this include events? + case path.EmailCategory, path.ContactsCategory: + return [][]string{{metadata.DeltaURLsFileName}, {metadata.PreviousPathFileName}} + default: + return [][]string{{metadata.PreviousPathFileName}} + } +} + // TestBackup_Run ensures that Integration Testing works // for the following scopes: Contacts, Events, and Mail func (suite *ExchangeBackupIntgSuite) TestBackup_Run_exchange() { @@ -93,7 +105,7 @@ func (suite *ExchangeBackupIntgSuite) TestBackup_Run_exchange() { return sel }, category: path.EventsCategory, - metadataFiles: exchange.MetadataFileNames(path.EventsCategory), + metadataFiles: MetadataFileNames(path.EventsCategory), }, } for _, test := range tests { @@ -244,8 +256,8 @@ func testExchangeContinuousBackups(suite *ExchangeBackupIntgSuite, toggles contr now = dttm.Now() service = path.ExchangeService categories = map[path.CategoryType][][]string{ - path.EmailCategory: exchange.MetadataFileNames(path.EmailCategory), - path.ContactsCategory: exchange.MetadataFileNames(path.ContactsCategory), + path.EmailCategory: MetadataFileNames(path.EmailCategory), + path.ContactsCategory: MetadataFileNames(path.ContactsCategory), // path.EventsCategory: exchange.MetadataFileNames(path.EventsCategory), } container1 = fmt.Sprintf("%s%d_%s", incrementalsDestContainerPrefix, 1, now)