Add retry to make test more resilient.

This commit is contained in:
Kevin Bost
2024-09-29 14:27:27 -07:00
committed by Caelan
parent e11fb71dfb
commit 53b111d0c5

View File

@@ -531,7 +531,8 @@ public class WindowsPackTests
Thread.Sleep(5000); // update.exe runs in a separate process here
logger.Info("Velopack.log:" + Environment.NewLine + File.ReadAllText(Path.Combine(rootDir, "Velopack.log")));
string logContents = ReadFileWithRetry(Path.Combine(rootDir, "Velopack.log"), logger);
logger.Info("Velopack.log:" + Environment.NewLine + logContents);
logger.Info("TEST: " + DateTime.Now.ToLongTimeString());
if (origDirName != "current") {
@@ -553,6 +554,13 @@ public class WindowsPackTests
Assert.EndsWith(Environment.NewLine + "2.0.0", chk3version);
}
private static string ReadFileWithRetry(string path, ILogger logger)
{
return IoUtil.Retry(() => {
return File.ReadAllText(path);
}, logger: logger);
}
//private string RunCoveredRust(string binName, string[] args, string workingDir, ILogger logger, int? exitCode = 0)
//{
// var outputFile = GetPath($"coverage.runrust.{RandomString(8)}.xml");