2
0
mirror of synced 2025-01-23 06:50:02 +00:00

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() private Http Http()
{ {
CheckContainerCrashed(); return new Http(log, timeSet, Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, Container.Name);
return new Http(log, timeSet, Address, baseUrl: "/api/codex/v1", Container.Name);
} }
private void CheckContainerCrashed() private void CheckContainerCrashed(HttpClient client)
{ {
if (hasContainerCrashed) throw new Exception("Container has crashed."); 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) 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) while (pairs.Any(p => p.Inconclusive) && timeout > DateTime.UtcNow)
{ {
action(); action();

View File

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