Adds better check for successful deployment of codex contracts

This commit is contained in:
benbierens 2023-06-01 15:04:04 +02:00
parent b590e24de8
commit 99c9b25487
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 9 additions and 10 deletions

View File

@ -5,7 +5,6 @@ namespace DistTestCore.Marketplace
{ {
public class CodexContractsStarter : BaseStarter public class CodexContractsStarter : BaseStarter
{ {
private const string readyString = "Done! Sleeping indefinitely...";
public CodexContractsStarter(TestLifecycle lifecycle, WorkflowCreator workflowCreator) public CodexContractsStarter(TestLifecycle lifecycle, WorkflowCreator workflowCreator)
: base(lifecycle, workflowCreator) : base(lifecycle, workflowCreator)
@ -25,7 +24,7 @@ namespace DistTestCore.Marketplace
WaitUntil(() => WaitUntil(() =>
{ {
var logHandler = new ContractsReadyLogHandler(readyString); var logHandler = new ContractsReadyLogHandler();
workflow.DownloadContainerLog(container, logHandler); workflow.DownloadContainerLog(container, logHandler);
return logHandler.Found; return logHandler.Found;
}); });
@ -73,18 +72,19 @@ namespace DistTestCore.Marketplace
public class ContractsReadyLogHandler : LogHandler public class ContractsReadyLogHandler : LogHandler
{ {
private readonly string targetString; // Log should contain 'Compiled 15 Solidity files successfully' at some point.
private const string RequiredCompiledString = "Solidity files successfully";
public ContractsReadyLogHandler(string targetString) // When script is done, it prints the ready-string.
{ private const string ReadyString = "Done! Sleeping indefinitely...";
this.targetString = targetString;
}
public bool SeenCompileString { get; private set; }
public bool Found { get; private set; } public bool Found { get; private set; }
protected override void ProcessLine(string line) protected override void ProcessLine(string line)
{ {
if (line.Contains(targetString)) Found = true; if (line.Contains(RequiredCompiledString)) SeenCompileString = true;
if (SeenCompileString && line.Contains(ReadyString)) Found = true;
} }
} }
} }

View File

@ -22,7 +22,6 @@ namespace KubernetesWorkflow
client = new K8sClient(cluster.GetK8sClientConfig()); client = new K8sClient(cluster.GetK8sClientConfig());
K8sTestNamespace = cluster.Configuration.K8sNamespacePrefix + testNamespace; K8sTestNamespace = cluster.Configuration.K8sNamespacePrefix + testNamespace;
log.Debug($"Test namespace: '{K8sTestNamespace}'");
} }
public void Dispose() public void Dispose()