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
Use IAsyncLifetime
in TorTests & LiveServerTests.
#4324
Conversation
var torManager = new TorProcessManager(Global.Instance.TorSocks5Endpoint, Global.Instance.TorLogsFile); | ||
torManager.Start(ensureRunning: true, dataDir: Path.GetFullPath(AppContext.BaseDirectory)); | ||
Task.Delay(3000).GetAwaiter().GetResult(); | ||
await Task.Delay(3000); |
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.
Can we ask TorProcessManager is Tor is running or not?
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.
Not sure if it is helpful at this point because my PRs attempt to reach the state where we would just call: await torManager.Start(ensureRunning: true)
and that would wait for Tor to be running or throw an exception that Tor is not reachable.
EDIT: And also that would remove await Task.Delay(3000);
.
|
The test is passing for me. Does the website load in your browser? |
Yes. |
…torTests # Conflicts: # WalletWasabi.Tests/IntegrationTests/LiveServerTests.cs # WalletWasabi.Tests/IntegrationTests/TorTests.cs
LGTM |
This is cool. Is this something new? I had no idea about this. With this we can probably even remove the |
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.
LGTM
https://github.com/xunit/xunit/blob/master/src/xunit.core/IAsyncLifetime.cs seems to exist for years. |
This is part of #4244 project where I would actually like to get rid of those
await Task.Delay(3000);
delays in TorTests and enforce that when you start Tor and you ask forensureRunning
it will be started or an exception will be thrown. This PR paves the path to that goal.This PR attempts to rewrite
TorTests
&LiveServerTests
initialization using proper mechanism provided by xUnit - namelyIAsyncLifetime
interface: https://mderriey.com/2017/09/04/async-lifetime-with-xunit/PR is in conflict with #4305. That PR should be merged first and I'll modify this one after that.
Notes: