Fixes issue where oneclient-test would fail because node was not ready.
This commit is contained in:
parent
3f159b8ece
commit
802f3459e9
|
@ -13,9 +13,7 @@ namespace DistTestCore.Codex
|
||||||
|
|
||||||
public CodexDebugResponse GetDebugInfo()
|
public CodexDebugResponse GetDebugInfo()
|
||||||
{
|
{
|
||||||
var response = Http().HttpGetJson<CodexDebugResponse>("debug/info");
|
return Http().HttpGetJson<CodexDebugResponse>("debug/info");
|
||||||
//Log($"Got DebugInfo with id: '{response.id}'.");
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string UploadFile(FileStream fileStream)
|
public string UploadFile(FileStream fileStream)
|
||||||
|
|
|
@ -47,13 +47,6 @@ namespace DistTestCore
|
||||||
public RunningContainers Containers { get; private set; }
|
public RunningContainers Containers { get; private set; }
|
||||||
public OnlineCodexNode[] Nodes { get; private set; }
|
public OnlineCodexNode[] Nodes { get; private set; }
|
||||||
|
|
||||||
//public GethCompanionGroup? GethCompanionGroup { get; set; }
|
|
||||||
|
|
||||||
//public CodexNodeContainer[] GetContainers()
|
|
||||||
//{
|
|
||||||
// return Nodes.Select(n => n.Container).ToArray();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public IEnumerator<IOnlineCodexNode> GetEnumerator()
|
public IEnumerator<IOnlineCodexNode> GetEnumerator()
|
||||||
{
|
{
|
||||||
return Nodes.Cast<IOnlineCodexNode>().GetEnumerator();
|
return Nodes.Cast<IOnlineCodexNode>().GetEnumerator();
|
||||||
|
@ -64,13 +57,6 @@ namespace DistTestCore
|
||||||
return Nodes.GetEnumerator();
|
return Nodes.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public CodexNodeLog DownloadLog(IOnlineCodexNode node)
|
|
||||||
//{
|
|
||||||
// var logDownloader = new PodLogDownloader(log, k8SManager);
|
|
||||||
// var n = (OnlineCodexNode)node;
|
|
||||||
// return logDownloader.DownloadLog(n);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public string Describe()
|
public string Describe()
|
||||||
{
|
{
|
||||||
return $"<CodexNodeGroup@{Containers.Describe()}-{Setup.Describe()}>";
|
return $"<CodexNodeGroup@{Containers.Describe()}-{Setup.Describe()}>";
|
||||||
|
@ -79,7 +65,22 @@ namespace DistTestCore
|
||||||
private OnlineCodexNode CreateOnlineCodexNode(RunningContainer c, ICodexNodeFactory factory)
|
private OnlineCodexNode CreateOnlineCodexNode(RunningContainer c, ICodexNodeFactory factory)
|
||||||
{
|
{
|
||||||
var access = new CodexAccess(c);
|
var access = new CodexAccess(c);
|
||||||
|
EnsureOnline(access);
|
||||||
return factory.CreateOnlineCodexNode(access, this);
|
return factory.CreateOnlineCodexNode(access, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EnsureOnline(CodexAccess access)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var debugInfo = access.GetDebugInfo();
|
||||||
|
if (debugInfo == null || string.IsNullOrEmpty(debugInfo.id)) throw new InvalidOperationException("Unable to get debug-info from codex node at startup.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
lifecycle.Log.Error($"Failed to start codex node: {e}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace DistTestCore
|
||||||
{
|
{
|
||||||
public const int ChunkSize = 1024 * 1024;
|
public const int ChunkSize = 1024 * 1024;
|
||||||
private readonly Random random = new Random();
|
private readonly Random random = new Random();
|
||||||
private readonly List<TestFile> activeFiles = new List<TestFile>();
|
|
||||||
private readonly TestLog log;
|
private readonly TestLog log;
|
||||||
private readonly string folder;
|
private readonly string folder;
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ namespace DistTestCore
|
||||||
{
|
{
|
||||||
folder = configuration.GetFileManagerFolder();
|
folder = configuration.GetFileManagerFolder();
|
||||||
|
|
||||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
EnsureDirectory();
|
||||||
this.log = log;
|
this.log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ namespace DistTestCore
|
||||||
{
|
{
|
||||||
var result = new TestFile(Path.Combine(folder, Guid.NewGuid().ToString() + "_test.bin"));
|
var result = new TestFile(Path.Combine(folder, Guid.NewGuid().ToString() + "_test.bin"));
|
||||||
File.Create(result.Filename).Close();
|
File.Create(result.Filename).Close();
|
||||||
activeFiles.Add(result);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +42,7 @@ namespace DistTestCore
|
||||||
|
|
||||||
public void DeleteAllTestFiles()
|
public void DeleteAllTestFiles()
|
||||||
{
|
{
|
||||||
foreach (var file in activeFiles) File.Delete(file.Filename);
|
DeleteDirectory();
|
||||||
activeFiles.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateFileBytes(TestFile result, ByteSize size)
|
private void GenerateFileBytes(TestFile result, ByteSize size)
|
||||||
|
@ -66,6 +63,16 @@ namespace DistTestCore
|
||||||
using var stream = new FileStream(result.Filename, FileMode.Append);
|
using var stream = new FileStream(result.Filename, FileMode.Append);
|
||||||
stream.Write(bytes, 0, bytes.Length);
|
stream.Write(bytes, 0, bytes.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EnsureDirectory()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteDirectory()
|
||||||
|
{
|
||||||
|
Directory.Delete(folder, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestFile
|
public class TestFile
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Logging
|
||||||
public FixtureLog(LogConfig config)
|
public FixtureLog(LogConfig config)
|
||||||
{
|
{
|
||||||
start = DateTime.UtcNow;
|
start = DateTime.UtcNow;
|
||||||
var folder = DetermineFolder(config); // "root/2023-04 /14"
|
var folder = DetermineFolder(config);
|
||||||
var fixtureName = GetFixtureName(); // "11-09-23Z_ExampleTests"
|
var fixtureName = GetFixtureName();
|
||||||
fullName = Path.Combine(folder, fixtureName);
|
fullName = Path.Combine(folder, fixtureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue