-
Notifications
You must be signed in to change notification settings - Fork 217
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
Remove use of Thread.Sleep #3120
base: master
Are you sure you want to change the base?
Conversation
SummarySummary
CoverageMicrosoft.Identity.Web - 63.6%
Microsoft.Identity.Web.Certificate - 41.4%
Microsoft.Identity.Web.Certificateless - 40.1%
Microsoft.Identity.Web.Diagnostics - 10.2%
Microsoft.Identity.Web.DownstreamApi - 14.5%
Microsoft.Identity.Web.MicrosoftGraph - 42%
Microsoft.Identity.Web.Test.Common - 69.3%
Microsoft.Identity.Web.TokenAcquisition - 53.2%
Microsoft.Identity.Web.TokenCache - 80.8%
|
@@ -324,7 +324,6 @@ internal static bool StartAndVerifyProcessesAreRunning(List<ProcessStartOptions> | |||
processDataEntry.EnvironmentVariables); | |||
|
|||
processes.Add(processDataEntry.ExecutableName, process); | |||
Thread.Sleep(5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to block the thread on waiting for all processes to start or error? I assume that's the intent behind this sleep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can check that all processes have started, you can poll on that condition. Like here https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/main/tests/Microsoft.Identity.Test.Common/TestCommon.cs#L258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, it looks like something similar is being done with these tests, after the processes are checked to be running
microsoft-identity-web/tests/E2E Tests/WebAppUiTests/WebAppCallsApiCallsGraphLocally.cs
Line 335 in 011bd15
private async Task<IPage> NavigateToWebAppAsync(IBrowserContext context, uint port) |
@@ -357,7 +356,6 @@ static void RestartProcesses(Dictionary<string, Process> processes, List<Process | |||
processDataEntry.AppLocation, | |||
processDataEntry.ExecutableName, | |||
processDataEntry.EnvironmentVariables); | |||
Thread.Sleep(5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @westin-m
Did you try this? I think we need to let some time for the web APIs to start?
I did try it and it worked when ran until failure. Nevertheless, I'll find a way to wait for all processes. |
Remove unnecessary usage of
Thread.Sleep
in theUiTestHelpers
class.