From 315e26a04dd6495b2ac4c2c8ea7252e8fe8930ba Mon Sep 17 00:00:00 2001 From: Jacob Lauzon <96087589+jalauzon-msft@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:59:28 -0800 Subject: [PATCH] [Storage][DataMovenet] Minor fixes to pause/resume tests (#40004) --- .../tests/PauseResumeTransferTests.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs index ea599c1b3b4f0..26d2b7dd785c4 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs @@ -993,9 +993,13 @@ public async Task PauseThenResumeTransferAsync_Directory(TransferDirection trans // Assert - Confirm we've paused Assert.AreEqual(DataTransferState.Paused, transfer.TransferStatus.State); await testEventsRaised.AssertPausedCheck(); + int completedBeforePause = testEventsRaised.SingleCompletedEvents.Count; // Act - Resume Job - DataTransferOptions resumeOptions = new DataTransferOptions(); + DataTransferOptions resumeOptions = new() + { + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists + }; TestEventsRaised testEventRaised2 = new TestEventsRaised(resumeOptions); DataTransfer resumeTransfer = await transferManager.ResumeTransferAsync( transferId: transfer.Id, @@ -1005,7 +1009,7 @@ public async Task PauseThenResumeTransferAsync_Directory(TransferDirection trans await resumeTransfer.WaitForCompletionAsync(waitTransferCompletion.Token); // Assert - await testEventRaised2.AssertContainerCompletedCheck(partCount); + await testEventRaised2.AssertContainerCompletedCheck(partCount - completedBeforePause); Assert.AreEqual(DataTransferState.Completed, resumeTransfer.TransferStatus.State); Assert.IsTrue(resumeTransfer.HasCompleted); @@ -1072,9 +1076,13 @@ public async Task ResumeTransferAsync_Directory(TransferDirection transferType) // Assert - Confirm we've paused Assert.AreEqual(DataTransferState.Paused, transfer.TransferStatus.State); await testEventsRaised.AssertPausedCheck(); + int completedBeforePause = testEventsRaised.SingleCompletedEvents.Count; // Act - Resume Job - DataTransferOptions resumeOptions = new(); + DataTransferOptions resumeOptions = new() + { + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists + }; TestEventsRaised testEventsRaised2 = new TestEventsRaised(resumeOptions); DataTransfer resumeTransfer = await transferManager.ResumeTransferAsync( transfer.Id, @@ -1084,7 +1092,7 @@ public async Task ResumeTransferAsync_Directory(TransferDirection transferType) await resumeTransfer.WaitForCompletionAsync(waitTransferCompletion.Token); // Assert - await testEventsRaised2.AssertContainerCompletedCheck(partCount); + await testEventsRaised2.AssertContainerCompletedCheck(partCount - completedBeforePause); Assert.AreEqual(DataTransferState.Completed, resumeTransfer.TransferStatus.State); Assert.IsTrue(resumeTransfer.HasCompleted);