From 5ffff1ed079df7070efc60b831651bb39b46aae9 Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 7 Jun 2024 17:07:35 +0200 Subject: [PATCH] Disables metrics in scalability test. Downloads container log when retry attempt failed too quickly to be a timeout. --- ProjectPlugins/CodexPlugin/CodexAccess.cs | 13 +++++++++++-- .../ScalabilityTests/ScalabilityTests.cs | 13 ++++++------- Tests/CodexTests/CodexDistTest.cs | 18 +++++++++--------- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ProjectPlugins/CodexPlugin/CodexAccess.cs b/ProjectPlugins/CodexPlugin/CodexAccess.cs index 469c8ca0..70139009 100644 --- a/ProjectPlugins/CodexPlugin/CodexAccess.cs +++ b/ProjectPlugins/CodexPlugin/CodexAccess.cs @@ -196,8 +196,10 @@ namespace CodexPlugin private void Investigate(ILog log, Failure failure, ITimeSet timeSet) { - log.Log($"Retry {failure.TryNumber} took {Time.FormatDuration(failure.Duration)}. (HTTP timeout = {Time.FormatDuration(timeSet.HttpCallTimeout())}) " + - $"Checking if node responds to debug/info..."); + log.Log($"Retry {failure.TryNumber} took {Time.FormatDuration(failure.Duration)} and failed with '{failure.Exception}'. " + + $"(HTTP timeout = {Time.FormatDuration(timeSet.HttpCallTimeout())}) " + + $"Checking if node responds to debug/info..."); + try { var debugInfo = GetDebugInfo(); @@ -218,6 +220,13 @@ namespace CodexPlugin DownloadLog(); Throw(failure); } + + if (failure.Duration < timeSet.HttpCallTimeout()) + { + log.Log("Retry failed within HTTP timeout duration."); + DownloadLog(); + Throw(failure); + } } private void Throw(Failure failure) diff --git a/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs b/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs index 1b759ac4..b63d5bd5 100644 --- a/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs +++ b/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs @@ -1,5 +1,4 @@ using CodexPlugin; -using MetricsPlugin; using DistTestCore; using FileUtils; using NUnit.Framework; @@ -28,7 +27,7 @@ public class ScalabilityTests : CodexDistTest var bootstrap = StartCodex(s => s.WithLogLevel(logLevel)); var nodes = StartCodex(numberOfNodes - 1, s => s - .EnableMetrics() + //.EnableMetrics() .WithBootstrapNode(bootstrap) .WithLogLevel(logLevel) .WithStorageQuota((fileSizeInMb + 50).MB()) @@ -36,15 +35,15 @@ public class ScalabilityTests : CodexDistTest var uploader = nodes.PickOneRandom(); var downloader = nodes.PickOneRandom(); - var metrics = Ci.GetMetricsFor(uploader, downloader); + //var metrics = Ci.GetMetricsFor(uploader, downloader); var testFile = GenerateTestFile(fileSizeInMb.MB()); - LogNodeStatus(uploader, metrics[0]); - var contentId = uploader.UploadFile(testFile, f => LogNodeStatus(uploader, metrics[0])); + LogNodeStatus(uploader); + var contentId = uploader.UploadFile(testFile, f => LogNodeStatus(uploader)); - LogNodeStatus(downloader, metrics[1]); - var downloadedFile = downloader.DownloadContent(contentId, f => LogNodeStatus(downloader, metrics[1])); + LogNodeStatus(downloader); + var downloadedFile = downloader.DownloadContent(contentId, f => LogNodeStatus(downloader)); downloadedFile!.AssertIsEqual(testFile); diff --git a/Tests/CodexTests/CodexDistTest.cs b/Tests/CodexTests/CodexDistTest.cs index 10ca6a44..1c184bcd 100644 --- a/Tests/CodexTests/CodexDistTest.cs +++ b/Tests/CodexTests/CodexDistTest.cs @@ -104,8 +104,7 @@ namespace CodexTests public void LogNodeStatus(ICodexNode node, IMetricsAccess? metrics = null) { Log("Status for " + node.GetName() + Environment.NewLine + - GetBasicNodeStatus(node) + - GetNodeMetrics(metrics)); + GetBasicNodeStatus(node)); } private string GetBasicNodeStatus(ICodexNode node) @@ -114,13 +113,14 @@ namespace CodexTests node.Space().ToString() + Environment.NewLine; } - private string GetNodeMetrics(IMetricsAccess? metrics) - { - if (metrics == null) return "No metrics enabled"; - var m = metrics.GetAllMetrics(); - if (m == null) return "No metrics received"; - return m.AsCsv(); - } + // Disabled for now: Makes huge log files! + //private string GetNodeMetrics(IMetricsAccess? metrics) + //{ + // if (metrics == null) return "No metrics enabled"; + // var m = metrics.GetAllMetrics(); + // if (m == null) return "No metrics received"; + // return m.AsCsv(); + //} protected virtual void OnCodexSetup(ICodexSetup setup) {