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

Make the file large enough so that the cancelation can be executed before the task is done #11225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GangWang01
Copy link
Member

Fixes #11018

Context

Test result Shouldly.ShouldAssertException : task.Result\r\n should be\r\nFalse\r\n but was\r\nTrue indicates that the task is done quickly before the cancelation is executed, though the test cancels it right after it is started.

Changes Made

Make the file large enough so that the task will take enough time to let the cancelation be executed before it is done.

Testing

N/A

Notes

@GangWang01 GangWang01 force-pushed the downloadfile-flaky-test branch from a83e0d4 to bdd4baa Compare January 6, 2025 10:07
@GangWang01
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@GangWang01 GangWang01 marked this pull request as ready for review January 7, 2025 07:36
@@ -37,7 +37,7 @@ public void CanBeCanceled()
DestinationFolder = new TaskItem(folder.Path),
HttpMessageHandler = new MockHttpMessageHandler((message, token) => new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(new String('!', 10000000)),
Content = new StringContent(new String('!', 0xfffffff)),
Copy link
Member

Choose a reason for hiding this comment

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

Can we instead use a StreamContent that would e.g. indefinitely provide single char per couple dozens milliseconds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test - Microsoft.Build.Tasks.UnitTests.DownloadFile_Tests.CanBeCanceled
2 participants