From 7677299ace2d4ca61b173453ade793c88b7b4a3e Mon Sep 17 00:00:00 2001 From: Keepers Date: Fri, 21 Jul 2023 16:19:13 -0600 Subject: [PATCH] use replace collisions for nightly tests (#3882) #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :robot: Supportability/Tests #### Issue(s) * #3562 #### Test Plan - [x] :zap: Unit test - [x] :green_heart: E2E --- .../actions/backup-restore-test/action.yml | 5 +++ src/internal/m365/controller_test.go | 3 +- src/internal/m365/onedrive_test.go | 31 ++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/actions/backup-restore-test/action.yml b/.github/actions/backup-restore-test/action.yml index 4e31ad836..2d161af63 100644 --- a/.github/actions/backup-restore-test/action.yml +++ b/.github/actions/backup-restore-test/action.yml @@ -24,6 +24,10 @@ inputs: log-dir: description: Folder to store test log files required: true + on-collision: + description: Value for the --collisions flag + requried: false + default: "replace" outputs: backup-id: @@ -57,6 +61,7 @@ runs: ./corso restore '${{ inputs.service }}' \ --no-stats \ --hide-progress \ + --collisions ${{ inputs.on-collision }} \ ${{ inputs.restore-args }} \ --backup '${{ steps.backup.outputs.result }}' \ 2>&1 | diff --git a/src/internal/m365/controller_test.go b/src/internal/m365/controller_test.go index ef729493b..487603b39 100644 --- a/src/internal/m365/controller_test.go +++ b/src/internal/m365/controller_test.go @@ -692,6 +692,7 @@ func runRestoreBackupTestVersions( tenant string, resourceOwners []string, opts control.Options, + crc control.RestoreConfig, ) { ctx, flush := tester.NewContext(t) defer flush() @@ -702,7 +703,7 @@ func runRestoreBackupTestVersions( Service: test.service, Tenant: tenant, ResourceOwners: resourceOwners, - RestoreCfg: testdata.DefaultRestoreConfig(""), + RestoreCfg: crc, } totalItems, _, collections, _, err := stub.GetCollectionsAndExpected( diff --git a/src/internal/m365/onedrive_test.go b/src/internal/m365/onedrive_test.go index 3fbd5f531..eade30c9d 100644 --- a/src/internal/m365/onedrive_test.go +++ b/src/internal/m365/onedrive_test.go @@ -22,6 +22,7 @@ import ( "github.com/alcionai/corso/src/internal/tester/tconfig" "github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/pkg/control" + "github.com/alcionai/corso/src/pkg/control/testdata" "github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/services/m365/api" ) @@ -516,6 +517,9 @@ func testRestoreAndBackupMultipleFilesAndFoldersNoPermissions( collectionsLatest: expected, } + rc := testdata.DefaultRestoreConfig("od_restore_and_backup_multi") + rc.OnCollision = control.Replace + runRestoreBackupTestVersions( t, testData, @@ -524,7 +528,8 @@ func testRestoreAndBackupMultipleFilesAndFoldersNoPermissions( control.Options{ RestorePermissions: true, ToggleFeatures: control.Toggles{}, - }) + }, + rc) }) } } @@ -763,6 +768,9 @@ func testPermissionsRestoreAndBackup(suite oneDriveSuite, startVersion int) { collectionsLatest: expected, } + rc := testdata.DefaultRestoreConfig("perms_restore_and_backup") + rc.OnCollision = control.Replace + runRestoreBackupTestVersions( t, testData, @@ -771,7 +779,8 @@ func testPermissionsRestoreAndBackup(suite oneDriveSuite, startVersion int) { control.Options{ RestorePermissions: true, ToggleFeatures: control.Toggles{}, - }) + }, + rc) }) } } @@ -851,6 +860,9 @@ func testPermissionsBackupAndNoRestore(suite oneDriveSuite, startVersion int) { collectionsLatest: expected, } + rc := testdata.DefaultRestoreConfig("perms_backup_no_restore") + rc.OnCollision = control.Replace + runRestoreBackupTestVersions( t, testData, @@ -859,7 +871,8 @@ func testPermissionsBackupAndNoRestore(suite oneDriveSuite, startVersion int) { control.Options{ RestorePermissions: false, ToggleFeatures: control.Toggles{}, - }) + }, + rc) }) } } @@ -1054,6 +1067,9 @@ func testPermissionsInheritanceRestoreAndBackup(suite oneDriveSuite, startVersio collectionsLatest: expected, } + rc := testdata.DefaultRestoreConfig("perms_inherit_restore_and_backup") + rc.OnCollision = control.Replace + runRestoreBackupTestVersions( t, testData, @@ -1062,7 +1078,8 @@ func testPermissionsInheritanceRestoreAndBackup(suite oneDriveSuite, startVersio control.Options{ RestorePermissions: true, ToggleFeatures: control.Toggles{}, - }) + }, + rc) }) } } @@ -1247,6 +1264,9 @@ func testLinkSharesInheritanceRestoreAndBackup(suite oneDriveSuite, startVersion collectionsLatest: expected, } + rc := testdata.DefaultRestoreConfig("linkshares_inherit_restore_and_backup") + rc.OnCollision = control.Replace + runRestoreBackupTestVersions( t, testData, @@ -1255,7 +1275,8 @@ func testLinkSharesInheritanceRestoreAndBackup(suite oneDriveSuite, startVersion control.Options{ RestorePermissions: true, ToggleFeatures: control.Toggles{}, - }) + }, + rc) }) } }