fixes crashwatcher stop

This commit is contained in:
ThatBen 2025-02-21 15:21:42 +01:00
parent 0c961b8348
commit 92a5a1e361
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
4 changed files with 8 additions and 7 deletions

View File

@ -70,13 +70,13 @@ namespace KubernetesWorkflow
using var client = new Kubernetes(config);
while (!token.IsCancellationRequested)
{
token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
if (HasContainerBeenRestarted(client))
{
DownloadCrashedContainerLogs(client);
return;
}
token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
}
}

View File

@ -735,7 +735,10 @@ namespace KubernetesWorkflow
throw new Exception($"Expected to find 1 pod by podLabel '{deployment.PodLabel}'. Found: {pods.Length}. " +
$"Total number of pods: {allPods.Items.Count}. Their labels: {string.Join(Environment.NewLine, allLabels)}");
}
return pods[0];
var pod = pods[0];
if (pod.Status == null) throw new Exception("Pod status unknown");
if (string.IsNullOrEmpty(pod.Status.PodIP)) throw new Exception("Pod IP unknown");
return pod;
}
#endregion

View File

@ -26,9 +26,9 @@ namespace CodexPlugin
public void Stop(bool waitTillStopped)
{
Log($"Stopping node...");
crashWatcher.Stop();
var workflow = tools.CreateWorkflow();
workflow.Stop(pod, waitTillStopped);
crashWatcher.Stop();
onStop();
Log("Stopped.");
}

View File

@ -1,7 +1,5 @@
using CodexPlugin;
using CodexTests;
using CodexTests;
using NUnit.Framework;
using System.Drawing;
using Utils;
namespace CodexReleaseTests.DataTests