From 9a6edab35322c4f84f7597c5fbbd5dcced247ad3 Mon Sep 17 00:00:00 2001 From: HiteshRepo Date: Wed, 31 Jan 2024 15:56:44 +0530 Subject: [PATCH] check if w/o file creation test gets cached --- .../test/m365/exchange/exchange_test.go | 214 +++++++++--------- 1 file changed, 108 insertions(+), 106 deletions(-) diff --git a/src/internal/operations/test/m365/exchange/exchange_test.go b/src/internal/operations/test/m365/exchange/exchange_test.go index ce9c901da..c9e8547b2 100644 --- a/src/internal/operations/test/m365/exchange/exchange_test.go +++ b/src/internal/operations/test/m365/exchange/exchange_test.go @@ -114,122 +114,124 @@ func (suite *ExchangeBackupIntgSuite) TestBackup_Run_exchange() { suite.Run(test.name, func() { t := suite.T() - ctx, flush := tester.NewContext(t) - defer flush() + assert.NotEmpty(t, test.name) - var ( - mb = evmock.NewBus() - counter = count.New() - sel = test.selector().Selector - opts = control.DefaultOptions() - whatSet = deeTD.CategoryFromRepoRef - ) + // ctx, flush := tester.NewContext(t) + // defer flush() - bo, bod := PrepNewTestBackupOp(t, ctx, mb, sel, opts, version.Backup, counter) - defer bod.Close(t, ctx) + // var ( + // mb = evmock.NewBus() + // counter = count.New() + // sel = test.selector().Selector + // opts = control.DefaultOptions() + // whatSet = deeTD.CategoryFromRepoRef + // ) - sel = bod.Sel + // bo, bod := PrepNewTestBackupOp(t, ctx, mb, sel, opts, version.Backup, counter) + // defer bod.Close(t, ctx) - userID := sel.ID() + // sel = bod.Sel - m365, err := bod.Acct.M365Config() - require.NoError(t, err, clues.ToCore(err)) + // userID := sel.ID() - // run the tests - RunAndCheckBackup(t, ctx, &bo, mb, false) - CheckBackupIsInManifests( - t, - ctx, - bod.KW, - bod.SW, - &bo, - sel, - userID, - test.category) - CheckMetadataFilesExist( - t, - ctx, - bo.Results.BackupID, - bod.KW, - bod.KMS, - m365.AzureTenantID, - userID, - path.ExchangeService, - map[path.CategoryType][][]string{test.category: test.metadataFiles}) + // m365, err := bod.Acct.M365Config() + // require.NoError(t, err, clues.ToCore(err)) - _, expectDeets := deeTD.GetDeetsInBackup( - t, - ctx, - bo.Results.BackupID, - bod.Acct.ID(), - userID, - path.ExchangeService, - whatSet, - bod.KMS, - bod.SSS) - deeTD.CheckBackupDetails( - t, - ctx, - bo.Results.BackupID, - whatSet, - bod.KMS, - bod.SSS, - expectDeets, - false) + // // run the tests + // RunAndCheckBackup(t, ctx, &bo, mb, false) + // CheckBackupIsInManifests( + // t, + // ctx, + // bod.KW, + // bod.SW, + // &bo, + // sel, + // userID, + // test.category) + // CheckMetadataFilesExist( + // t, + // ctx, + // bo.Results.BackupID, + // bod.KW, + // bod.KMS, + // m365.AzureTenantID, + // userID, + // path.ExchangeService, + // map[path.CategoryType][][]string{test.category: test.metadataFiles}) - // Basic, happy path incremental test. No changes are dictated or expected. - // This only tests that an incremental backup is runnable at all, and that it - // produces fewer results than the last backup. - var ( - incMB = evmock.NewBus() - incBO = NewTestBackupOp( - t, - ctx, - bod, - incMB, - opts, - counter) - ) + // _, expectDeets := deeTD.GetDeetsInBackup( + // t, + // ctx, + // bo.Results.BackupID, + // bod.Acct.ID(), + // userID, + // path.ExchangeService, + // whatSet, + // bod.KMS, + // bod.SSS) + // deeTD.CheckBackupDetails( + // t, + // ctx, + // bo.Results.BackupID, + // whatSet, + // bod.KMS, + // bod.SSS, + // expectDeets, + // false) - RunAndCheckBackup(t, ctx, &incBO, incMB, true) - CheckBackupIsInManifests( - t, - ctx, - bod.KW, - bod.SW, - &incBO, - sel, - userID, - test.category) - CheckMetadataFilesExist( - t, - ctx, - incBO.Results.BackupID, - bod.KW, - bod.KMS, - m365.AzureTenantID, - userID, - path.ExchangeService, - map[path.CategoryType][][]string{test.category: test.metadataFiles}) - deeTD.CheckBackupDetails( - t, - ctx, - incBO.Results.BackupID, - whatSet, - bod.KMS, - bod.SSS, - expectDeets, - false) + // // Basic, happy path incremental test. No changes are dictated or expected. + // // This only tests that an incremental backup is runnable at all, and that it + // // produces fewer results than the last backup. + // var ( + // incMB = evmock.NewBus() + // incBO = NewTestBackupOp( + // t, + // ctx, + // bod, + // incMB, + // opts, + // counter) + // ) - // do some additional checks to ensure the incremental dealt with fewer items. - assert.Greater(t, bo.Results.ItemsWritten, incBO.Results.ItemsWritten, "incremental items written") - assert.Greater(t, bo.Results.ItemsRead, incBO.Results.ItemsRead, "incremental items read") - assert.Greater(t, bo.Results.BytesRead, incBO.Results.BytesRead, "incremental bytes read") - assert.Greater(t, bo.Results.BytesUploaded, incBO.Results.BytesUploaded, "incremental bytes uploaded") - assert.Equal(t, bo.Results.ResourceOwners, incBO.Results.ResourceOwners, "incremental backup resource owner") - assert.NoError(t, incBO.Errors.Failure(), "incremental non-recoverable error", clues.ToCore(bo.Errors.Failure())) - assert.Empty(t, incBO.Errors.Recovered(), "count incremental recoverable/iteration errors") - assert.Equal(t, 1, incMB.TimesCalled[events.BackupEnd], "incremental backup-end events") + // RunAndCheckBackup(t, ctx, &incBO, incMB, true) + // CheckBackupIsInManifests( + // t, + // ctx, + // bod.KW, + // bod.SW, + // &incBO, + // sel, + // userID, + // test.category) + // CheckMetadataFilesExist( + // t, + // ctx, + // incBO.Results.BackupID, + // bod.KW, + // bod.KMS, + // m365.AzureTenantID, + // userID, + // path.ExchangeService, + // map[path.CategoryType][][]string{test.category: test.metadataFiles}) + // deeTD.CheckBackupDetails( + // t, + // ctx, + // incBO.Results.BackupID, + // whatSet, + // bod.KMS, + // bod.SSS, + // expectDeets, + // false) + + // // do some additional checks to ensure the incremental dealt with fewer items. + // assert.Greater(t, bo.Results.ItemsWritten, incBO.Results.ItemsWritten, "incremental items written") + // assert.Greater(t, bo.Results.ItemsRead, incBO.Results.ItemsRead, "incremental items read") + // assert.Greater(t, bo.Results.BytesRead, incBO.Results.BytesRead, "incremental bytes read") + // assert.Greater(t, bo.Results.BytesUploaded, incBO.Results.BytesUploaded, "incremental bytes uploaded") + // assert.Equal(t, bo.Results.ResourceOwners, incBO.Results.ResourceOwners, "incremental backup resource owner") + // assert.NoError(t, incBO.Errors.Failure(), "incremental non-recoverable error", clues.ToCore(bo.Errors.Failure())) + // assert.Empty(t, incBO.Errors.Recovered(), "count incremental recoverable/iteration errors") + // assert.Equal(t, 1, incMB.TimesCalled[events.BackupEnd], "incremental backup-end events") }) } }