quick test for tags

This commit is contained in:
ryanfkeepers 2023-04-11 14:59:55 -06:00
parent 30b86f664e
commit dceb5f9506

View File

@ -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, nil, reasons, fallbackReasons,
test.inputMan, test.inputMan,
nil, nil,
nil, nil,