Use RegTestFixture.BackendHttpClient in tests.
MODIFY
WalletWasabi.Tests/RegressionTests/BackendTests.cs
WalletWasabi.Tests/RegressionTests/BackendTests.cs
@@ -29,15 +29,11 @@ namespace WalletWasabi.Tests.RegressionTests
public BackendTests(RegTestFixture regTestFixture)
{
RegTestFixture = regTestFixture;
- BackendHttpClient = new ClearnetHttpClient(() => RegTestFixture.BackendEndPointUri);
- BackendApiHttpClient = new BackendHttpClient(new ClearnetHttpClient(() => RegTestFixture.BackendEndPointApiUri));
+ BackendApiHttpClient = new BackendHttpClient(new ClearnetHttpClient(regTestFixture.HttpClient, () => RegTestFixture.BackendEndPointApiUri));
}
private RegTestFixture RegTestFixture { get; }
- /// <summary>Clearnet HTTP client with predefined base URI for Wasabi Backend (note: <c>/api</c> is not part of base URI).</summary>
- public ClearnetHttpClient BackendHttpClient { get; }
-
/// <summary>Clearnet HTTP client with predefined base URI for Wasabi Backend API queries.</summary>
private BackendHttpClient BackendApiHttpClient { get; }
@@ -60,7 +56,7 @@ namespace WalletWasabi.Tests.RegressionTests
[Fact]
public async Task GetClientVersionAsync()
{
- var client = new WasabiClient(BackendHttpClient);
+ var client = new WasabiClient(RegTestFixture.BackendHttpClient);
var uptodate = await client.CheckUpdatesAsync(CancellationToken.None);
Assert.True(uptodate.BackendCompatible);
Assert.True(uptodate.ClientUpToDate);

MODIFY
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
@@ -46,12 +46,10 @@ namespace WalletWasabi.Tests.RegressionTests
{
RegTestFixture = regTestFixture;
BaseUri = new Uri(RegTestFixture.BackendEndPoint);
- BackendClearnetHttpClient = new ClearnetHttpClient(() => RegTestFixture.BackendEndPointUri);
}
private RegTestFixture RegTestFixture { get; }
public Uri BaseUri { get; }
- public ClearnetHttpClient BackendClearnetHttpClient { get; }
[Fact]
public async Task CoordinatorCtorTestsAsync()
@@ -110,7 +108,7 @@ namespace WalletWasabi.Tests.RegressionTests
coordinator.AbortAllRoundsInInputRegistration("");
using var torClient = new TorHttpClient(BaseUri, Helpers.Common.TorSocks5Endpoint);
- var satoshiClient = new SatoshiClient(new ClearnetHttpClient(() => BaseUri));
+ var satoshiClient = new SatoshiClient(RegTestFixture.BackendHttpClient);
#region PostInputsGetStates
@@ -614,8 +612,8 @@ namespace WalletWasabi.Tests.RegressionTests
}
{
- var bobClient1 = new BobClient(BackendClearnetHttpClient);
- var bobClient2 = new BobClient(BackendClearnetHttpClient);
+ var bobClient1 = new BobClient(RegTestFixture.BackendHttpClient);
+ var bobClient2 = new BobClient(RegTestFixture.BackendHttpClient);
await bobClient1.PostOutputAsync(aliceClient1.RoundId, new ActiveOutput(outputAddress1, connConfResp.activeOutputs.First().Signature, 0));
await bobClient2.PostOutputAsync(aliceClient2.RoundId, new ActiveOutput(outputAddress2, connConfResp2.activeOutputs.First().Signature, 0));
}
@@ -686,7 +684,7 @@ namespace WalletWasabi.Tests.RegressionTests
uint256[] mempooltxs = await rpc.GetRawMempoolAsync();
Assert.Contains(unsignedCoinJoin.GetHash(), mempooltxs);
- var wasabiClient = new WasabiClient(BackendClearnetHttpClient);
+ var wasabiClient = new WasabiClient(RegTestFixture.BackendHttpClient);
var syncInfo = await wasabiClient.GetSynchronizeAsync(blockHashed[0], 1);
Assert.Contains(unsignedCoinJoin.GetHash(), syncInfo.UnconfirmedCoinJoins);
var txs = await wasabiClient.GetTransactionsAsync(network, new[] { unsignedCoinJoin.GetHash() }, CancellationToken.None);
@@ -711,7 +709,7 @@ namespace WalletWasabi.Tests.RegressionTests
Uri baseUri = new Uri(RegTestFixture.BackendEndPoint);
using var torClient = new TorHttpClient(baseUri, Helpers.Common.TorSocks5Endpoint);
- var satoshiClient = new SatoshiClient(new ClearnetHttpClient(() => BaseUri));
+ var satoshiClient = new SatoshiClient(RegTestFixture.BackendHttpClient);
var round = coordinator.GetCurrentInputRegisterableRoundOrDefault();
var roundId = round.RoundId;
@@ -795,7 +793,7 @@ namespace WalletWasabi.Tests.RegressionTests
Assert.Equal(RoundPhase.OutputRegistration, roundState.Phase);
var l = 0;
- var bobClient = new BobClient(BackendClearnetHttpClient);
+ var bobClient = new BobClient(RegTestFixture.BackendHttpClient);
foreach (var (aliceClient, outputs, _) in participants)
{
@@ -991,7 +989,7 @@ namespace WalletWasabi.Tests.RegressionTests
var outputRequests = new List<Task>();
foreach (var user in users)
{
- var bobClient = new BobClient(BackendClearnetHttpClient);
+ var bobClient = new BobClient(RegTestFixture.BackendHttpClient);
outputRequests.Add(bobClient.PostOutputAsync(roundId, new ActiveOutput(user.activeOutputAddress, user.unblindedSignature, 0)));
}

MODIFY
WalletWasabi.Tests/RegressionTests/Common.cs
WalletWasabi.Tests/RegressionTests/Common.cs
@@ -50,7 +50,7 @@ namespace WalletWasabi.Tests.RegressionTests
var firstHash = await global.RpcClient.GetBlockHashAsync(0);
while (true)
{
- var client = new WasabiClient(new ClearnetHttpClient(() => regTestFixture.BackendEndPointUri));
+ var client = new WasabiClient(regTestFixture.BackendHttpClient);
FiltersResponse? filtersResponse = await client.GetFiltersAsync(firstHash, 1000);
Assert.NotNull(filtersResponse);

MODIFY
WalletWasabi.Tests/RegressionTests/DosTests.cs
WalletWasabi.Tests/RegressionTests/DosTests.cs
@@ -12,7 +12,6 @@ using WalletWasabi.CoinJoin.Coordinator;
using WalletWasabi.CoinJoin.Coordinator.Rounds;
using WalletWasabi.Tests.Helpers;
using WalletWasabi.Tests.XunitConfiguration;
-using WalletWasabi.Tor.Http;
using Xunit;
using static WalletWasabi.Crypto.SchnorrBlinding;
using UnblindedSignature = WalletWasabi.Crypto.UnblindedSignature;
@@ -25,9 +24,7 @@ namespace WalletWasabi.Tests.RegressionTests
public DosTests(RegTestFixture regTestFixture)
{
RegTestFixture = regTestFixture;
-
- var httpClient = new ClearnetHttpClient(() => new Uri(RegTestFixture.BackendEndPoint));
- SatoshiClient = new SatoshiClient(httpClient);
+ SatoshiClient = new SatoshiClient(regTestFixture.BackendHttpClient);
}
private RegTestFixture RegTestFixture { get; }

Use RegTestFixture.BackendHttpClient in tests.