From 103e5e271a3443e94832561238d48e1f86e72f9e Mon Sep 17 00:00:00 2001 From: Caelan Date: Wed, 10 Jan 2024 23:45:06 +0000 Subject: [PATCH] Fix some ubuntu tests --- test/PathHelper.cs | 5 +--- test/Velopack.Tests/UpdateManagerTests.cs | 31 +++++++++++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/test/PathHelper.cs b/test/PathHelper.cs index 359640ac..e70e8bf9 100644 --- a/test/PathHelper.cs +++ b/test/PathHelper.cs @@ -50,10 +50,7 @@ public static class PathHelper public static string CopyUpdateTo(string dir) { - var updateName = "update.exe"; - if (VelopackRuntimeInfo.IsOSX) { - updateName = "update"; - } + var updateName = VelopackRuntimeInfo.IsWindows ? "update.exe" : "update"; var path = GetRustAsset(updateName); var newPath = Path.Combine(dir, updateName); File.Copy(path, newPath); diff --git a/test/Velopack.Tests/UpdateManagerTests.cs b/test/Velopack.Tests/UpdateManagerTests.cs index 7600016f..559f6e86 100644 --- a/test/Velopack.Tests/UpdateManagerTests.cs +++ b/test/Velopack.Tests/UpdateManagerTests.cs @@ -21,7 +21,12 @@ namespace Velopack.Tests using var logger = _output.BuildLoggerFor(); using var _1 = Utility.GetTempDirectory(out var tempPath); - string releasesSuffix = VelopackRuntimeInfo.IsOSX ? "-osx" : ""; + string releasesSuffix = VelopackRuntimeInfo.SystemOs switch { + RuntimeOs.Windows => "", + RuntimeOs.Linux => "-linux", + RuntimeOs.OSX => "-osx", + _ => throw new ArgumentOutOfRangeException() + }; File.WriteAllText(Path.Combine(tempPath, "RELEASES" + releasesSuffix), """ 3a2eadd15dd984e4559f2b4d790ec8badaeb6a39 MyCoolApp-1.1.0.nupkg 1040561 @@ -76,7 +81,12 @@ namespace Velopack.Tests { using var logger = _output.BuildLoggerFor(); using var _1 = Utility.GetTempDirectory(out var tempPath); - string releasesSuffix = VelopackRuntimeInfo.IsOSX ? "-osx" : ""; + string releasesSuffix = VelopackRuntimeInfo.SystemOs switch { + RuntimeOs.Windows => "", + RuntimeOs.Linux => "-linux", + RuntimeOs.OSX => "-osx", + _ => throw new ArgumentOutOfRangeException() + }; File.WriteAllText(Path.Combine(tempPath, "RELEASES" + releasesSuffix), """ 3a2eadd15dd984e4559f2b4d790ec8badaeb6a39 MyCoolApp-1.1.0.nupkg 1040561 3a2eadd15dd984e4559f2b4d790ec8badaeb6a39 MyCoolApp-1.2.0.nupkg 1040561 @@ -124,7 +134,12 @@ namespace Velopack.Tests { using var logger = _output.BuildLoggerFor(); using var _1 = Utility.GetTempDirectory(out var tempPath); - string releasesSuffix = VelopackRuntimeInfo.IsOSX ? "-osx" : ""; + string releasesSuffix = VelopackRuntimeInfo.SystemOs switch { + RuntimeOs.Windows => "", + RuntimeOs.Linux => "-linux", + RuntimeOs.OSX => "-osx", + _ => throw new ArgumentOutOfRangeException() + }; File.WriteAllText(Path.Combine(tempPath, "RELEASES" + releasesSuffix), """ 3a2eadd15dd984e4559f2b4d790ec8badaeb6a39 MyCoolApp-1.1.0.nupkg 1040561 94689fede03fed7ab59c24337673a27837f0c3ec MyCoolApp-1.0.0.nupkg 1004502 @@ -140,7 +155,12 @@ namespace Velopack.Tests { using var logger = _output.BuildLoggerFor(); using var _1 = Utility.GetTempDirectory(out var tempPath); - string releasesSuffix = VelopackRuntimeInfo.IsOSX ? "-osx" : ""; + string releasesSuffix = VelopackRuntimeInfo.SystemOs switch { + RuntimeOs.Windows => "", + RuntimeOs.Linux => "-linux", + RuntimeOs.OSX => "-osx", + _ => throw new ArgumentOutOfRangeException() + }; File.WriteAllText(Path.Combine(tempPath, "RELEASES" + releasesSuffix), """ 3a2eadd15dd984e4559f2b4d790ec8badaeb6a39 MyCoolApp-1.1.0.nupkg 1040561 94689fede03fed7ab59c24337673a27837f0c3ec MyCoolApp-1.0.0.nupkg 1004502 @@ -175,11 +195,12 @@ namespace Velopack.Tests um.VerifyPackageChecksum(info.TargetFullRelease); } - [Theory] + [SkippableTheory] [InlineData("Clowd", "3.4.287", "3.4.292")] //[InlineData("slack", "1.1.8", "1.2.2")] public async Task DownloadsDeltasAndCreatesFullVersion(string id, string fromVersion, string toVersion) { + Skip.If(VelopackRuntimeInfo.IsLinux); using var logger = _output.BuildLoggerFor(); using var _1 = Utility.GetTempDirectory(out var packagesDir); var repo = new FakeFixtureRepository(id, true);