Skip to content

Commit a02fe94

Browse files
committed
Log fixture with diagnostic message propagation
1 parent b907bfe commit a02fe94

6 files changed

Lines changed: 17 additions & 16 deletions

File tree

BTCPayServer.Plugins.IntegrationTests/BTCPayServer.Plugins.IntegrationTests.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<Content Include="Resources\**\*">
35-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36-
</Content>
34+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
35+
<Content Include="Resources\**\*" CopyToOutputDirectory="PreserveNewest" />
3736
</ItemGroup>
3837

3938
<ItemDefinitionGroup>

BTCPayServer.Plugins.IntegrationTests/Monero/MiningFixture.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ public async ValueTask InitializeAsync()
1818
{
1919
MoneroWalletConfig config = new();
2020
config.SetPrimaryAddress(
21-
"9yEzCbcYdg6MqZ5AkEh8V3YCriyN1tvmtWEHdBEUHkF6D6kN1MMD2Kd2QVWoTY67aNHNYKMUP3xfteLS2QNavJxpJdx6mWj");
22-
config.SetPrivateViewKey("1f4668e8c1979b4c7dae13dc149fd95cd7ff2883becffe160c21f9e02c821c08");
21+
"9uZLyeSYy38fKTiWJWyfGp3M7mh5bh8TxWnpfYn2QnAH83V7CwYa8P4HaHXaKXpETG5JuNuq7mdkVSGyx7gfv5arDJCLhpD");
22+
config.SetPrivateViewKey("f8917a980fddca4bdcf1b45a6885de6dcd5d86ff86dd102039fed14933a74b0f");
2323
await CashCowWallet.CreateWallet(config);
2424
await MineAtLeastToHeight(71);
2525

2626
List<MoneroAccount> moneroAccounts = await CashCowWallet.GetAccounts(true, false, null);
2727
foreach (MoneroAccount account in moneroAccounts)
2828
{
29-
Console.WriteLine(
29+
TestContext.Current.SendDiagnosticMessage(
3030
$"Wallet's account with index {account.AccountIndex}: total balance {account.Balance}, unlocked balance {account.UnlockedBalance}");
3131
}
3232
}
@@ -45,12 +45,12 @@ private static async Task MineAtLeastToHeight(ulong targetHeight)
4545
if (miningStatus.IsActive != true)
4646
{
4747
await DaemonRpc.StartMining(
48-
"9yEzCbcYdg6MqZ5AkEh8V3YCriyN1tvmtWEHdBEUHkF6D6kN1MMD2Kd2QVWoTY67aNHNYKMUP3xfteLS2QNavJxpJdx6mWj",
48+
"9uZLyeSYy38fKTiWJWyfGp3M7mh5bh8TxWnpfYn2QnAH83V7CwYa8P4HaHXaKXpETG5JuNuq7mdkVSGyx7gfv5arDJCLhpD",
4949
1,
5050
false,
5151
false
5252
);
53-
Console.WriteLine("Mining started.");
53+
TestContext.Current.SendDiagnosticMessage("Mining started.");
5454
}
5555

5656
ulong lastLoggedHeight = currentHeight;
@@ -65,12 +65,12 @@ await DaemonRpc.StartMining(
6565
if (height != lastLoggedHeight)
6666
{
6767
lastLoggedHeight = height;
68-
Console.WriteLine($"Current height: {height}/{targetHeight}");
68+
TestContext.Current.SendDiagnosticMessage($"Current height: {height}/{targetHeight}");
6969
}
7070

7171
await Task.Delay(1000);
7272
}
7373

74-
Console.WriteLine($"Mining to height {targetHeight} completed.");
74+
TestContext.Current.SendDiagnosticMessage($"Mining to height {targetHeight} completed.");
7575
}
7676
}

BTCPayServer.Plugins.IntegrationTests/Monero/MoneroIntegrationTestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ protected MoneroIntegrationTestBase(ITestOutputHelper helper) : base(helper)
2424

2525
public static MoneroDaemonRpc GetDaemonRpc()
2626
{
27-
return new MoneroDaemonRpc(new MoneroRpcConnection(new Uri(Environment.GetEnvironmentVariable("BTCPAY_XMR_DAEMON_URI") ?? "http://node_1:18081"), "", ""));
27+
return new MoneroDaemonRpc(new MoneroRpcConnection(new Uri(Environment.GetEnvironmentVariable("BTCPAY_XMR_DAEMON_URI") ?? "http://127.0.0.1:18081"), "", ""));
2828
}
2929

3030
public static MoneroWalletRpc GetCashCowWalletRpc()
3131
{
32-
return new MoneroWalletRpc(new MoneroRpcConnection(new Uri(Environment.GetEnvironmentVariable("BTCPAY_XMR_CASHCOW_WALLET_DAEMON_URI") ?? "http://xmr_cashcow_wallet:18092"), "", ""));
32+
return new MoneroWalletRpc(new MoneroRpcConnection(new Uri(Environment.GetEnvironmentVariable("BTCPAY_XMR_CASHCOW_WALLET_DAEMON_URI") ?? "http://127.0.0.1:18092"), "", ""));
3333
}
3434

3535
private static void SetDefaultEnv(string key, string defaultValue)

BTCPayServer.Plugins.IntegrationTests/Monero/MoneroPluginIntegrationTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ await Task.Delay(TimeSpan.FromSeconds(5),
7272
await s.Page.Locator("#page-primary").ClickAsync();
7373
await s.Page.FillAsync("#Amount", "4.20");
7474
await s.Page.FillAsync("#BuyerEmail", "monero@monero.com");
75-
await Task.Delay(TimeSpan.FromSeconds(20),
76-
TestContext.Current.CancellationToken); // wallet-rpc needs some time to sync. refactor this later
7775
await s.Page.Locator("#page-primary").ClickAsync();
7876

7977
// View the invoice
@@ -105,7 +103,7 @@ await Task.Delay(TimeSpan.FromSeconds(20),
105103
var selectedValue = await s.Page.Locator("#AccountIndex").InputValueAsync();
106104
Assert.Equal("1", selectedValue);
107105

108-
// Select confirmation time to 0
106+
// Select confirmation time to 10
109107
await s.Page.SelectOptionAsync("#SettlementConfirmationThresholdChoice", "3");
110108
await s.Page.ClickAsync("#SaveButton");
111109
}

BTCPayServer.Plugins.IntegrationTests/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
set -e
33

4-
dotnet test -c "${CONFIGURATION_NAME}" --no-build -v n /p:CollectCoverage=true /p:CoverletOutput=/coverage/integration/ /p:CoverletOutputFormat=cobertura /p:Include="[BTCPayServer.Plugins.Monero*]*"
4+
dotnet test -c "${CONFIGURATION_NAME}" --logger "console;verbosity=detailed" --no-build -v n /p:CollectCoverage=true /p:CoverletOutput=/coverage/integration/ /p:CoverletOutputFormat=cobertura /p:Include="[BTCPayServer.Plugins.Monero*]*"
55

66
reportgenerator \
77
-reports:"/coverage/unit/coverage.cobertura.xml;/coverage/integration/coverage.cobertura.xml" \
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
3+
"diagnosticMessages": true
4+
}

0 commit comments

Comments
 (0)