Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Hubs Client] Track Two (Test Stability) #9188

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

jsquire
Copy link
Member

@jsquire jsquire commented Dec 18, 2019

Summary

The focus of these changes is to tweak some of the timings and loosen some assumptions around the non-deterministic areas of the tests to offer better stability in the nightly runs, where there is a higher resource contention and timing tends to vary more than with local runs.

Last Upstream Rebase

Wednesday, December 18, 3:39pm (EST)

Related and Follow-Up Issues

The focus of these changes is to tweak some of the timings and loosen some
assumptions around the non-deterministic areas of the tests to offer better
stability in the nightly runs, where there is a higher resource contention and
timing tends to vary more than with local runs.
@jsquire jsquire added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Dec 18, 2019
@jsquire jsquire added this to the [2020] January milestone Dec 18, 2019
@jsquire jsquire self-assigned this Dec 18, 2019
@@ -2140,7 +2139,7 @@ await using (var connection = new EventHubConnection(connectionString))

await using (var invalidProxyConsumer = new EventHubConsumerClient(EventHubConsumerClient.DefaultConsumerGroupName, connectionString, options))
{
var readOptions = new ReadEventOptions { MaximumWaitTime = TimeSpan.FromMilliseconds(250) };
var readOptions = new ReadEventOptions { MaximumWaitTime = null };
Copy link
Member Author

@jsquire jsquire Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior on Linux and macOS is different for this scenario than it is on Windows. They do not immediately terminate with a web socket exception, but continue to attempt to connect until the timeout is exhausted. The previous setting was causing the test to terminate before the timeout period. Since it is not important that the read pulls events, setting no wait time and allowing it to block until the timeout period for connections (60 seconds) expires correctly executes on all platforms.

Note that the cancellation token continues to prevent stalling by allowing for twice the connection timeout, just in case.

Copy link
Member

@kinelski kinelski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -69,6 +69,7 @@ public void ReadLastEnqueuedEventPropertiesDelegatesToTheConsumer()
Assert.That(information.Offset, Is.EqualTo(lastEvent.LastPartitionOffset), "The offset should match.");
Assert.That(information.EnqueuedTime, Is.EqualTo(lastEvent.LastPartitionEnqueuedTime), "The last enqueue time should match.");
Assert.That(information.LastReceivedTime, Is.EqualTo(lastEvent.LastPartitionPropertiesRetrievalTime), "The retrieval time should match.");
Assert.That(mockConsumer.IsClosed, Is.False, "The consumer should not have been closed or disposed of.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to assert that? It doesn't feel like something we should worry about in this scenario.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was previously a difficult-to-detect issue where garbage collection was kicking in and the test was failing when the run was slow. Adding this check here is mostly unnecessary other than it offers an active reference to the variable, preventing the compiler from optimizing such that it may be collected.

I had originally left a comment with some silly does-nothing property access outside of an assert, but that looked and felt odd.


foreach (var receivedMessage in receivedEvents.Where(item => item != null).Select(item => Encoding.UTF8.GetString(item.Body.ToArray())))
{
Assert.That(sourceEventMessages.Contains(receivedMessage), $"The message: { receivedEvents } was not in the source set or has appeared more than oncesss.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: oncesss => once

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to take a note and defer this in order to avoid pushing just this change.

@jsquire jsquire merged commit f3ef017 into Azure:master Dec 19, 2019
@jsquire jsquire deleted the eventhubs/test-stability branch December 19, 2019 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants