Skip to content

Commit

Permalink
[Event Hubs] Live test fixes (#32005)
Browse files Browse the repository at this point in the history
The focus of these changes is to make tests more deterministic and
resilient to the service returning duplicates, which should be expected
behavior.

Previously, tests use the count of events read as the condition to signal
that reading should cease and validation begin.  When duplicates were
present, this caused some expected events to not appear in the final set
being validated.

The approach for validating reads from enqueue time were also adjusted to
account for clock skew and a starting point that may not be precise, where
the service begins reading a bit earlier than expected, which would also
cause additional events to be read and throw off validation.
  • Loading branch information
jsquire authored Oct 25, 2022
1 parent 0338d9f commit cc6ca5b
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ public static IEnumerable<EventData> CreateSmallEvents(int numberOfEvents)
///
public static EventData CreateEventFromBody(ReadOnlyMemory<byte> eventBody)
{
var currentEvent = new EventData(eventBody);
currentEvent.Properties.Add(IdPropertyName, Guid.NewGuid().ToString());
var id = Guid.NewGuid().ToString();

return currentEvent;
return new EventData(eventBody)
{
MessageId = id,
Properties = {{ IdPropertyName, id }}
};
}

/// <summary>
Expand Down
Loading

0 comments on commit cc6ca5b

Please sign in to comment.