From 99c9b254873961cd4c30d584934c1fa5cb569742 Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 1 Jun 2023 15:04:04 +0200 Subject: [PATCH] Adds better check for successful deployment of codex contracts --- .../Marketplace/CodexContractsStarter.cs | 18 +++++++++--------- KubernetesWorkflow/K8sController.cs | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/DistTestCore/Marketplace/CodexContractsStarter.cs b/DistTestCore/Marketplace/CodexContractsStarter.cs index 8bf1f66..0f65635 100644 --- a/DistTestCore/Marketplace/CodexContractsStarter.cs +++ b/DistTestCore/Marketplace/CodexContractsStarter.cs @@ -5,7 +5,6 @@ namespace DistTestCore.Marketplace { public class CodexContractsStarter : BaseStarter { - private const string readyString = "Done! Sleeping indefinitely..."; public CodexContractsStarter(TestLifecycle lifecycle, WorkflowCreator workflowCreator) : base(lifecycle, workflowCreator) @@ -25,7 +24,7 @@ namespace DistTestCore.Marketplace WaitUntil(() => { - var logHandler = new ContractsReadyLogHandler(readyString); + var logHandler = new ContractsReadyLogHandler(); workflow.DownloadContainerLog(container, logHandler); return logHandler.Found; }); @@ -73,18 +72,19 @@ namespace DistTestCore.Marketplace public class ContractsReadyLogHandler : LogHandler { - private readonly string targetString; - - public ContractsReadyLogHandler(string targetString) - { - this.targetString = targetString; - } + // Log should contain 'Compiled 15 Solidity files successfully' at some point. + private const string RequiredCompiledString = "Solidity files successfully"; + // When script is done, it prints the ready-string. + private const string ReadyString = "Done! Sleeping indefinitely..."; + public bool SeenCompileString { get; private set; } public bool Found { get; private set; } 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; } } } diff --git a/KubernetesWorkflow/K8sController.cs b/KubernetesWorkflow/K8sController.cs index 90d0b32..539b2b2 100644 --- a/KubernetesWorkflow/K8sController.cs +++ b/KubernetesWorkflow/K8sController.cs @@ -22,7 +22,6 @@ namespace KubernetesWorkflow client = new K8sClient(cluster.GetK8sClientConfig()); K8sTestNamespace = cluster.Configuration.K8sNamespacePrefix + testNamespace; - log.Debug($"Test namespace: '{K8sTestNamespace}'"); } public void Dispose()