Skip to content

Commit

Permalink
add call to get filesize of container
Browse files Browse the repository at this point in the history
  • Loading branch information
rsafier committed Aug 27, 2024
1 parent d593bb3 commit 63d539b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
17 changes: 8 additions & 9 deletions LNUnit.Tests/Abstract/AbcLightningAbstractTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,15 +737,14 @@ public async Task Keysend_To_Bob_PaymentsPerSecondMax_Threaded(int threads)
$"Failed : {fail_count}".Print();
var successful_pps = success_count / (sw.ElapsedMilliseconds / 1000.0);
$"Successful Payments per second: {successful_pps}".Print();

//Let us also pull mission control data
var mc = await alice.RouterClient.QueryMissionControlAsync(new QueryMissionControlRequest()
{

});
var newCount = mc.Pairs.Count;
$"{mc_base.Pairs.Count} original, {mc.Pairs.Count} new".Print();
mc.Pairs.PrintDump();
var size = await Builder.GetFileSize("alice", "/root/.lnd/data/graph/regtest/channel.db");
size.PrintDump();
size = await Builder.GetFileSize("bob", "/root/.lnd/data/graph/regtest/channel.db");
size.PrintDump();
size = await Builder.GetFileSize("carol", "/root/.lnd/data/graph/regtest/channel.db");
size.PrintDump();


}

[Test]
Expand Down
18 changes: 18 additions & 0 deletions LNUnit/Setup/LNUnitBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,25 @@ public async Task<LNDSettings> GetLNDSettingsFromContainer(string containerId, s
};
}

public async Task<ContainerPathStatResponse?> GetFileSize(string containerId, string filePath)
{
try
{
var archResponse = await _dockerClient.Containers.GetArchiveFromContainerAsync(
containerId,
new GetArchiveFromContainerParameters
{
Path = filePath
}, true);
return archResponse.Stat;
}
catch (Exception e)
{
}

return null;

}
private async Task<GetArchiveFromContainerResponse?> GetTarStreamFromFS(string containerId, string filePath)
{
var foundFile = false;
Expand Down

0 comments on commit 63d539b

Please sign in to comment.