Compare commits
2 Commits
main
...
2825-9-bui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dceb5f9506 | ||
|
|
30b86f664e |
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/common/crash"
|
"github.com/alcionai/corso/src/internal/common/crash"
|
||||||
@ -269,7 +270,7 @@ func (op *BackupOperation) do(
|
|||||||
ctx,
|
ctx,
|
||||||
op.kopia,
|
op.kopia,
|
||||||
op.account.ID(),
|
op.account.ID(),
|
||||||
reasons,
|
reasons, fallbackReasons,
|
||||||
mans,
|
mans,
|
||||||
cs,
|
cs,
|
||||||
excludes,
|
excludes,
|
||||||
@ -405,7 +406,7 @@ func consumeBackupCollections(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
bc inject.BackupConsumer,
|
bc inject.BackupConsumer,
|
||||||
tenantID string,
|
tenantID string,
|
||||||
reasons []kopia.Reason,
|
reasons, fallbackReasons []kopia.Reason,
|
||||||
mans []*kopia.ManifestEntry,
|
mans []*kopia.ManifestEntry,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
excludes map[string]map[string]struct{},
|
excludes map[string]map[string]struct{},
|
||||||
@ -425,7 +426,8 @@ func consumeBackupCollections(
|
|||||||
kopia.TagBackupCategory: "",
|
kopia.TagBackupCategory: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, reason := range reasons {
|
reunion := append(slices.Clone(reasons), fallbackReasons...)
|
||||||
|
for _, reason := range reunion {
|
||||||
for _, k := range reason.TagKeys() {
|
for _, k := range reason.TagKeys() {
|
||||||
tags[k] = ""
|
tags[k] = ""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -561,6 +561,15 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_ConsumeBackupDataCollections
|
|||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
|
expectTags := map[string]string{
|
||||||
|
"backup-id": "",
|
||||||
|
"bob": "",
|
||||||
|
"bobby": "",
|
||||||
|
"exchangecontacts": "",
|
||||||
|
"exchangeemail": "",
|
||||||
|
"is-canon-backup": "",
|
||||||
|
}
|
||||||
|
|
||||||
mbu := &mockBackupConsumer{
|
mbu := &mockBackupConsumer{
|
||||||
checkFunc: func(
|
checkFunc: func(
|
||||||
bases []kopia.IncrementalBase,
|
bases []kopia.IncrementalBase,
|
||||||
@ -568,16 +577,43 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_ConsumeBackupDataCollections
|
|||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
buildTreeWithBase bool,
|
buildTreeWithBase bool,
|
||||||
) {
|
) {
|
||||||
|
assert.Equal(t, expectTags, tags)
|
||||||
assert.ElementsMatch(t, test.expected, bases)
|
assert.ElementsMatch(t, test.expected, bases)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reasons := []kopia.Reason{
|
||||||
|
{
|
||||||
|
ResourceOwner: "bob",
|
||||||
|
Service: path.ExchangeService,
|
||||||
|
Category: path.EmailCategory,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ResourceOwner: "bobby",
|
||||||
|
Service: path.ExchangeService,
|
||||||
|
Category: path.EmailCategory,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fallbackReasons := []kopia.Reason{
|
||||||
|
{
|
||||||
|
ResourceOwner: "bob",
|
||||||
|
Service: path.ExchangeService,
|
||||||
|
Category: path.EmailCategory,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ResourceOwner: "bob",
|
||||||
|
Service: path.ExchangeService,
|
||||||
|
Category: path.ContactsCategory,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
//nolint:errcheck
|
//nolint:errcheck
|
||||||
consumeBackupCollections(
|
consumeBackupCollections(
|
||||||
ctx,
|
ctx,
|
||||||
mbu,
|
mbu,
|
||||||
tenant,
|
tenant,
|
||||||
nil,
|
reasons, fallbackReasons,
|
||||||
test.inputMan,
|
test.inputMan,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user