From e31643380a30e4df42db7044863b494de161ca5b Mon Sep 17 00:00:00 2001 From: caesay Date: Mon, 1 Jan 2024 15:17:11 +0000 Subject: [PATCH] Fix update resolution in osx test --- .github/workflows/build.yml | 2 +- test/PathHelper.cs | 13 +++++++++++++ test/Velopack.Tests/UpdateManagerTests.cs | 7 ++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c119aca0..7c459bd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,7 @@ jobs: - name: Rename OSX Binary working-directory: src/Rust/target/release - run: mv update updatemac + run: cp update updatemac if: ${{ matrix.os == 'macos-latest' }} - name: Build .NET diff --git a/test/PathHelper.cs b/test/PathHelper.cs index 6e7ade23..562075e7 100644 --- a/test/PathHelper.cs +++ b/test/PathHelper.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using Velopack; public static class PathHelper { @@ -28,6 +29,18 @@ public static class PathHelper public static string GetRustAsset(params string[] names) => Path.Combine(new string[] { GetRustBuildOutputDir() }.Concat(names).ToArray()); + public static string CopyUpdateTo(string dir) + { + var updateName = "update.exe"; + if (VelopackRuntimeInfo.IsOSX) { + updateName = "update"; + } + var path = GetRustAsset(updateName); + var newPath = Path.Combine(dir, updateName); + File.Copy(path, newPath); + return newPath; + } + public static string GetTestRoot() { // XXX: This is an evil hack, but it's okay for a unit test diff --git a/test/Velopack.Tests/UpdateManagerTests.cs b/test/Velopack.Tests/UpdateManagerTests.cs index ab9e5e21..758c8134 100644 --- a/test/Velopack.Tests/UpdateManagerTests.cs +++ b/test/Velopack.Tests/UpdateManagerTests.cs @@ -190,12 +190,9 @@ namespace Velopack.Tests var basePkgPath = Path.Combine(packagesDir, basePkg.OriginalFilename); File.Copy(basePkgFixturePath, basePkgPath); - var updateExe = PathHelper.GetRustAsset("update.exe"); - var copiedExe = Path.Combine(packagesDir, "update.exe"); - File.Copy(updateExe, copiedExe); - + var updateExe = PathHelper.CopyUpdateTo(packagesDir); var locator = new TestVelopackLocator(id, fromVersion, - packagesDir, null, null, copiedExe, logger); + packagesDir, null, null, updateExe, logger); var um = new UpdateManager(source, logger, locator); var info = await um.CheckForUpdatesAsync();