diff --git a/DistTestCore/AutoBootstrapDistTest.cs b/DistTestCore/AutoBootstrapDistTest.cs index 28e9763..edf182f 100644 --- a/DistTestCore/AutoBootstrapDistTest.cs +++ b/DistTestCore/AutoBootstrapDistTest.cs @@ -12,7 +12,7 @@ namespace DistTestCore public override ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action 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!; diff --git a/DistTestCore/Codex/CodexStartupConfig.cs b/DistTestCore/Codex/CodexStartupConfig.cs index 9b3cb8a..b13512b 100644 --- a/DistTestCore/Codex/CodexStartupConfig.cs +++ b/DistTestCore/Codex/CodexStartupConfig.cs @@ -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; } diff --git a/DistTestCore/CodexSetup.cs b/DistTestCore/CodexSetup.cs index 5b5f3c0..83c5b9b 100644 --- a/DistTestCore/CodexSetup.cs +++ b/DistTestCore/CodexSetup.cs @@ -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 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}"; } diff --git a/DistTestCore/Configuration.cs b/DistTestCore/Configuration.cs index ee01559..ac7d470 100644 --- a/DistTestCore/Configuration.cs +++ b/DistTestCore/Configuration.cs @@ -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; + } } } diff --git a/DistTestCore/DistTest.cs b/DistTestCore/DistTest.cs index 4ca7e3b..bf4d59f 100644 --- a/DistTestCore/DistTest.cs +++ b/DistTestCore/DistTest.cs @@ -134,7 +134,7 @@ namespace DistTestCore public virtual ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action 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) diff --git a/LongTests/BasicTests/LargeFileTests.cs b/LongTests/BasicTests/LargeFileTests.cs index 63b33f5..3149ee3 100644 --- a/LongTests/BasicTests/LargeFileTests.cs +++ b/LongTests/BasicTests/LargeFileTests.cs @@ -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()); diff --git a/LongTests/BasicTests/TestInfraTests.cs b/LongTests/BasicTests/TestInfraTests.cs index 0b5e640..9b3111f 100644 --- a/LongTests/BasicTests/TestInfraTests.cs +++ b/LongTests/BasicTests/TestInfraTests.cs @@ -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()); diff --git a/Tests/BasicTests/ExampleTests.cs b/Tests/BasicTests/ExampleTests.cs index 6951433..3a4884c 100644 --- a/Tests/BasicTests/ExampleTests.cs +++ b/Tests/BasicTests/ExampleTests.cs @@ -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)); diff --git a/Tests/DurabilityTests/DurabilityTests.cs b/Tests/DurabilityTests/DurabilityTests.cs index 008799b..1267400 100644 --- a/Tests/DurabilityTests/DurabilityTests.cs +++ b/Tests/DurabilityTests/DurabilityTests.cs @@ -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()); diff --git a/Tests/PeerDiscoveryTests/PeerDiscoveryTests.cs b/Tests/PeerDiscoveryTests/PeerDiscoveryTests.cs index 66c5ad6..41b0a66 100644 --- a/Tests/PeerDiscoveryTests/PeerDiscoveryTests.cs +++ b/Tests/PeerDiscoveryTests/PeerDiscoveryTests.cs @@ -53,7 +53,7 @@ namespace Tests.PeerDiscoveryTests { for (var i = 0; i < numberOfStages; i++) { - SetupCodexNodes(numberOfNodes, s => s.WithLogLevel(CodexLogLevel.Trace)); + SetupCodexNodes(numberOfNodes); AssertAllNodesConnected(); }