Fix no restore permissions/backup test (#2639)
Don't restore permissions like the test says --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) * closes #2638 #### Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
29c6ac4874
commit
d3e1ee8516
@ -196,7 +196,6 @@ type restoreBackupInfoMultiVersion struct {
|
|||||||
collectionsPrevious []colInfo
|
collectionsPrevious []colInfo
|
||||||
resource resource
|
resource resource
|
||||||
backupVersion int
|
backupVersion int
|
||||||
countMeta bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func attachmentEqual(
|
func attachmentEqual(
|
||||||
|
|||||||
@ -425,7 +425,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestRestoreAndBackup_Multip
|
|||||||
service: path.OneDriveService,
|
service: path.OneDriveService,
|
||||||
resource: Users,
|
resource: Users,
|
||||||
backupVersion: vn,
|
backupVersion: vn,
|
||||||
countMeta: vn == 0,
|
|
||||||
collectionsPrevious: input,
|
collectionsPrevious: input,
|
||||||
collectionsLatest: expected,
|
collectionsLatest: expected,
|
||||||
}
|
}
|
||||||
@ -626,7 +625,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndBa
|
|||||||
service: path.OneDriveService,
|
service: path.OneDriveService,
|
||||||
resource: Users,
|
resource: Users,
|
||||||
backupVersion: vn,
|
backupVersion: vn,
|
||||||
countMeta: vn == 0,
|
|
||||||
collectionsPrevious: input,
|
collectionsPrevious: input,
|
||||||
collectionsLatest: expected,
|
collectionsLatest: expected,
|
||||||
}
|
}
|
||||||
@ -646,8 +644,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndBa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ashmrtn): What this test is supposed to do needs investigated. It
|
|
||||||
// doesn't seem to do what it says.
|
|
||||||
func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsBackupAndNoRestore() {
|
func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsBackupAndNoRestore() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
@ -662,61 +658,70 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsBackupAndNoR
|
|||||||
|
|
||||||
startVersion := version.OneDrive1DataAndMetaFiles
|
startVersion := version.OneDrive1DataAndMetaFiles
|
||||||
|
|
||||||
table := []onedriveTest{
|
inputCols := []onedriveColInfo{
|
||||||
{
|
{
|
||||||
startVersion: startVersion,
|
pathElements: []string{
|
||||||
cols: []onedriveColInfo{
|
"drives",
|
||||||
|
driveID,
|
||||||
|
"root:",
|
||||||
|
},
|
||||||
|
files: []itemData{
|
||||||
{
|
{
|
||||||
pathElements: []string{
|
name: fileName,
|
||||||
"drives",
|
data: fileAData,
|
||||||
driveID,
|
perms: permData{
|
||||||
"root:",
|
user: suite.secondaryUser,
|
||||||
},
|
roles: writePerm,
|
||||||
files: []itemData{
|
|
||||||
{
|
|
||||||
name: fileName,
|
|
||||||
data: fileAData,
|
|
||||||
perms: permData{
|
|
||||||
user: suite.secondaryUser,
|
|
||||||
roles: writePerm,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range table {
|
expectedCols := []onedriveColInfo{
|
||||||
expected := testDataForInfo(suite.T(), test.cols, version.Backup)
|
{
|
||||||
|
pathElements: []string{
|
||||||
|
"drives",
|
||||||
|
driveID,
|
||||||
|
"root:",
|
||||||
|
},
|
||||||
|
files: []itemData{
|
||||||
|
{
|
||||||
|
// No permissions on the output since they weren't restored.
|
||||||
|
name: fileName,
|
||||||
|
data: fileAData,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for vn := test.startVersion; vn <= version.Backup; vn++ {
|
expected := testDataForInfo(suite.T(), expectedCols, version.Backup)
|
||||||
suite.Run(fmt.Sprintf("Version%d", vn), func() {
|
|
||||||
t := suite.T()
|
|
||||||
input := testDataForInfo(t, test.cols, vn)
|
|
||||||
|
|
||||||
testData := restoreBackupInfoMultiVersion{
|
for vn := startVersion; vn <= version.Backup; vn++ {
|
||||||
service: path.OneDriveService,
|
suite.Run(fmt.Sprintf("Version%d", vn), func() {
|
||||||
resource: Users,
|
t := suite.T()
|
||||||
backupVersion: vn,
|
input := testDataForInfo(t, inputCols, vn)
|
||||||
countMeta: vn == 0,
|
|
||||||
collectionsPrevious: input,
|
|
||||||
collectionsLatest: expected,
|
|
||||||
}
|
|
||||||
|
|
||||||
runRestoreBackupTestVersions(
|
testData := restoreBackupInfoMultiVersion{
|
||||||
t,
|
service: path.OneDriveService,
|
||||||
suite.acct,
|
resource: Users,
|
||||||
testData,
|
backupVersion: vn,
|
||||||
suite.connector.tenant,
|
collectionsPrevious: input,
|
||||||
[]string{suite.user},
|
collectionsLatest: expected,
|
||||||
control.Options{
|
}
|
||||||
RestorePermissions: true,
|
|
||||||
ToggleFeatures: control.Toggles{EnablePermissionsBackup: true},
|
runRestoreBackupTestVersions(
|
||||||
},
|
t,
|
||||||
)
|
suite.acct,
|
||||||
})
|
testData,
|
||||||
}
|
suite.connector.tenant,
|
||||||
|
[]string{suite.user},
|
||||||
|
control.Options{
|
||||||
|
RestorePermissions: false,
|
||||||
|
ToggleFeatures: control.Toggles{EnablePermissionsBackup: true},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +746,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndNo
|
|||||||
service: path.OneDriveService,
|
service: path.OneDriveService,
|
||||||
resource: Users,
|
resource: Users,
|
||||||
backupVersion: version.Backup,
|
backupVersion: version.Backup,
|
||||||
countMeta: false,
|
|
||||||
collectionsPrevious: []colInfo{
|
collectionsPrevious: []colInfo{
|
||||||
newOneDriveCollection(
|
newOneDriveCollection(
|
||||||
suite.T(),
|
suite.T(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user