wires up timing measurement for peer download helper.

This commit is contained in:
benbierens 2023-08-29 10:09:48 +02:00
parent 553a368714
commit 3aea8f41b8
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 7 additions and 6 deletions

View File

@ -95,11 +95,10 @@ namespace DistTestCore.Codex
private Http Http()
{
CheckContainerCrashed();
return new Http(log, timeSet, Address, baseUrl: "/api/codex/v1", Container.Name);
return new Http(log, timeSet, Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, Container.Name);
}
private void CheckContainerCrashed()
private void CheckContainerCrashed(HttpClient client)
{
if (hasContainerCrashed) throw new Exception("Container has crashed.");
}

View File

@ -56,7 +56,7 @@ namespace DistTestCore.Helpers
private static void RetryWhilePairs(List<Pair> pairs, Action action)
{
var timeout = DateTime.UtcNow + TimeSpan.FromMinutes(5);
var timeout = DateTime.UtcNow + TimeSpan.FromMinutes(2);
while (pairs.Any(p => p.Inconclusive) && timeout > DateTime.UtcNow)
{
action();

View File

@ -7,6 +7,7 @@ namespace DistTestCore.Helpers
public class PeerDownloadTestHelpers : IFullConnectivityImplementation
{
private readonly FullConnectivityHelper helper;
private readonly BaseLog log;
private readonly FileManager fileManager;
private ByteSize testFileSize;
@ -14,6 +15,7 @@ namespace DistTestCore.Helpers
{
helper = new FullConnectivityHelper(log, this);
testFileSize = 1.MB();
this.log = log;
this.fileManager = fileManager;
}
@ -44,11 +46,11 @@ namespace DistTestCore.Helpers
var expectedFile = GenerateTestFile(from.Node, to.Node);
using var uploadStream = File.OpenRead(expectedFile.Filename);
var contentId = from.Node.UploadFile(uploadStream);
var contentId = Stopwatch.Measure(log, "Upload", () => from.Node.UploadFile(uploadStream));
try
{
var downloadedFile = DownloadFile(to.Node, contentId, expectedFile.Label + "_downloaded");
var downloadedFile = Stopwatch.Measure(log, "Download", () => DownloadFile(to.Node, contentId, expectedFile.Label + "_downloaded"));
expectedFile.AssertIsEqual(downloadedFile);
return PeerConnectionState.Connection;
}