Setting up way to run different codex images
This commit is contained in:
parent
2de7fc7f20
commit
f23926636c
|
@ -6,7 +6,7 @@ namespace DistTestCore
|
|||
{
|
||||
public override IOnlineCodexNode SetupCodexBootstrapNode(Action<ICodexSetup> setup)
|
||||
{
|
||||
throw new Exception("AutoBootstrapDistTest creates and attaches a single boostrap node for you. " +
|
||||
throw new Exception("AutoBootstrapDistTest creates and attaches a single bootstrap node for you. " +
|
||||
"If you want to control the bootstrap node from your test, please use DistTest instead.");
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ namespace DistTestCore
|
|||
[SetUp]
|
||||
public void SetUpBootstrapNode()
|
||||
{
|
||||
BootstrapNode = BringOnline(CreateCodexSetup(1))[0];
|
||||
var setup = CreateCodexSetup(1).WithName("BOOTSTRAP");
|
||||
BootstrapNode = BringOnline(setup)[0];
|
||||
}
|
||||
|
||||
protected IOnlineCodexNode BootstrapNode { get; private set; } = null!;
|
||||
|
|
|
@ -22,12 +22,12 @@ namespace DistTestCore.Codex
|
|||
|
||||
public CodexDebugResponse GetDebugInfo()
|
||||
{
|
||||
return Http(TimeSpan.FromSeconds(2)).HttpGetJson<CodexDebugResponse>("debug/info");
|
||||
return Http(TimeSpan.FromSeconds(60)).HttpGetJson<CodexDebugResponse>("debug/info");
|
||||
}
|
||||
|
||||
public CodexDebugPeerResponse GetDebugPeer(string peerId)
|
||||
{
|
||||
return GetDebugPeer(peerId, TimeSpan.FromSeconds(2));
|
||||
return GetDebugPeer(peerId, TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
public CodexDebugPeerResponse GetDebugPeer(string peerId, TimeSpan timeout)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using DistTestCore.Marketplace;
|
||||
using KubernetesWorkflow;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace DistTestCore.Codex
|
||||
{
|
||||
|
@ -9,8 +8,8 @@ namespace DistTestCore.Codex
|
|||
#if Arm64
|
||||
public const string DockerImage = "codexstorage/nim-codex:sha-6dd7e55";
|
||||
#else
|
||||
//public const string DockerImage = "thatbenbierens/nim-codex:dhting";
|
||||
public const string DockerImage = "codexstorage/nim-codex:sha-6dd7e55";
|
||||
public const string DockerImage = "thatbenbierens/nim-codex:loopingyeah";
|
||||
//public const string DockerImage = "codexstorage/nim-codex:sha-6dd7e55";
|
||||
#endif
|
||||
public const string MetricsPortTag = "metrics_port";
|
||||
public const string DiscoveryPortTag = "discovery-port";
|
||||
|
@ -19,7 +18,16 @@ namespace DistTestCore.Codex
|
|||
public static readonly TimeSpan MaxUploadTimePerMegabyte = TimeSpan.FromSeconds(2.0);
|
||||
public static readonly TimeSpan MaxDownloadTimePerMegabyte = TimeSpan.FromSeconds(2.0);
|
||||
|
||||
protected override string Image => DockerImage;
|
||||
public static string DockerImageOverride = string.Empty;
|
||||
|
||||
protected override string Image
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DockerImageOverride)) return DockerImageOverride;
|
||||
return DockerImage;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Initialize(StartupConfig startupConfig)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace DistTestCore
|
|||
|
||||
var group = CreateCodexGroup(codexSetup, containers, codexNodeFactory);
|
||||
var podInfo = group.Containers.RunningPod.PodInfo;
|
||||
LogEnd($"Started {codexSetup.NumberOfNodes} nodes at location '{podInfo.K8SNodeName}'={podInfo.Ip}. They are: {group.Describe()}");
|
||||
LogEnd($"Started {codexSetup.NumberOfNodes} nodes of image '{containers.Containers.First().Recipe.Image}' at location '{podInfo.K8SNodeName}'={podInfo.Ip}. They are: {group.Describe()}");
|
||||
LogSeparator();
|
||||
return group;
|
||||
}
|
||||
|
|
|
@ -52,12 +52,12 @@ namespace DistTestCore.Helpers
|
|||
|
||||
private static void RetryWhilePairs(List<Pair> pairs, Action action)
|
||||
{
|
||||
var timeout = DateTime.UtcNow + TimeSpan.FromMinutes(10);
|
||||
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);
|
||||
while (pairs.Any() && timeout > DateTime.UtcNow)
|
||||
{
|
||||
action();
|
||||
|
||||
if (pairs.Any()) Time.Sleep(TimeSpan.FromSeconds(5));
|
||||
if (pairs.Any()) Time.Sleep(TimeSpan.FromSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,12 @@ namespace DistTestCore.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (Response == null || string.IsNullOrEmpty(Response.id)) return "UNKNOWN";
|
||||
return Response.id;
|
||||
}
|
||||
|
||||
private static string GetExpectedDiscoveryEndpoint(Entry[] allEntries, CodexDebugTableNodeResponse node)
|
||||
{
|
||||
var peer = allEntries.SingleOrDefault(e => e.Response.table.localNode.peerId == node.peerId);
|
||||
|
@ -188,10 +194,15 @@ namespace DistTestCore.Helpers
|
|||
return GetResultMessage() + GetTimePostfix();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{GetMessage()}]";
|
||||
}
|
||||
|
||||
private string GetResultMessage()
|
||||
{
|
||||
var aName = A.Response.id;
|
||||
var bName = B.Response.id;
|
||||
var aName = A.ToString();
|
||||
var bName = B.ToString();
|
||||
|
||||
if (Success)
|
||||
{
|
||||
|
@ -203,8 +214,8 @@ namespace DistTestCore.Helpers
|
|||
|
||||
private string GetTimePostfix()
|
||||
{
|
||||
var aName = A.Response.id;
|
||||
var bName = B.Response.id;
|
||||
var aName = A.ToString();
|
||||
var bName = B.ToString();
|
||||
|
||||
return $" ({aName}->{bName}: {aToBTime.TotalMinutes} seconds, {bName}->{aName}: {bToATime.TotalSeconds} seconds)";
|
||||
}
|
||||
|
|
|
@ -127,16 +127,18 @@ namespace DistTestCore
|
|||
|
||||
private T Retry<T>(Func<T> operation, string description)
|
||||
{
|
||||
return Time.Retry(operation, timeSet.HttpCallRetryTimeout(), timeSet.HttpCallRetryDelay(), description);
|
||||
return Time.Retry(operation, GetTimeout(), timeSet.HttpCallRetryDelay(), description);
|
||||
}
|
||||
|
||||
private HttpClient GetClient()
|
||||
{
|
||||
if (timeoutOverride.HasValue)
|
||||
{
|
||||
return GetClient(timeoutOverride.Value);
|
||||
}
|
||||
return GetClient(timeSet.HttpCallTimeout());
|
||||
return GetClient(GetTimeout());
|
||||
}
|
||||
|
||||
private TimeSpan GetTimeout()
|
||||
{
|
||||
if (timeoutOverride.HasValue) return timeoutOverride.Value;
|
||||
return timeSet.HttpCallTimeout();
|
||||
}
|
||||
|
||||
private HttpClient GetClient(TimeSpan timeout)
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace DistTestCore
|
|||
|
||||
public TimeSpan K8sOperationTimeout()
|
||||
{
|
||||
return TimeSpan.FromMinutes(5);
|
||||
return TimeSpan.FromMinutes(1);
|
||||
}
|
||||
|
||||
public TimeSpan WaitForMetricTimeout()
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Logging
|
|||
if (!string.IsNullOrEmpty(name)) return name;
|
||||
var test = TestContext.CurrentContext.Test;
|
||||
var args = FormatArguments(test);
|
||||
return $"{test.MethodName}{args}";
|
||||
return ReplaceInvalidCharacters($"{test.MethodName}{args}");
|
||||
}
|
||||
|
||||
private static string FormatArguments(TestContext.TestAdapter test)
|
||||
|
@ -51,5 +51,10 @@ namespace Logging
|
|||
if (test.Arguments == null || !test.Arguments.Any()) return "";
|
||||
return $"[{string.Join(',', test.Arguments)}]";
|
||||
}
|
||||
|
||||
private static string ReplaceInvalidCharacters(string name)
|
||||
{
|
||||
return name.Replace(":", "_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using DistTestCore;
|
||||
using DistTestCore.Helpers;
|
||||
using NUnit.Framework;
|
||||
using Utils;
|
||||
|
||||
namespace Tests.PeerDiscoveryTests
|
||||
{
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using DistTestCore;
|
||||
using DistTestCore.Codex;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Tests.PeerDiscoveryTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class VariableImageTests : DistTest
|
||||
{
|
||||
[TestCase("nim-codex:sha-a899384")]
|
||||
[TestCase("nim-codex:sha-3879ec8")]
|
||||
[TestCase("nim-codex:sha-6dd7e55")]
|
||||
[TestCase("nim-codex:sha-3f2b417")]
|
||||
[TestCase("nim-codex:sha-00f6554")]
|
||||
[TestCase("nim-codex:sha-f053135")]
|
||||
public void ThreeNodes(string dockerImage)
|
||||
{
|
||||
var img = "codexstorage/" + dockerImage;
|
||||
Log("Image override: " + img);
|
||||
CodexContainerRecipe.DockerImageOverride = img;
|
||||
|
||||
var boot = SetupCodexBootstrapNode();
|
||||
SetupCodexNode(c => c.WithBootstrapNode(boot));
|
||||
SetupCodexNode(c => c.WithBootstrapNode(boot));
|
||||
|
||||
PeerConnectionTestHelpers.AssertFullyConnected(GetAllOnlineCodexNodes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue