diff --git a/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs b/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs index 9b7e608..80203af 100644 --- a/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs +++ b/Tests/CodexContinuousTests/ElasticSearchLogDownloader.cs @@ -34,11 +34,11 @@ namespace ContinuousTests $"{startUtc.ToString("o")} - {endUtc.ToString("o")}"); log.Log(openingLine); - var http = CreateElasticSearchHttp(); + var endpoint = CreateElasticSearchEndpoint(); var queryTemplate = CreateQueryTemplate(container, startUtc, endUtc); targetFile.Write($"Downloading '{container.Name}' to '{targetFile.FullFilename}'."); - var reconstructor = new LogReconstructor(targetFile, http, queryTemplate); + var reconstructor = new LogReconstructor(targetFile, endpoint, queryTemplate); reconstructor.DownloadFullLog(); log.Log("Log download finished."); @@ -64,34 +64,36 @@ namespace ContinuousTests .Replace("", namespaceName); } - private IHttp CreateElasticSearchHttp() + private IEndpoint CreateElasticSearchEndpoint() { var serviceName = "elasticsearch"; var k8sNamespace = "monitoring"; var address = new Address($"http://{serviceName}.{k8sNamespace}.svc.cluster.local", 9200); var baseUrl = ""; - return tools.CreateHttp(address, baseUrl, client => + var http = tools.CreateHttp(client => { client.DefaultRequestHeaders.Add("kbn-xsrf", "reporting"); }); + + return http.CreateEndpoint(address, baseUrl); } public class LogReconstructor { private readonly List queue = new List(); private readonly LogFile targetFile; - private readonly IHttp http; + private readonly IEndpoint endpoint; private readonly string queryTemplate; private const int sizeOfPage = 2000; private string searchAfter = ""; private int lastHits = 1; private ulong? lastLogLine; - public LogReconstructor(LogFile targetFile, IHttp http, string queryTemplate) + public LogReconstructor(LogFile targetFile, IEndpoint endpoint, string queryTemplate) { this.targetFile = targetFile; - this.http = http; + this.endpoint = endpoint; this.queryTemplate = queryTemplate; } @@ -110,7 +112,7 @@ namespace ContinuousTests .Replace("", sizeOfPage.ToString()) .Replace("", searchAfter); - var response = http.HttpPostString("_search", query); + var response = endpoint.HttpPostString("_search", query); lastHits = response.hits.hits.Length; if (lastHits > 0) diff --git a/Tests/CodexContinuousTests/NodeRunner.cs b/Tests/CodexContinuousTests/NodeRunner.cs index 488e47a..31f1f2e 100644 --- a/Tests/CodexContinuousTests/NodeRunner.cs +++ b/Tests/CodexContinuousTests/NodeRunner.cs @@ -44,7 +44,7 @@ namespace ContinuousTests try { var debugInfo = bootstrapNode.GetDebugInfo(); - Assert.That(!string.IsNullOrEmpty(debugInfo.spr)); + Assert.That(!string.IsNullOrEmpty(debugInfo.Spr)); var node = entryPoint.CreateInterface().StartCodexNode(s => { diff --git a/Tests/CodexContinuousTests/SingleTestRun.cs b/Tests/CodexContinuousTests/SingleTestRun.cs index 4552b46..7c6c5a6 100644 --- a/Tests/CodexContinuousTests/SingleTestRun.cs +++ b/Tests/CodexContinuousTests/SingleTestRun.cs @@ -128,7 +128,7 @@ namespace ContinuousTests var deploymentName = container.RunningContainers.StartResult.Deployment.Name; var namespaceName = container.RunningContainers.StartResult.Cluster.Configuration.KubernetesNamespace; var openingLine = - $"{namespaceName} - {deploymentName} = {node.Container.Name} = {node.GetDebugInfo().id}"; + $"{namespaceName} - {deploymentName} = {node.Container.Name} = {node.GetDebugInfo().Id}"; elasticSearchLogDownloader.Download(fixtureLog.CreateSubfile(), node.Container, effectiveStart, effectiveEnd, openingLine); } diff --git a/Tests/CodexContinuousTests/StartupChecker.cs b/Tests/CodexContinuousTests/StartupChecker.cs index 1527589..d3fb456 100644 --- a/Tests/CodexContinuousTests/StartupChecker.cs +++ b/Tests/CodexContinuousTests/StartupChecker.cs @@ -123,10 +123,10 @@ namespace ContinuousTests try { var info = n.GetDebugInfo(); - if (info == null || string.IsNullOrEmpty(info.id)) return false; + if (info == null || string.IsNullOrEmpty(info.Id)) return false; - log.Log($"Codex version: '{info.codex.version}' revision: '{info.codex.revision}'"); - LogReplacements.Add(new BaseLogStringReplacement(info.id, n.GetName())); + log.Log($"Codex version: '{info.Version.Version}' revision: '{info.Version.Revision}'"); + LogReplacements.Add(new BaseLogStringReplacement(info.Id, n.GetName())); } catch { diff --git a/Tests/CodexContinuousTests/Tests/PeersTest.cs b/Tests/CodexContinuousTests/Tests/PeersTest.cs index 38d2f4f..87bcb82 100644 --- a/Tests/CodexContinuousTests/Tests/PeersTest.cs +++ b/Tests/CodexContinuousTests/Tests/PeersTest.cs @@ -24,12 +24,12 @@ namespace CodexContinuousTests.Tests var allInfos = Nodes.Select(n => { var info = n.GetDebugInfo(); - Log.Log($"{n.GetName()} = {info.table.localNode.nodeId}"); - Log.AddStringReplace(info.table.localNode.nodeId, n.GetName()); + Log.Log($"{n.GetName()} = {info.Table.LocalNode.NodeId}"); + Log.AddStringReplace(info.Table.LocalNode.NodeId, n.GetName()); return info; }).ToArray(); - var allIds = allInfos.Select(i => i.table.localNode.nodeId).ToArray(); + var allIds = allInfos.Select(i => i.Table.LocalNode.NodeId).ToArray(); var errors = Nodes.Select(n => AreAllPresent(n, allIds)).Where(s => !string.IsNullOrEmpty(s)).ToArray(); if (errors.Any()) @@ -41,13 +41,13 @@ namespace CodexContinuousTests.Tests private string AreAllPresent(ICodexNode n, string[] allIds) { var info = n.GetDebugInfo(); - var known = info.table.nodes.Select(n => n.nodeId).ToArray(); - var expected = allIds.Where(i => i != info.table.localNode.nodeId).ToArray(); + var known = info.Table.Nodes.Select(n => n.NodeId).ToArray(); + var expected = allIds.Where(i => i != info.Table.LocalNode.NodeId).ToArray(); if (!expected.All(ex => known.Contains(ex))) { var nl = Environment.NewLine; - return $"{nl}At node '{info.table.localNode.nodeId}'{nl}" + + return $"{nl}At node '{info.Table.LocalNode.NodeId}'{nl}" + $"Not all of{nl}'{string.Join(",", expected)}'{nl}" + $"were present in routing table:{nl}'{string.Join(",", known)}'"; }