Adds debug logging for containerlog-searching operations
This commit is contained in:
parent
99c9b25487
commit
37f7f5293f
|
@ -32,6 +32,11 @@ namespace DistTestCore
|
|||
lifecycle.Log.Log($"{GetClassName()} {msg}");
|
||||
}
|
||||
|
||||
protected void Debug(string msg)
|
||||
{
|
||||
lifecycle.Log.Debug($"{GetClassName()} {msg}", 1);
|
||||
}
|
||||
|
||||
private string GetClassName()
|
||||
{
|
||||
return $"({GetType().Name})";
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace DistTestCore.Marketplace
|
|||
|
||||
WaitUntil(() =>
|
||||
{
|
||||
var logHandler = new ContractsReadyLogHandler();
|
||||
var logHandler = new ContractsReadyLogHandler(Debug);
|
||||
workflow.DownloadContainerLog(container, logHandler);
|
||||
return logHandler.Found;
|
||||
});
|
||||
|
@ -76,12 +76,20 @@ namespace DistTestCore.Marketplace
|
|||
private const string RequiredCompiledString = "Solidity files successfully";
|
||||
// When script is done, it prints the ready-string.
|
||||
private const string ReadyString = "Done! Sleeping indefinitely...";
|
||||
private readonly Action<string> debug;
|
||||
|
||||
public ContractsReadyLogHandler(Action<string> debug)
|
||||
{
|
||||
this.debug = debug;
|
||||
debug($"Looking for '{RequiredCompiledString}' and '{ReadyString}' in container logs...");
|
||||
}
|
||||
|
||||
public bool SeenCompileString { get; private set; }
|
||||
public bool Found { get; private set; }
|
||||
|
||||
protected override void ProcessLine(string line)
|
||||
{
|
||||
debug(line);
|
||||
if (line.Contains(RequiredCompiledString)) SeenCompileString = true;
|
||||
|
||||
if (SeenCompileString && line.Contains(ReadyString)) Found = true;
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace DistTestCore.Marketplace
|
|||
|
||||
private string FetchPubKey()
|
||||
{
|
||||
var enodeFinder = new PubKeyFinder();
|
||||
var enodeFinder = new PubKeyFinder(s => log.Debug(s));
|
||||
workflow.DownloadContainerLog(container, enodeFinder);
|
||||
return enodeFinder.GetPubKey();
|
||||
}
|
||||
|
@ -103,8 +103,15 @@ namespace DistTestCore.Marketplace
|
|||
{
|
||||
private const string openTag = "self=enode://";
|
||||
private const string openTagQuote = "self=\"enode://";
|
||||
private readonly Action<string> debug;
|
||||
private string pubKey = string.Empty;
|
||||
|
||||
public PubKeyFinder(Action<string> debug)
|
||||
{
|
||||
this.debug = debug;
|
||||
debug($"Looking for '{openTag}' in container logs...");
|
||||
}
|
||||
|
||||
public string GetPubKey()
|
||||
{
|
||||
if (string.IsNullOrEmpty(pubKey)) throw new Exception("Not found yet exception.");
|
||||
|
@ -113,6 +120,7 @@ namespace DistTestCore.Marketplace
|
|||
|
||||
protected override void ProcessLine(string line)
|
||||
{
|
||||
debug(line);
|
||||
if (line.Contains(openTag))
|
||||
{
|
||||
ExtractPubKey(openTag, line);
|
||||
|
|
Loading…
Reference in New Issue