pushes codex loglevel to configuration

This commit is contained in:
benbierens 2023-05-31 13:34:12 +02:00
parent f2145a747f
commit 3d1d82f582
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
10 changed files with 29 additions and 28 deletions

View File

@ -12,7 +12,7 @@ namespace DistTestCore
public override ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action<ICodexSetup> setup)
{
var codexSetup = new CodexSetup(numberOfNodes);
var codexSetup = CreateCodexSetup(numberOfNodes);
setup(codexSetup);
codexSetup.WithBootstrapNode(BootstrapNode);
return BringOnline(codexSetup);
@ -21,10 +21,7 @@ namespace DistTestCore
[SetUp]
public void SetUpBootstrapNode()
{
BootstrapNode = BringOnline(new CodexSetup(1)
{
LogLevel = Codex.CodexLogLevel.Trace
})[0];
BootstrapNode = BringOnline(CreateCodexSetup(1))[0];
}
protected IOnlineCodexNode BootstrapNode { get; private set; } = null!;

View File

@ -5,9 +5,14 @@ namespace DistTestCore.Codex
{
public class CodexStartupConfig
{
public CodexStartupConfig(CodexLogLevel logLevel)
{
LogLevel = logLevel;
}
public string? NameOverride { get; set; }
public Location Location { get; set; }
public CodexLogLevel? LogLevel { get; set; }
public CodexLogLevel LogLevel { get; }
public ByteSize? StorageQuota { get; set; }
public bool MetricsEnabled { get; set; }
public MarketplaceInitialConfig? MarketplaceConfig { get; set; }

View File

@ -8,7 +8,6 @@ namespace DistTestCore
{
ICodexSetup WithName(string name);
ICodexSetup At(Location location);
ICodexSetup WithLogLevel(CodexLogLevel level);
ICodexSetup WithBootstrapNode(IOnlineCodexNode node);
ICodexSetup WithStorageQuota(ByteSize storageQuota);
ICodexSetup EnableMetrics();
@ -20,7 +19,8 @@ namespace DistTestCore
{
public int NumberOfNodes { get; }
public CodexSetup(int numberOfNodes)
public CodexSetup(int numberOfNodes, CodexLogLevel logLevel)
: base(logLevel)
{
NumberOfNodes = numberOfNodes;
}
@ -43,12 +43,6 @@ namespace DistTestCore
return this;
}
public ICodexSetup WithLogLevel(CodexLogLevel level)
{
LogLevel = level;
return this;
}
public ICodexSetup WithStorageQuota(ByteSize storageQuota)
{
StorageQuota = storageQuota;
@ -80,7 +74,7 @@ namespace DistTestCore
private IEnumerable<string> DescribeArgs()
{
if (LogLevel != null) yield return $"LogLevel={LogLevel}";
yield return $"LogLevel={LogLevel}";
if (BootstrapSpr != null) yield return $"BootstrapNode={BootstrapSpr}";
if (StorageQuota != null) yield return $"StorageQuote={StorageQuota}";
}

View File

@ -1,4 +1,5 @@
using KubernetesWorkflow;
using DistTestCore.Codex;
using KubernetesWorkflow;
namespace DistTestCore
{
@ -28,5 +29,10 @@ namespace DistTestCore
{
return "TestDataFiles";
}
public CodexLogLevel GetCodexLogLevel()
{
return CodexLogLevel.Trace;
}
}
}

View File

@ -134,7 +134,7 @@ namespace DistTestCore
public virtual ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action<ICodexSetup> setup)
{
var codexSetup = new CodexSetup(numberOfNodes);
var codexSetup = CreateCodexSetup(numberOfNodes);
setup(codexSetup);
@ -168,6 +168,11 @@ namespace DistTestCore
GetTestLog().Debug(msg);
}
protected CodexSetup CreateCodexSetup(int numberOfNodes)
{
return new CodexSetup(numberOfNodes, configuration.GetCodexLogLevel());
}
private TestLifecycle Get()
{
lock (lifecycleLock)

View File

@ -1,5 +1,4 @@
using DistTestCore;
using DistTestCore.Codex;
using NUnit.Framework;
namespace TestsLong.BasicTests
@ -11,7 +10,6 @@ namespace TestsLong.BasicTests
public void OneClientLargeFileTest()
{
var primary = SetupCodexNode(s => s
.WithLogLevel(CodexLogLevel.Warn)
.WithStorageQuota(20.GB()));
var testFile = GenerateTestFile(10.GB());

View File

@ -1,5 +1,4 @@
using DistTestCore;
using DistTestCore.Codex;
using NUnit.Framework;
namespace TestsLong.BasicTests
@ -32,7 +31,6 @@ namespace TestsLong.BasicTests
public void DownloadConsistencyTest()
{
var primary = SetupCodexNode(s => s
.WithLogLevel(CodexLogLevel.Trace)
.WithStorageQuota(2.MB()));
var testFile = GenerateTestFile(1.MB());

View File

@ -11,7 +11,7 @@ namespace Tests.BasicTests
[Test]
public void CodexLogExample()
{
var primary = SetupCodexNode(s => s.WithLogLevel(CodexLogLevel.Trace));
var primary = SetupCodexNode();
primary.UploadFile(GenerateTestFile(5.MB()));
@ -47,7 +47,6 @@ namespace Tests.BasicTests
var buyerInitialBalance = 1000.TestTokens();
var seller = SetupCodexNode(s => s
.WithLogLevel(CodexLogLevel.Trace)
.WithStorageQuota(11.GB())
.EnableMarketplace(sellerInitialBalance));
@ -61,7 +60,6 @@ namespace Tests.BasicTests
var testFile = GenerateTestFile(10.MB());
var buyer = SetupCodexNode(s => s
.WithLogLevel(CodexLogLevel.Trace)
.WithBootstrapNode(seller)
.EnableMarketplace(buyerInitialBalance));

View File

@ -31,10 +31,10 @@ namespace Tests.DurabilityTests
[Test]
public void DataRetentionTest()
{
var bootstrapNode = SetupCodexBootstrapNode(s => s.WithLogLevel(CodexLogLevel.Trace));
var bootstrapNode = SetupCodexBootstrapNode();
var startGroup = SetupCodexNodes(2, s => s.WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode));
var finishGroup = SetupCodexNodes(10, s => s.WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode));
var startGroup = SetupCodexNodes(2, s => s.WithBootstrapNode(bootstrapNode));
var finishGroup = SetupCodexNodes(10, s => s.WithBootstrapNode(bootstrapNode));
var file = GenerateTestFile(10.MB());

View File

@ -53,7 +53,7 @@ namespace Tests.PeerDiscoveryTests
{
for (var i = 0; i < numberOfStages; i++)
{
SetupCodexNodes(numberOfNodes, s => s.WithLogLevel(CodexLogLevel.Trace));
SetupCodexNodes(numberOfNodes);
AssertAllNodesConnected();
}