Copy if newer + Node Building simplifications.
MODIFY
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
@@ -20,36 +20,13 @@ namespace WalletWasabi.Tests.NodeBuilding
{
public class NodeBuilder : IDisposable
{
- public static string WorkingDirectory { get; private set; }
-
- public static NodeBuilder Create([CallerMemberName]string caller = null)
- {
- WorkingDirectory = Path.Combine(Global.Instance.DataDir, caller);
- return new NodeBuilder(WorkingDirectory, EnvironmentHelpers.GetBinaryPath("BitcoinCore", "bitcoind"));
- }
-
- private static async Task TryRemoveWorkingDirectoryAsync()
- {
- try
- {
- await IoHelpers.DeleteRecursivelyWithMagicDustAsync(WorkingDirectory);
- }
- catch (DirectoryNotFoundException)
- {
- }
- catch (Exception ex)
- {
- Logger.LogError(ex);
- }
- }
-
private int Last { get; set; }
private string Root { get; }
- public NodeBuilder(string root, string bitcoindPath)
+ public NodeBuilder([CallerMemberName]string caller = null)
{
- Root = root;
- BitcoinD = bitcoindPath;
+ Root = Path.Combine(Global.Instance.DataDir, caller);
+ BitcoinD = EnvironmentHelpers.GetBinaryPath("BitcoinCore", "bitcoind");
}
public string BitcoinD { get; }
@@ -100,8 +77,8 @@ namespace WalletWasabi.Tests.NodeBuilding
}
}
await IoHelpers.DeleteRecursivelyWithMagicDustAsync(child);
- await TryRemoveWorkingDirectoryAsync();
- Directory.CreateDirectory(WorkingDirectory);
+ await IoHelpers.DeleteRecursivelyWithMagicDustAsync(Root);
+ IoHelpers.EnsureDirectoryExists(Root);
}
catch (DirectoryNotFoundException)
{
@@ -130,7 +107,7 @@ namespace WalletWasabi.Tests.NodeBuilding
node?.TryKillAsync().GetAwaiter().GetResult();
}
- TryRemoveWorkingDirectoryAsync().GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(Root).GetAwaiter().GetResult();
}
}
}

MODIFY
WalletWasabi.Tests/XunitConfiguration/RegTestFixture.cs
WalletWasabi.Tests/XunitConfiguration/RegTestFixture.cs
@@ -27,7 +27,7 @@ namespace WalletWasabi.Tests.XunitConfiguration
public RegTestFixture()
{
- BackendNodeBuilder = NodeBuilder.Create(EnvironmentHelpers.GetMethodName());
+ BackendNodeBuilder = new NodeBuilder(EnvironmentHelpers.GetMethodName());
BackendNodeBuilder.CreateNodeAsync().GetAwaiter().GetResult();
BackendNodeBuilder.StartAllAsync().GetAwaiter().GetResult();
BackendRegTestNode = BackendNodeBuilder.Nodes[0];

MODIFY
WalletWasabi/WalletWasabi.csproj
WalletWasabi/WalletWasabi.csproj
<ItemGroup>
<None Update="BitcoinCore\Binaries\bitcoind-lin64\bitcoind">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BitcoinCore\Binaries\bitcoind-osx64\bitcoind">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BitcoinCore\Binaries\bitcoind-win64\bitcoind.exe">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Hwi\Binaries\hwi-lin64\hwi">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Hwi\Binaries\hwi-osx64\hwi">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Hwi\Binaries\hwi-win64\hwi.exe">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="OnionSeeds\MainOnionSeeds.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

Copy if newer + Node Building simplifications.