Removes BringOnline method
This commit is contained in:
parent
f94f4a6d22
commit
62f4eed221
|
@ -13,26 +13,17 @@ namespace DistTestCore
|
|||
ICodexSetup EnableMetrics();
|
||||
ICodexSetup EnableMarketplace(TestToken initialBalance);
|
||||
ICodexSetup EnableMarketplace(TestToken initialBalance, Ether initialEther);
|
||||
ICodexNodeGroup BringOnline();
|
||||
}
|
||||
|
||||
public class CodexSetup : CodexStartupConfig, ICodexSetup
|
||||
{
|
||||
private readonly CodexStarter starter;
|
||||
|
||||
public int NumberOfNodes { get; }
|
||||
|
||||
public CodexSetup(CodexStarter starter, int numberOfNodes)
|
||||
public CodexSetup(int numberOfNodes)
|
||||
{
|
||||
this.starter = starter;
|
||||
NumberOfNodes = numberOfNodes;
|
||||
}
|
||||
|
||||
public ICodexNodeGroup BringOnline()
|
||||
{
|
||||
return starter.BringOnline(this);
|
||||
}
|
||||
|
||||
public ICodexSetup At(Location location)
|
||||
{
|
||||
Location = location;
|
||||
|
|
|
@ -77,9 +77,33 @@ namespace DistTestCore
|
|||
return lifecycle.FileManager.GenerateTestFile(size);
|
||||
}
|
||||
|
||||
public ICodexSetup SetupCodexNodes(int numberOfNodes)
|
||||
public IOnlineCodexNode SetupCodexNode()
|
||||
{
|
||||
return new CodexSetup(lifecycle.CodexStarter, numberOfNodes);
|
||||
return SetupCodexNode(s => { });
|
||||
}
|
||||
|
||||
public IOnlineCodexNode SetupCodexNode(Action<ICodexSetup> setup)
|
||||
{
|
||||
return SetupCodexNodes(1, setup)[0];
|
||||
}
|
||||
|
||||
public ICodexNodeGroup SetupCodexNodes(int numberOfNodes)
|
||||
{
|
||||
return SetupCodexNodes(numberOfNodes, s => { });
|
||||
}
|
||||
|
||||
public ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action<ICodexSetup> setup)
|
||||
{
|
||||
var codexSetup = new CodexSetup(numberOfNodes);
|
||||
|
||||
setup(codexSetup);
|
||||
|
||||
return BringOnline(codexSetup);
|
||||
}
|
||||
|
||||
public ICodexNodeGroup BringOnline(ICodexSetup codexSetup)
|
||||
{
|
||||
return lifecycle.CodexStarter.BringOnline((CodexSetup)codexSetup);
|
||||
}
|
||||
|
||||
private void CreateNewTestLifecycle()
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace DistTestCore
|
|||
ICodexNodeLog DownloadLog();
|
||||
IMetricsAccess Metrics { get; }
|
||||
IMarketplaceAccess Marketplace { get; }
|
||||
ICodexSetup BringOffline();
|
||||
}
|
||||
|
||||
public class OnlineCodexNode : IOnlineCodexNode
|
||||
|
@ -89,6 +90,11 @@ namespace DistTestCore
|
|||
return lifecycle.DownloadLog(this);
|
||||
}
|
||||
|
||||
public ICodexSetup BringOffline()
|
||||
{
|
||||
return Group.BringOffline();
|
||||
}
|
||||
|
||||
private string GetPeerMultiAddress(OnlineCodexNode peer, CodexDebugResponse peerInfo)
|
||||
{
|
||||
var multiAddress = peerInfo.addrs.First();
|
||||
|
|
|
@ -10,10 +10,9 @@ namespace TestsLong.BasicTests
|
|||
[Test, UseLongTimeouts]
|
||||
public void OneClientLargeFileTest()
|
||||
{
|
||||
var primary = SetupCodexNodes(1)
|
||||
var primary = SetupCodexNode(s => s
|
||||
.WithLogLevel(CodexLogLevel.Warn)
|
||||
.WithStorageQuota(20.GB())
|
||||
.BringOnline()[0];
|
||||
.WithStorageQuota(20.GB()));
|
||||
|
||||
var testFile = GenerateTestFile(10.GB());
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ namespace TestsLong.BasicTests
|
|||
[Test, UseLongTimeouts]
|
||||
public void TestInfraShouldHave1000AddressSpacesPerPod()
|
||||
{
|
||||
var group = SetupCodexNodes(1000)
|
||||
.EnableMetrics() // Increases use of port address space per node.
|
||||
.BringOnline();
|
||||
var group = SetupCodexNodes(1000, s => s.EnableMetrics()); // Increases use of port address space per node.
|
||||
|
||||
var nodeIds = group.Select(n => n.GetDebugInfo().id).ToArray();
|
||||
|
||||
|
@ -24,7 +22,7 @@ namespace TestsLong.BasicTests
|
|||
{
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
var n = SetupCodexNodes(1).BringOnline()[0];
|
||||
var n = SetupCodexNode();
|
||||
|
||||
Assert.That(!string.IsNullOrEmpty(n.GetDebugInfo().id));
|
||||
}
|
||||
|
@ -33,10 +31,9 @@ namespace TestsLong.BasicTests
|
|||
[Test, UseLongTimeouts]
|
||||
public void DownloadConsistencyTest()
|
||||
{
|
||||
var primary = SetupCodexNodes(1)
|
||||
var primary = SetupCodexNode(s => s
|
||||
.WithLogLevel(CodexLogLevel.Trace)
|
||||
.WithStorageQuota(2.MB())
|
||||
.BringOnline()[0];
|
||||
.WithStorageQuota(2.MB()));
|
||||
|
||||
var testFile = GenerateTestFile(1.MB());
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void CodexLogExample()
|
||||
{
|
||||
var primary = SetupCodexNodes(1)
|
||||
.WithLogLevel(CodexLogLevel.Trace)
|
||||
.BringOnline()[0];
|
||||
var primary = SetupCodexNode(s => s.WithLogLevel(CodexLogLevel.Trace));
|
||||
|
||||
primary.UploadFile(GenerateTestFile(5.MB()));
|
||||
|
||||
|
@ -25,13 +23,8 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void TwoMetricsExample()
|
||||
{
|
||||
var group = SetupCodexNodes(2)
|
||||
.EnableMetrics()
|
||||
.BringOnline();
|
||||
|
||||
var group2 = SetupCodexNodes(2)
|
||||
.EnableMetrics()
|
||||
.BringOnline();
|
||||
var group = SetupCodexNodes(2, s => s.EnableMetrics());
|
||||
var group2 = SetupCodexNodes(2, s => s.EnableMetrics());
|
||||
|
||||
var primary = group[0];
|
||||
var secondary = group[1];
|
||||
|
@ -50,19 +43,17 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void MarketplaceExample()
|
||||
{
|
||||
var primary = SetupCodexNodes(1)
|
||||
var primary = SetupCodexNode(s => s
|
||||
.WithLogLevel(CodexLogLevel.Trace)
|
||||
.WithStorageQuota(11.GB())
|
||||
.EnableMarketplace(initialBalance: 234.TestTokens())
|
||||
.BringOnline()[0];
|
||||
.EnableMarketplace(initialBalance: 234.TestTokens()));
|
||||
|
||||
primary.Marketplace.AssertThatBalance(Is.EqualTo(234.TestTokens()));
|
||||
|
||||
var secondary = SetupCodexNodes(1)
|
||||
var secondary = SetupCodexNode(s => s
|
||||
.WithLogLevel(CodexLogLevel.Trace)
|
||||
.WithBootstrapNode(primary)
|
||||
.EnableMarketplace(initialBalance: 1000.TestTokens())
|
||||
.BringOnline()[0];
|
||||
.EnableMarketplace(initialBalance: 1000.TestTokens()));
|
||||
|
||||
primary.Marketplace.MakeStorageAvailable(
|
||||
size: 10.GB(),
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void OneClientTest()
|
||||
{
|
||||
var primary = SetupCodexNodes(1).BringOnline()[0];
|
||||
var primary = SetupCodexNode();
|
||||
|
||||
PerformOneClientTest(primary);
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void RestartTest()
|
||||
{
|
||||
var group = SetupCodexNodes(1).BringOnline();
|
||||
var primary = SetupCodexNode();
|
||||
|
||||
var setup = group.BringOffline();
|
||||
var setup = primary.BringOffline();
|
||||
|
||||
var primary = setup.BringOnline()[0];
|
||||
primary = BringOnline(setup)[0];
|
||||
|
||||
PerformOneClientTest(primary);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void TwoClientsOnePodTest()
|
||||
{
|
||||
var group = SetupCodexNodes(2).BringOnline();
|
||||
var group = SetupCodexNodes(2);
|
||||
|
||||
var primary = group[0];
|
||||
var secondary = group[1];
|
||||
|
@ -21,9 +21,8 @@ namespace Tests.BasicTests
|
|||
[Test]
|
||||
public void TwoClientsTwoPodsTest()
|
||||
{
|
||||
var primary = SetupCodexNodes(1).BringOnline()[0];
|
||||
|
||||
var secondary = SetupCodexNodes(1).BringOnline()[0];
|
||||
var primary = SetupCodexNode();
|
||||
var secondary = SetupCodexNode();
|
||||
|
||||
PerformTwoClientTest(primary, secondary);
|
||||
}
|
||||
|
@ -32,13 +31,8 @@ namespace Tests.BasicTests
|
|||
[Ignore("Requires Location map to be configured for k8s cluster.")]
|
||||
public void TwoClientsTwoLocationsTest()
|
||||
{
|
||||
var primary = SetupCodexNodes(1)
|
||||
.At(Location.BensLaptop)
|
||||
.BringOnline()[0];
|
||||
|
||||
var secondary = SetupCodexNodes(1)
|
||||
.At(Location.BensOldGamingMachine)
|
||||
.BringOnline()[0];
|
||||
var primary = SetupCodexNode(s => s.At(Location.BensLaptop));
|
||||
var secondary = SetupCodexNode(s => s.At(Location.BensOldGamingMachine));
|
||||
|
||||
PerformTwoClientTest(primary, secondary);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace Tests.DurabilityTests
|
|||
[Test]
|
||||
public void BootstrapNodeDisappearsTest()
|
||||
{
|
||||
var bootstrapNode = SetupCodexNodes(1).BringOnline();
|
||||
var group = SetupCodexNodes(2).WithBootstrapNode(bootstrapNode[0]).BringOnline();
|
||||
var bootstrapNode = SetupCodexNode();
|
||||
var group = SetupCodexNodes(2, s => s.WithBootstrapNode(bootstrapNode));
|
||||
var primary = group[0];
|
||||
var secondary = group[1];
|
||||
|
||||
|
@ -31,10 +31,10 @@ namespace Tests.DurabilityTests
|
|||
[Test]
|
||||
public void DataRetentionTest()
|
||||
{
|
||||
var bootstrapNode = SetupCodexNodes(1).WithLogLevel(CodexLogLevel.Trace).BringOnline()[0];
|
||||
var bootstrapNode = SetupCodexNode(s => s.WithLogLevel(CodexLogLevel.Trace));
|
||||
|
||||
var startGroup = SetupCodexNodes(2).WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode).BringOnline();
|
||||
var finishGroup = SetupCodexNodes(10).WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode).BringOnline();
|
||||
var startGroup = SetupCodexNodes(2, s => s.WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode));
|
||||
var finishGroup = SetupCodexNodes(10, s => s.WithLogLevel(CodexLogLevel.Trace).WithBootstrapNode(bootstrapNode));
|
||||
|
||||
var file = GenerateTestFile(10.MB());
|
||||
|
||||
|
|
Loading…
Reference in New Issue