wires up timing measurement for peer download helper.
This commit is contained in:
parent
553a368714
commit
3aea8f41b8
|
@ -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.");
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue