Restores full-connectivity tests.
This commit is contained in:
parent
84dd514517
commit
ec5aebb47b
|
@ -110,7 +110,7 @@ namespace DistTestCore
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ScopedTestFiles(Action action)
|
public void ScopedTestFiles(Action action)
|
||||||
{
|
{
|
||||||
Get().ScopedTestFiles(action);
|
Get().GetFileManager().ScopedFiles(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public IOnlineCodexNode SetupCodexBootstrapNode()
|
//public IOnlineCodexNode SetupCodexBootstrapNode()
|
||||||
|
@ -183,16 +183,6 @@ namespace DistTestCore
|
||||||
GetTestLog().Debug(msg);
|
GetTestLog().Debug(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public PeerConnectionTestHelpers CreatePeerConnectionTestHelpers()
|
|
||||||
//{
|
|
||||||
// return new PeerConnectionTestHelpers(GetTestLog());
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public PeerDownloadTestHelpers CreatePeerDownloadTestHelpers()
|
|
||||||
//{
|
|
||||||
// return new PeerDownloadTestHelpers(GetTestLog(), Get().FileManager);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void Measure(string name, Action action)
|
public void Measure(string name, Action action)
|
||||||
{
|
{
|
||||||
Stopwatch.Measure(Get().Log, name, action);
|
Stopwatch.Measure(Get().Log, name, action);
|
||||||
|
@ -203,7 +193,7 @@ namespace DistTestCore
|
||||||
// return new CodexSetup(numberOfNodes, configuration.GetCodexLogLevel());
|
// return new CodexSetup(numberOfNodes, configuration.GetCodexLogLevel());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
private TestLifecycle Get()
|
protected TestLifecycle Get()
|
||||||
{
|
{
|
||||||
lock (lifecycleLock)
|
lock (lifecycleLock)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,9 +40,9 @@ namespace DistTestCore
|
||||||
return entryPoint.Tools.GetFileManager().GenerateFile(size, label);
|
return entryPoint.Tools.GetFileManager().GenerateFile(size, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScopedTestFiles(Action action)
|
public IFileManager GetFileManager()
|
||||||
{
|
{
|
||||||
entryPoint.Tools.GetFileManager().ScopedFiles(action);
|
return entryPoint.Tools.GetFileManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public IDownloadedLog DownloadLog(RunningContainer container, int? tailLines = null)
|
//public IDownloadedLog DownloadLog(RunningContainer container, int? tailLines = null)
|
||||||
|
|
|
@ -1,45 +1,26 @@
|
||||||
using CodexPlugin;
|
using CodexPlugin;
|
||||||
using DistTestCore;
|
using DistTestCore;
|
||||||
|
using DistTestCore.Helpers;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
{
|
{
|
||||||
public class AutoBootstrapDistTest : DistTest
|
public class AutoBootstrapDistTest : CodexDistTest
|
||||||
{
|
{
|
||||||
public IOnlineCodexNode AddCodex()
|
private readonly List<IOnlineCodexNode> onlineCodexNodes = new List<IOnlineCodexNode>();
|
||||||
{
|
|
||||||
return AddCodex(s => { });
|
|
||||||
}
|
|
||||||
|
|
||||||
public IOnlineCodexNode AddCodex(Action<ICodexSetup> setup)
|
|
||||||
{
|
|
||||||
return Ci.SetupCodexNode(s =>
|
|
||||||
{
|
|
||||||
setup(s);
|
|
||||||
s.WithBootstrapNode(BootstrapNode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICodexNodeGroup AddCodex(int numberOfNodes)
|
|
||||||
{
|
|
||||||
return Ci.SetupCodexNodes(numberOfNodes, s => s.WithBootstrapNode(BootstrapNode));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICodexNodeGroup AddCodex(int numberOfNodes, Action<ICodexSetup> setup)
|
|
||||||
{
|
|
||||||
return Ci.SetupCodexNodes(numberOfNodes, s =>
|
|
||||||
{
|
|
||||||
setup(s);
|
|
||||||
s.WithBootstrapNode(BootstrapNode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUpBootstrapNode()
|
public void SetUpBootstrapNode()
|
||||||
{
|
{
|
||||||
BootstrapNode = Ci.SetupCodexNode(s => s.WithName("BOOTSTRAP"));
|
BootstrapNode = AddCodex(s => s.WithName("BOOTSTRAP"));
|
||||||
|
onlineCodexNodes.Add(BootstrapNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IOnlineCodexNode BootstrapNode { get; private set; } = null!;
|
protected override void OnCodexSetup(ICodexSetup setup)
|
||||||
|
{
|
||||||
|
if (BootstrapNode != null) setup.WithBootstrapNode(BootstrapNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IOnlineCodexNode? BootstrapNode { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
using CodexPlugin;
|
||||||
|
using DistTestCore;
|
||||||
|
using DistTestCore.Helpers;
|
||||||
|
|
||||||
|
namespace Tests
|
||||||
|
{
|
||||||
|
public class CodexDistTest : DistTest
|
||||||
|
{
|
||||||
|
private readonly List<IOnlineCodexNode> onlineCodexNodes = new List<IOnlineCodexNode>();
|
||||||
|
|
||||||
|
public IOnlineCodexNode AddCodex()
|
||||||
|
{
|
||||||
|
return AddCodex(s => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOnlineCodexNode AddCodex(Action<ICodexSetup> setup)
|
||||||
|
{
|
||||||
|
return AddCodex(1, setup)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICodexNodeGroup AddCodex(int numberOfNodes)
|
||||||
|
{
|
||||||
|
return AddCodex(numberOfNodes, s => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICodexNodeGroup AddCodex(int numberOfNodes, Action<ICodexSetup> setup)
|
||||||
|
{
|
||||||
|
var group = Ci.SetupCodexNodes(numberOfNodes, s =>
|
||||||
|
{
|
||||||
|
setup(s);
|
||||||
|
OnCodexSetup(s);
|
||||||
|
});
|
||||||
|
onlineCodexNodes.AddRange(group);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeerConnectionTestHelpers CreatePeerConnectionTestHelpers()
|
||||||
|
{
|
||||||
|
return new PeerConnectionTestHelpers(GetTestLog());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeerDownloadTestHelpers CreatePeerDownloadTestHelpers()
|
||||||
|
{
|
||||||
|
return new PeerDownloadTestHelpers(GetTestLog(), Get().GetFileManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IOnlineCodexNode> GetAllOnlineCodexNodes()
|
||||||
|
{
|
||||||
|
return onlineCodexNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnCodexSetup(ICodexSetup setup)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using CodexPlugin;
|
using NUnit.Framework;
|
||||||
using DistTestCore;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
namespace Tests.DownloadConnectivityTests
|
namespace Tests.DownloadConnectivityTests
|
||||||
|
@ -11,7 +9,7 @@ namespace Tests.DownloadConnectivityTests
|
||||||
[Test]
|
[Test]
|
||||||
public void MetricsDoesNotInterfereWithPeerDownload()
|
public void MetricsDoesNotInterfereWithPeerDownload()
|
||||||
{
|
{
|
||||||
//AddCodex(2, s => s.EnableMetrics());
|
AddCodex(2, s => s.EnableMetrics());
|
||||||
|
|
||||||
AssertAllNodesConnected();
|
AssertAllNodesConnected();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +35,7 @@ namespace Tests.DownloadConnectivityTests
|
||||||
|
|
||||||
private void AssertAllNodesConnected(int sizeMBs = 10)
|
private void AssertAllNodesConnected(int sizeMBs = 10)
|
||||||
{
|
{
|
||||||
//CreatePeerDownloadTestHelpers().AssertFullDownloadInterconnectivity(GetAllOnlineCodexNodes(), sizeMBs.MB());
|
CreatePeerDownloadTestHelpers().AssertFullDownloadInterconnectivity(GetAllOnlineCodexNodes(), sizeMBs.MB());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@ namespace DistTestCore.Helpers
|
||||||
{
|
{
|
||||||
private readonly FullConnectivityHelper helper;
|
private readonly FullConnectivityHelper helper;
|
||||||
private readonly ILog log;
|
private readonly ILog log;
|
||||||
private readonly FileManager fileManager;
|
private readonly IFileManager fileManager;
|
||||||
private ByteSize testFileSize;
|
private ByteSize testFileSize;
|
||||||
|
|
||||||
public PeerDownloadTestHelpers(ILog log, FileManager fileManager)
|
public PeerDownloadTestHelpers(ILog log, IFileManager fileManager)
|
||||||
{
|
{
|
||||||
helper = new FullConnectivityHelper(log, this);
|
helper = new FullConnectivityHelper(log, this);
|
||||||
testFileSize = 1.MB();
|
testFileSize = 1.MB();
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
using CodexPlugin;
|
using CodexPlugin;
|
||||||
using DistTestCore;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests.PeerDiscoveryTests
|
namespace Tests.PeerDiscoveryTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class LayeredDiscoveryTests : DistTest
|
public class LayeredDiscoveryTests : CodexDistTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void TwoLayersTest()
|
public void TwoLayersTest()
|
||||||
|
@ -47,7 +46,7 @@ namespace Tests.PeerDiscoveryTests
|
||||||
|
|
||||||
private void AssertAllNodesConnected()
|
private void AssertAllNodesConnected()
|
||||||
{
|
{
|
||||||
//CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
|
CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using DistTestCore;
|
using NUnit.Framework;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace Tests.PeerDiscoveryTests
|
namespace Tests.PeerDiscoveryTests
|
||||||
{
|
{
|
||||||
|
@ -45,7 +44,7 @@ namespace Tests.PeerDiscoveryTests
|
||||||
|
|
||||||
private void AssertAllNodesConnected()
|
private void AssertAllNodesConnected()
|
||||||
{
|
{
|
||||||
//CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
|
CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue