mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-07 07:53:05 +00:00
Removes container-related concepts from CodexNode type
This commit is contained in:
parent
8ef190baad
commit
2292d2e672
@ -34,17 +34,18 @@ namespace CodexPlugin
|
||||
void ConnectToPeer(ICodexNode node);
|
||||
DebugInfoVersion Version { get; }
|
||||
IMarketplaceAccess Marketplace { get; }
|
||||
CrashWatcher CrashWatcher { get; }
|
||||
PodInfo GetPodInfo();
|
||||
ITransferSpeeds TransferSpeeds { get; }
|
||||
EthAccount EthAccount { get; }
|
||||
|
||||
Address GetDiscoveryEndpoint();
|
||||
|
||||
/// <summary>
|
||||
/// Warning! The node is not usable after this.
|
||||
/// TODO: Replace with delete-blocks debug call once available in Codex.
|
||||
/// </summary>
|
||||
void DeleteRepoFolder();
|
||||
void Stop(bool waitTillStopped);
|
||||
bool HasCrashed();
|
||||
}
|
||||
|
||||
public class CodexNode : ICodexNode
|
||||
@ -256,11 +257,6 @@ namespace CodexPlugin
|
||||
Log($"Successfully connected to peer {peer.GetName()}.");
|
||||
}
|
||||
|
||||
public PodInfo GetPodInfo()
|
||||
{
|
||||
return CodexAccess.GetPodInfo();
|
||||
}
|
||||
|
||||
public void DeleteRepoFolder()
|
||||
{
|
||||
CodexAccess.DeleteRepoFolder();
|
||||
@ -294,6 +290,20 @@ namespace CodexPlugin
|
||||
Version = debugInfo.Version;
|
||||
}
|
||||
|
||||
public Address GetDiscoveryEndpoint()
|
||||
{
|
||||
var info = CodexAccess.GetPodInfo();
|
||||
return new Address(
|
||||
host: info.Ip,
|
||||
port: Container.Recipe.GetPortByTag(CodexContainerRecipe.DiscoveryPortTag)!.Number
|
||||
);
|
||||
}
|
||||
|
||||
public bool HasCrashed()
|
||||
{
|
||||
return CrashWatcher.HasContainerCrashed();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"CodexNode:{GetName()}";
|
||||
|
||||
@ -61,11 +61,9 @@ namespace CodexPlugin
|
||||
public void BringOffline(CodexNodeGroup group, bool waitTillStopped)
|
||||
{
|
||||
Log($"Stopping {group.Describe()}...");
|
||||
StopCrashWatcher(group);
|
||||
var workflow = pluginTools.CreateWorkflow();
|
||||
foreach (var c in group.Containers)
|
||||
foreach (var node in group)
|
||||
{
|
||||
workflow.Stop(c, waitTillStopped);
|
||||
node.Stop(waitTillStopped);
|
||||
}
|
||||
Log("Stopped.");
|
||||
}
|
||||
@ -157,13 +155,5 @@ namespace CodexPlugin
|
||||
{
|
||||
pluginTools.GetLog().Log(message);
|
||||
}
|
||||
|
||||
private void StopCrashWatcher(CodexNodeGroup group)
|
||||
{
|
||||
foreach (var node in group)
|
||||
{
|
||||
node.CrashWatcher.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,7 +204,6 @@ namespace ContinuousTests
|
||||
result.Add("testname", testName);
|
||||
result.Add("message", message);
|
||||
result.Add("involvedpods", string.Join(",", nodes.Select(n => n.GetName())));
|
||||
result.Add("involvedpodnames", string.Join(",", nodes.Select(n => n.GetPodInfo().Name)));
|
||||
|
||||
var error = message.Split(Environment.NewLine).First();
|
||||
if (error.Contains(":")) error = error.Substring(1 + error.LastIndexOf(":"));
|
||||
|
||||
@ -57,12 +57,7 @@ namespace CodexTests.Helpers
|
||||
{
|
||||
var peer = allEntries.SingleOrDefault(e => e.Response.Table.LocalNode.PeerId == node.PeerId);
|
||||
if (peer == null) return $"peerId: {node.PeerId} is not known.";
|
||||
|
||||
var container = peer.Node.Container;
|
||||
var podInfo = peer.Node.GetPodInfo();
|
||||
var ip = podInfo.Ip;
|
||||
var discPort = container.Recipe.GetPortByTag(CodexContainerRecipe.DiscoveryPortTag)!;
|
||||
return $"{ip}:{discPort.Number}";
|
||||
return peer.Node.GetDiscoveryEndpoint().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,10 +205,8 @@ namespace CodexNetDeployer
|
||||
Log("Starting container crash check...");
|
||||
foreach (var startResult in startResults)
|
||||
{
|
||||
var watcher = startResult.CodexNode.CrashWatcher;
|
||||
if (watcher == null)
|
||||
throw new Exception("Expected each CodexNode container to be created with a crash-watcher.");
|
||||
if (watcher.HasContainerCrashed()) crashes.Add(startResult.CodexNode.Container);
|
||||
var hasCrashed = startResult.CodexNode.HasCrashed();
|
||||
if (hasCrashed) crashes.Add(startResult.CodexNode.Container);
|
||||
}
|
||||
|
||||
if (!crashes.Any())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user