Skip to content

Conversation

@wfurt
Copy link
Member

@wfurt wfurt commented Oct 30, 2020

From the name of the test, I assume we are trying to verify that provided Expect100ContinueTimeout is respected e.g. we wait longer than default 1s.

Right now the test does it be measuring whole request/response and verifying duration within arbitrary time range.
With delay of 3s and fudge of 20 we expect everything to finish within 1 minute. From test failures are are sometimes over that - with max duration ~ 1:30 -1:40.

This PR is changing the test logic. Instead of measuring the whole duration, I measure delay between start and sending content e.g. call to SerializeToStreamAsync(). It should be at least expected delay - and could be more depending on system load and other environmental conditions. With default 1s, that should be sufficient verification that the delay actually works.

I originally used Stopwatch and I saw occasion failures when elapsed time would be slightly shorter e.g. 2995-2999.
I solved by using Environment.TickCount64 instead as it seems to use semi coarse base as Timer class.

fixes #41530
fixes #41953

@wfurt wfurt added area-System.Net.Http test-bug Problem in test source code (most likely) labels Oct 30, 2020
@wfurt wfurt requested a review from a team October 30, 2020 06:31
@wfurt wfurt self-assigned this Oct 30, 2020
@ghost
Copy link

ghost commented Oct 30, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@wfurt
Copy link
Member Author

wfurt commented Oct 31, 2020

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wfurt
Copy link
Member Author

wfurt commented Nov 3, 2020

all failures seems unrelated. running outer loop one more time to be sure.

@wfurt
Copy link
Member Author

wfurt commented Nov 3, 2020

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).


Assert.InRange(sw.Elapsed, delay - TimeSpan.FromSeconds(.5), delay * 20); // arbitrary wiggle room
long elapsed = content.Ticks - start;
Assert.True(elapsed >= delay.TotalMilliseconds);
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to have a small amount of leeway here in checking that elapsed >= delay, just in case of timing weirdness -- looks like the test previously had 0.5s of leeway?

If it's reliable as is, then maybe no leeway is necessary.

Copy link
Contributor

@geoffkizer geoffkizer left a comment

Choose a reason for hiding this comment

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

The test logic is definitely better this way, thanks.

@wfurt wfurt merged commit 6ca1f20 into dotnet:master Nov 3, 2020
@wfurt wfurt deleted the 100expect_41530 branch November 3, 2020 19:35
@ghost ghost locked as resolved and limited conversation to collaborators Dec 6, 2020
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net.Http test-bug Problem in test source code (most likely)

Projects

None yet

4 participants