diff --git a/ProjectPlugins/CodexPlugin/CodexAccess.cs b/ProjectPlugins/CodexPlugin/CodexAccess.cs index 8271344b..4981dc10 100644 --- a/ProjectPlugins/CodexPlugin/CodexAccess.cs +++ b/ProjectPlugins/CodexPlugin/CodexAccess.cs @@ -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(); diff --git a/ProjectPlugins/CodexPlugin/CodexInstance.cs b/ProjectPlugins/CodexPlugin/CodexInstance.cs index 8c0c41ba..9f7a1a19 100644 --- a/ProjectPlugins/CodexPlugin/CodexInstance.cs +++ b/ProjectPlugins/CodexPlugin/CodexInstance.cs @@ -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().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() { diff --git a/ProjectPlugins/CodexPlugin/CodexNode.cs b/ProjectPlugins/CodexPlugin/CodexNode.cs index 9c3e6fa3..ab72dc5e 100644 --- a/ProjectPlugins/CodexPlugin/CodexNode.cs +++ b/ProjectPlugins/CodexPlugin/CodexNode.cs @@ -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(); /// /// 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(); diff --git a/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs b/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs index a657e9b0..34720df7 100644 --- a/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs +++ b/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs @@ -72,7 +72,7 @@ namespace CodexPlugin private void Log(string msg) { - log.Log($"{codexAccess.Container.Containers.Single().Name} {msg}"); + log.Log($"{codexAccess.GetName()} {msg}"); } } diff --git a/Tests/CodexContinuousTests/ContinuousTest.cs b/Tests/CodexContinuousTests/ContinuousTest.cs index 5b746682..00a4c3a7 100644 --- a/Tests/CodexContinuousTests/ContinuousTest.cs +++ b/Tests/CodexContinuousTests/ContinuousTest.cs @@ -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."); diff --git a/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs b/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs index 397b5db1..ecd646dd 100644 --- a/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs +++ b/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs @@ -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 => diff --git a/Tests/CodexContinuousTests/NodeRunner.cs b/Tests/CodexContinuousTests/NodeRunner.cs index 77a383e1..b69792fe 100644 --- a/Tests/CodexContinuousTests/NodeRunner.cs +++ b/Tests/CodexContinuousTests/NodeRunner.cs @@ -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 { diff --git a/Tests/CodexContinuousTests/SingleTestRun.cs b/Tests/CodexContinuousTests/SingleTestRun.cs index 8b77b775..a8a798ad 100644 --- a/Tests/CodexContinuousTests/SingleTestRun.cs +++ b/Tests/CodexContinuousTests/SingleTestRun.cs @@ -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() diff --git a/Tests/CodexContinuousTests/StartupChecker.cs b/Tests/CodexContinuousTests/StartupChecker.cs index ca4c8874..94f2d978 100644 --- a/Tests/CodexContinuousTests/StartupChecker.cs +++ b/Tests/CodexContinuousTests/StartupChecker.cs @@ -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)) { diff --git a/Tests/CodexReleaseTests/DataTests/InterruptUploadTest.cs b/Tests/CodexReleaseTests/DataTests/InterruptUploadTest.cs index ae9c9d58..ad1f6c64 100644 --- a/Tests/CodexReleaseTests/DataTests/InterruptUploadTest.cs +++ b/Tests/CodexReleaseTests/DataTests/InterruptUploadTest.cs @@ -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}"); diff --git a/Tests/CodexReleaseTests/MarketTests/ContractFailedTest.cs b/Tests/CodexReleaseTests/MarketTests/ContractFailedTest.cs index 6a0f9c51..dd79c6af 100644 --- a/Tests/CodexReleaseTests/MarketTests/ContractFailedTest.cs +++ b/Tests/CodexReleaseTests/MarketTests/ContractFailedTest.cs @@ -36,7 +36,7 @@ namespace CodexReleaseTests.MarketTests request.WaitForStorageContractStarted(); AssertContractSlotsAreFilledByHosts(request, hosts); - hosts.BringOffline(waitTillStopped: true); + hosts.Stop(waitTillStopped: true); WaitForSlotFreedEvents(); diff --git a/Tests/CodexReleaseTests/NodeTests/BasicInfoTests.cs b/Tests/CodexReleaseTests/NodeTests/BasicInfoTests.cs index 914bedd7..9b9f4bbf 100644 --- a/Tests/CodexReleaseTests/NodeTests/BasicInfoTests.cs +++ b/Tests/CodexReleaseTests/NodeTests/BasicInfoTests.cs @@ -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(); diff --git a/Tools/AutoClient/Program.cs b/Tools/AutoClient/Program.cs index e22c4198..8c8aed13 100644 --- a/Tools/AutoClient/Program.cs +++ b/Tools/AutoClient/Program.cs @@ -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 ); diff --git a/Tools/BiblioTech/CodexCidChecker.cs b/Tools/BiblioTech/CodexCidChecker.cs index ca2723cf..3b4b8bb9 100644 --- a/Tools/BiblioTech/CodexCidChecker.cs +++ b/Tools/BiblioTech/CodexCidChecker.cs @@ -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 ); diff --git a/Tools/CodexNetDeployer/Deployer.cs b/Tools/CodexNetDeployer/Deployer.cs index 8ecc2434..e746f9ea 100644 --- a/Tools/CodexNetDeployer/Deployer.cs +++ b/Tools/CodexNetDeployer/Deployer.cs @@ -201,12 +201,12 @@ namespace CodexNetDeployer private void CheckContainerRestarts(List startResults) { - var crashes = new List(); + var crashes = new List(); 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."); } }