Skip to content

Commit 37ee687

Browse files
authored
[Event Hubs Client] Event Processor and Blob Checkpoint Store Test Cleanup (#11004)
The focus of these changes is to address some deferred feedback provided for the `EventProcessorClient` and `BlobsCheckpointStore` tests. The maximum value for parallel execution of tests has also been lowered, as Azure is under heavier load than normal and we're seeing an elevated set of timeout failures during nightly runs.
1 parent cd3429f commit 37ee687

5 files changed

Lines changed: 159 additions & 328 deletions

File tree

sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Diagnostics/BlobEventStoreEventSource.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ internal BlobEventStoreEventSource() : base(EventSourceName, EventSourceSettings
4444
/// </summary>
4545
///
4646
/// <param name="accountName">The Storage account name corresponding to the associated container client.</param>
47-
/// <param name="name">The name of the associated container client.</param>
47+
/// <param name="containerName">The name of the associated container client.</param>
4848
///
4949
[Event(20, Level = EventLevel.Verbose, Message = "{0} created. AccountName: '{1}'; ContainerName: '{2}'.")]
5050
public virtual void BlobsCheckpointStoreCreated(string accountName,
51-
string name)
51+
string containerName)
5252
{
5353
if (IsEnabled())
5454
{
55-
WriteEvent(20, nameof(BlobsCheckpointStore), accountName ?? string.Empty, name ?? string.Empty);
55+
WriteEvent(20, nameof(BlobsCheckpointStore), accountName ?? string.Empty, containerName ?? string.Empty);
5656
}
5757
}
5858

sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Storage/BlobsCheckpointStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public override async Task<IEnumerable<EventProcessorPartitionOwnership>> ListOw
131131
}
132132
catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.ContainerNotFound)
133133
{
134-
Logger.ListOwnershipError(fullyQualifiedNamespace, eventHubName, consumerGroup, ex.ToString());
134+
Logger.ListOwnershipError(fullyQualifiedNamespace, eventHubName, consumerGroup, ex.Message);
135135
throw new RequestFailedException(Resources.BlobsResourceDoesNotExist);
136136
}
137137
finally

sdk/eventhub/Azure.Messaging.EventHubs.Processor/tests/CheckpointStore/BlobsCheckpointStoreTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ public void ListOwnershipLogsErrorOnException()
118118
var mockLog = new Mock<BlobEventStoreEventSource>();
119119
target.Logger = mockLog.Object;
120120

121-
Assert.ThrowsAsync<RequestFailedException>(async () => await target.ListOwnershipAsync(FullyQualifiedNamespace, EventHubName, ConsumerGroup, new CancellationToken()));
121+
Assert.That(async () => await target.ListOwnershipAsync(FullyQualifiedNamespace, EventHubName, ConsumerGroup, new CancellationToken()), Throws.InstanceOf<RequestFailedException>());
122122

123-
mockLog.Verify(m => m.ListOwnershipError(FullyQualifiedNamespace, EventHubName, ConsumerGroup, It.Is<string>(e => e.Contains("RequestFailedException"))));
123+
mockLog.Verify(m => m.ListOwnershipError(FullyQualifiedNamespace, EventHubName, ConsumerGroup, ex.Message));
124124
}
125125

126126
/// <summary>
@@ -311,7 +311,7 @@ public void ClaimOwnershipForMissingPartitionThrowsAndLogsOwnershipNotClaimable(
311311
var mockLog = new Mock<BlobEventStoreEventSource>();
312312
target.Logger = mockLog.Object;
313313

314-
Assert.ThrowsAsync<RequestFailedException>(async () => await target.ClaimOwnershipAsync(partitionOwnership, new CancellationToken()));
314+
Assert.That(async () => await target.ClaimOwnershipAsync(partitionOwnership, new CancellationToken()), Throws.InstanceOf<RequestFailedException>());
315315
}
316316

317317
/// <summary>
@@ -490,7 +490,7 @@ public void ListCheckpointsForMissingPartitionThrowsAndLogsOwnershipNotClaimable
490490
var mockLog = new Mock<BlobEventStoreEventSource>();
491491
target.Logger = mockLog.Object;
492492

493-
Assert.ThrowsAsync<RequestFailedException>(async () => await target.ListCheckpointsAsync(FullyQualifiedNamespace, EventHubName, ConsumerGroup, new CancellationToken()));
493+
Assert.That(async () => await target.ListCheckpointsAsync(FullyQualifiedNamespace, EventHubName, ConsumerGroup, new CancellationToken()), Throws.InstanceOf<RequestFailedException>());
494494
mockLog.Verify(m => m.ListCheckpointsError(FullyQualifiedNamespace, EventHubName, ConsumerGroup, ex.Message));
495495
}
496496

@@ -574,9 +574,9 @@ public void UpdateCheckpointForMissingCheckpointThrowsAndLogsCheckpointUpdateErr
574574
var mockLog = new Mock<BlobEventStoreEventSource>();
575575
target.Logger = mockLog.Object;
576576

577-
Assert.ThrowsAsync<RequestFailedException>(async () => await target.UpdateCheckpointAsync(checkpoint, new EventData(Array.Empty<byte>()), new CancellationToken()));
577+
Assert.That(async () => await target.UpdateCheckpointAsync(checkpoint, new EventData(Array.Empty<byte>()), new CancellationToken()), Throws.InstanceOf<RequestFailedException>());
578578

579-
mockLog.Verify(m => m.UpdateCheckpointError(PartitionId, FullyQualifiedNamespace, EventHubName, ConsumerGroup, It.Is<string>(s => s.Contains(BlobErrorCode.ContainerNotFound.ToString()))));
579+
mockLog.Verify(m => m.UpdateCheckpointError(PartitionId, FullyQualifiedNamespace, EventHubName, ConsumerGroup, ex.Message));
580580
}
581581

582582
/// <summary>

0 commit comments

Comments
 (0)