mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-03-09 13:13:06 +00:00
wired up except for container log access
This commit is contained in:
parent
ee0193c879
commit
0aac2d8e98
@ -31,7 +31,7 @@ namespace CodexPlugin
|
||||
public void Stop(bool waitTillStopped)
|
||||
{
|
||||
CrashWatcher.Stop();
|
||||
processControl.Stop(instance);
|
||||
processControl.Stop(instance, waitTillStopped);
|
||||
// Prevents accidental use after stop:
|
||||
instance = null!;
|
||||
}
|
||||
@ -203,6 +203,16 @@ namespace CodexPlugin
|
||||
//);
|
||||
}
|
||||
|
||||
public Address GetApiEndpoint()
|
||||
{
|
||||
return instance.ApiEndpoint;
|
||||
}
|
||||
|
||||
public Address GetListenEndpoint()
|
||||
{
|
||||
return instance.ListenEndpoint;
|
||||
}
|
||||
|
||||
public Address? GetMetricsEndpoint()
|
||||
{
|
||||
return instance.GetMetricsEndpoint();
|
||||
|
||||
@ -13,6 +13,7 @@ namespace CodexPlugin
|
||||
DateTime StartUtc { get; }
|
||||
Address DiscoveryEndpoint { get; }
|
||||
Address ApiEndpoint { get; }
|
||||
Address ListenEndpoint { get; }
|
||||
void DeleteDataDirFolder();
|
||||
EthAccount? GetEthAccount();
|
||||
Address? GetMetricsEndpoint();
|
||||
@ -37,6 +38,7 @@ namespace CodexPlugin
|
||||
|
||||
DiscoveryEndpoint = container.GetAddress(CodexContainerRecipe.DiscoveryPortTag);
|
||||
ApiEndpoint = container.GetAddress(CodexContainerRecipe.ApiPortTag);
|
||||
ListenEndpoint = container.GetAddress(CodexContainerRecipe.ListenPortTag);
|
||||
|
||||
if (pod.StartupConfig.Get<CodexSetup>().MetricsEnabled)
|
||||
{
|
||||
@ -50,6 +52,7 @@ namespace CodexPlugin
|
||||
public DateTime StartUtc { get; }
|
||||
public Address DiscoveryEndpoint { get; }
|
||||
public Address ApiEndpoint { get; }
|
||||
public Address ListenEndpoint { get; }
|
||||
|
||||
public void DeleteDataDirFolder()
|
||||
{
|
||||
|
||||
@ -11,6 +11,7 @@ namespace CodexPlugin
|
||||
public interface ICodexNode : IHasMetricsScrapeTarget, IHasEthAddress
|
||||
{
|
||||
string GetName();
|
||||
string GetImageName();
|
||||
string GetPeerId();
|
||||
DebugInfo GetDebugInfo(bool log = false);
|
||||
string GetSpr();
|
||||
@ -36,6 +37,8 @@ namespace CodexPlugin
|
||||
EthAccount EthAccount { get; }
|
||||
|
||||
Address GetDiscoveryEndpoint();
|
||||
Address GetApiEndpoint();
|
||||
Address GetListenEndpoint();
|
||||
|
||||
/// <summary>
|
||||
/// Warning! The node is not usable after this.
|
||||
@ -119,6 +122,11 @@ namespace CodexPlugin
|
||||
return codexAccess.GetName();
|
||||
}
|
||||
|
||||
public string GetImageName()
|
||||
{
|
||||
return codexAccess.GetImageName();
|
||||
}
|
||||
|
||||
public string GetPeerId()
|
||||
{
|
||||
return peerId;
|
||||
@ -269,6 +277,16 @@ namespace CodexPlugin
|
||||
return codexAccess.GetDiscoveryEndpoint();
|
||||
}
|
||||
|
||||
public Address GetApiEndpoint()
|
||||
{
|
||||
return codexAccess.GetApiEndpoint();
|
||||
}
|
||||
|
||||
public Address GetListenEndpoint()
|
||||
{
|
||||
return codexAccess.GetListenEndpoint();
|
||||
}
|
||||
|
||||
public bool HasCrashed()
|
||||
{
|
||||
return codexAccess.CrashWatcher.HasCrashed();
|
||||
|
||||
@ -72,7 +72,7 @@ namespace CodexPlugin
|
||||
|
||||
private void Log(string msg)
|
||||
{
|
||||
log.Log($"{codexAccess.Container.Containers.Single().Name} {msg}");
|
||||
log.Log($"{codexAccess.GetName()} {msg}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ using DistTestCore;
|
||||
using FileUtils;
|
||||
using Logging;
|
||||
using MetricsPlugin;
|
||||
using Utils;
|
||||
|
||||
namespace ContinuousTests
|
||||
{
|
||||
@ -53,7 +54,7 @@ namespace ContinuousTests
|
||||
return CreateMetricsAccess(target.MetricsScrapeTarget);
|
||||
}
|
||||
|
||||
public IMetricsAccess CreateMetricsAccess(IMetricsScrapeTarget target)
|
||||
public IMetricsAccess CreateMetricsAccess(Address target)
|
||||
{
|
||||
if (Configuration.CodexDeployment.PrometheusContainer == null) throw new Exception("Expected prometheus to be part of Codex deployment.");
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ namespace ContinuousTests
|
||||
{
|
||||
var serviceName = "elasticsearch";
|
||||
var k8sNamespace = "monitoring";
|
||||
var address = new Address($"http://{serviceName}.{k8sNamespace}.svc.cluster.local", 9200);
|
||||
var address = new Address("ElasticSearchEndpoint", $"http://{serviceName}.{k8sNamespace}.svc.cluster.local", 9200);
|
||||
var baseUrl = "";
|
||||
|
||||
var http = tools.CreateHttp(address.ToString(), client =>
|
||||
|
||||
@ -40,7 +40,7 @@ namespace ContinuousTests
|
||||
var entryPoint = CreateEntryPoint();
|
||||
// We have to be sure that the transient node we start is using the same image as whatever's already in the deployed network.
|
||||
// Therefore, we use the image of the bootstrap node.
|
||||
CodexContainerRecipe.DockerImageOverride = bootstrapNode.Container.Recipe.Image;
|
||||
CodexContainerRecipe.DockerImageOverride = bootstrapNode.GetImageName();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -285,7 +285,7 @@ namespace ContinuousTests
|
||||
private string GetContainerNames()
|
||||
{
|
||||
if (handle.Test.RequiredNumberOfNodes == -1) return "(All Nodes)";
|
||||
return $"({string.Join(",", nodes.Select(n => n.Container.Name))})";
|
||||
return $"({string.Join(",", nodes.Select(n => n.GetName()))})";
|
||||
}
|
||||
|
||||
private ICodexNode[] CreateRandomNodes()
|
||||
|
||||
@ -98,8 +98,8 @@ namespace ContinuousTests
|
||||
{
|
||||
cancelToken.ThrowIfCancellationRequested();
|
||||
|
||||
var address = n.Container.GetAddress(CodexContainerRecipe.ApiPortTag);
|
||||
log.Log($"Checking {n.Container.Name} @ '{address}'...");
|
||||
var address = n.GetApiEndpoint();
|
||||
log.Log($"Checking {n.GetName()} @ '{address}'...");
|
||||
|
||||
if (EnsureOnline(log, n))
|
||||
{
|
||||
|
||||
@ -38,7 +38,7 @@ namespace CodexReleaseTests.DataTests
|
||||
|
||||
private Process StartCurlUploadProcess(ICodexNode node, TrackedFile file)
|
||||
{
|
||||
var apiAddress = node.Container.GetAddress(CodexContainerRecipe.ApiPortTag);
|
||||
var apiAddress = node.GetApiEndpoint();
|
||||
var codexUrl = $"{apiAddress}/api/codex/v1/data";
|
||||
var filePath = file.Filename;
|
||||
return Process.Start("curl", $"-X POST {codexUrl} -H \"Content-Type: application/octet-stream\" -T {filePath}");
|
||||
|
||||
@ -36,7 +36,7 @@ namespace CodexReleaseTests.MarketTests
|
||||
request.WaitForStorageContractStarted();
|
||||
AssertContractSlotsAreFilledByHosts(request, hosts);
|
||||
|
||||
hosts.BringOffline(waitTillStopped: true);
|
||||
hosts.Stop(waitTillStopped: true);
|
||||
|
||||
WaitForSlotFreedEvents();
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ namespace CodexReleaseTests.NodeTests
|
||||
public void AnnounceAddress()
|
||||
{
|
||||
var node = StartCodex();
|
||||
var addr = node.Container.GetInternalAddress(CodexContainerRecipe.ListenPortTag);
|
||||
var addr = node.GetListenEndpoint();
|
||||
|
||||
var info = node.GetDebugInfo();
|
||||
|
||||
|
||||
@ -94,6 +94,7 @@ public class Program
|
||||
var port = Convert.ToInt32(endpoint.Substring(splitIndex + 1));
|
||||
|
||||
var address = new Address(
|
||||
logName: $"cdx@{host}:{port}",
|
||||
host: host,
|
||||
port: port
|
||||
);
|
||||
|
||||
@ -172,6 +172,7 @@ namespace BiblioTech
|
||||
var port = Convert.ToInt32(endpoint.Substring(splitIndex + 1));
|
||||
|
||||
var address = new Address(
|
||||
logName: $"cdx@{host}:{port}",
|
||||
host: host,
|
||||
port: port
|
||||
);
|
||||
|
||||
@ -201,12 +201,12 @@ namespace CodexNetDeployer
|
||||
|
||||
private void CheckContainerRestarts(List<CodexNodeStartResult> startResults)
|
||||
{
|
||||
var crashes = new List<RunningContainer>();
|
||||
var crashes = new List<ICodexNode>();
|
||||
Log("Starting container crash check...");
|
||||
foreach (var startResult in startResults)
|
||||
{
|
||||
var hasCrashed = startResult.CodexNode.HasCrashed();
|
||||
if (hasCrashed) crashes.Add(startResult.CodexNode.Container);
|
||||
if (hasCrashed) crashes.Add(startResult.CodexNode);
|
||||
}
|
||||
|
||||
if (!crashes.Any())
|
||||
@ -216,7 +216,7 @@ namespace CodexNetDeployer
|
||||
else
|
||||
{
|
||||
Log(
|
||||
$"Check failed. The following containers have crashed: {string.Join(",", crashes.Select(c => c.Name))}");
|
||||
$"Check failed. The following containers have crashed: {string.Join(",", crashes.Select(c => c.GetName()))}");
|
||||
throw new Exception("Deployment failed: One or more containers crashed.");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user