diff --git a/build/Build.CalamariTesting.cs b/build/Build.CalamariTesting.cs deleted file mode 100644 index 1549543b8f..0000000000 --- a/build/Build.CalamariTesting.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using JetBrains.Annotations; - -namespace Calamari.Build; - -partial class Build -{ - [PublicAPI] - Target PlatformAgnosticTesting => - target => target - .Executes(async () => - { - var dotnetPath = await LocateOrInstallDotNetSdk(); - - CreateTestRun("Binaries/Calamari.Tests.dll") - .WithDotNetPath(dotnetPath) - .WithFilter("TestCategory = PlatformAgnostic") - .Execute(); - }); - - [PublicAPI] - Target LinuxSpecificTesting => - target => target - .Executes(async () => - { - var dotnetPath = await LocateOrInstallDotNetSdk(); - - CreateTestRun("Binaries/Calamari.Tests.dll") - .WithDotNetPath(dotnetPath) - .WithFilter("TestCategory != Windows & TestCategory != PlatformAgnostic & TestCategory != RunOnceOnWindowsAndLinux") - .Execute(); - }); - - [PublicAPI] - Target OncePerWindowsOrLinuxTesting => - target => target - .Executes(async () => - { - var dotnetPath = await LocateOrInstallDotNetSdk(); - - CreateTestRun("Binaries/Calamari.Tests.dll") - .WithDotNetPath(dotnetPath) - .WithFilter("(TestCategory != Windows & TestCategory != PlatformAgnostic) | TestCategory = RunOnceOnWindowsAndLinux") - .Execute(); - }); - - [PublicAPI] - Target OncePerWindowsTesting => - target => target - .Executes(async () => - { - var dotnetPath = await LocateOrInstallDotNetSdk(); - - CreateTestRun("Binaries/Calamari.Tests.dll") - .WithDotNetPath(dotnetPath) - .WithFilter("TestCategory != macOs & TestCategory != Nix & TestCategory != PlatformAgnostic & TestCategory != nixMacOS & TestCategory != RunOnceOnWindowsAndLinux & TestCategory != ModifiesSystemProxy") - .Execute(); - }); - - [PublicAPI] - Target WindowsSystemProxyTesting => - target => target - .Executes(async () => - { - var dotnetPath = await LocateOrInstallDotNetSdk(); - - CreateTestRun("Binaries/Calamari.Tests.dll") - .WithDotNetPath(dotnetPath) - .WithFilter("TestCategory = Windows & TestCategory = ModifiesSystemProxy") - .Execute(); - }); -} \ No newline at end of file diff --git a/build/Build.TestCalamariFlavourProject.cs b/build/Build.TestCalamariFlavourProject.cs index 46e4fe8b27..653149eba9 100644 --- a/build/Build.TestCalamariFlavourProject.cs +++ b/build/Build.TestCalamariFlavourProject.cs @@ -4,19 +4,56 @@ namespace Calamari.Build; partial class Build { - [Parameter(Name = "CalamariFlavour")] readonly string? CalamariFlavourToTest; - [Parameter(Name = "VSTest_TestCaseFilter")] readonly string? CalamariFlavourTestCaseFilter; + [Parameter(Name = "ProjectToTest")] readonly string? CalamariProjectToTest; + + [PublicAPI] + Target LinuxHostTests => + target => target + .Executes(async () => + { + var dotnetPath = await LocateOrInstallDotNetSdk(); + + var project = CalamariProjectToTest ?? "Calamari"; + var dll = $"TestBinaries/{project}.Tests.dll"; + + CreateTestRun(dll) + .WithDotNetPath(dotnetPath) + .WithFilter("TestCategory != Windows") // Linux is all tests that are non-Windows specific + .Execute(); + }); + [PublicAPI] - Target TestCalamariFlavourProject => + Target WindowsHostTests => target => target .Executes(async () => { var dotnetPath = await LocateOrInstallDotNetSdk(); - CreateTestRun($"CalamariTests/Calamari.{CalamariFlavourToTest}.Tests.dll") + var project = CalamariProjectToTest ?? "Calamari"; + + var dll = $"TestBinaries/{project}.Tests.dll"; + + CreateTestRun(dll) + .WithDotNetPath(dotnetPath) + .WithFilter("TestCategory != Linux & TestCategory != MacOs & TestCategory != Windows2016OrLater") // Windows is all tests that are non-Linux or MacOS specific and not Win 2016 or later + .Execute(); + }); + + [PublicAPI] + Target Windows2016OrLaterHostTests => + target => target + .Executes(async () => + { + var dotnetPath = await LocateOrInstallDotNetSdk(); + + var project = CalamariProjectToTest ?? "Calamari"; + + var dll = $"TestBinaries/{project}.Tests.dll"; + + CreateTestRun(dll) .WithDotNetPath(dotnetPath) - .WithFilter(CalamariFlavourTestCaseFilter) + .WithFilter("TestCategory = Windows2016OrLater") // Windows 2016 or later specific tests .Execute(); }); } \ No newline at end of file diff --git a/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs b/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs index 4400d992cc..e7946801c0 100644 --- a/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs +++ b/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs @@ -159,7 +159,7 @@ await CommandTestBuilder.CreateAsync() } [Test] - [WindowsTest] + [TestPlatforms(TestPlatforms.Windows)] [RequiresPowerShell5OrAbove] public async Task Deploy_Ensure_Tools_Are_Configured() { diff --git a/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs b/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs index 6ce8922365..837ccb57d6 100644 --- a/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs +++ b/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs @@ -18,7 +18,9 @@ namespace Calamari.AzureResourceGroup.Tests { [TestFixture] - [WindowsTest] // NOTE: We should look at having the Azure CLI installed on Linux boxes so that these steps can be tested there, particularly if we're moving cloud to a Ubuntu Default Worker. + [Category(TestCategories.Windows2016OrLater)] + [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] + [TestPlatforms(TestPlatforms.Windows)] // NOTE: We should look at having the Azure CLI installed on Linux boxes so that these steps can be tested there, particularly if we're moving cloud to a Ubuntu Default Worker. class DeployAzureBicepTemplateCommandFixture { string clientId; @@ -93,7 +95,6 @@ await armClient.GetResourceGroupResource(ResourceGroupResource.CreateResourceIde } [Test] - [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] public async Task DeployAzureBicepTemplate_PackageSource() { await CommandTestBuilder.CreateAsync() @@ -108,7 +109,6 @@ await CommandTestBuilder.CreateAsync() } [Test] - [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] public async Task DeployAzureBicepTemplate_GitSource() { // For the purposes of Bicep templates in Calamari, a template in a Git Repository @@ -127,7 +127,6 @@ await CommandTestBuilder.CreateAsync() } [Test] - [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] public async Task DeployAzureBicepTemplate_InlineSource() { var templateFileContent = File.ReadAllText(Path.Combine(packagePath, "azure_website_template.bicep")); diff --git a/source/Calamari.AzureScripting.Tests/AzurePowershellCommandFixture.cs b/source/Calamari.AzureScripting.Tests/AzurePowershellCommandFixture.cs index b3e66e7cc5..54bc9a03d3 100644 --- a/source/Calamari.AzureScripting.Tests/AzurePowershellCommandFixture.cs +++ b/source/Calamari.AzureScripting.Tests/AzurePowershellCommandFixture.cs @@ -31,7 +31,7 @@ public async Task Setup() } [Test] - [WindowsTest] + [TestPlatforms(TestPlatforms.Windows)] [RequiresPowerShell5OrAbove] public async Task ExecuteAnInlineWindowsPowerShellScript() { diff --git a/source/Calamari.AzureServiceFabric.Tests/DeployAzureServiceFabricAppCommandFixture.cs b/source/Calamari.AzureServiceFabric.Tests/DeployAzureServiceFabricAppCommandFixture.cs index 1d51b93523..ef4299bdd4 100644 --- a/source/Calamari.AzureServiceFabric.Tests/DeployAzureServiceFabricAppCommandFixture.cs +++ b/source/Calamari.AzureServiceFabric.Tests/DeployAzureServiceFabricAppCommandFixture.cs @@ -16,7 +16,7 @@ namespace Calamari.AzureServiceFabric.Tests { [TestFixture] - [WindowsTest] + [TestPlatforms(TestPlatforms.Windows)] public class DeployAzureServiceFabricAppCommandFixture { string clientCertThumbprint; diff --git a/source/Calamari.AzureServiceFabric.Tests/HealthCheckCommandFixture.cs b/source/Calamari.AzureServiceFabric.Tests/HealthCheckCommandFixture.cs index 057d2915bf..fba5796fb8 100644 --- a/source/Calamari.AzureServiceFabric.Tests/HealthCheckCommandFixture.cs +++ b/source/Calamari.AzureServiceFabric.Tests/HealthCheckCommandFixture.cs @@ -14,7 +14,7 @@ namespace Calamari.AzureServiceFabric.Tests { [TestFixture] - [WindowsTest] + [TestPlatforms(TestPlatforms.Windows)] public class HealthCheckCommandFixture { string clientCertThumbprint; diff --git a/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs b/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs index de17250510..ffb46e953c 100644 --- a/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs +++ b/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs @@ -20,28 +20,6 @@ public static bool IsRunningOnMono() var monoRuntime = Type.GetType("Mono.Runtime"); return monoRuntime != null; } - - public static Version GetMonoVersion() - { - // A bit hacky, but this is what Mono community seems to be using: - // http://stackoverflow.com/questions/8413922/programmatically-determining-mono-runtime-version - - var monoRuntime = Type.GetType("Mono.Runtime"); - if (monoRuntime == null) - throw new MonoVersionCanNotBeDeterminedException("It looks like the code is not running on Mono."); - - var dispalayNameMethod = monoRuntime.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); - if (dispalayNameMethod == null) - throw new MonoVersionCanNotBeDeterminedException("Mono.Runtime.GetDisplayName can not be found."); - - var displayName = dispalayNameMethod.Invoke(null, null).ToString(); - var match = Regex.Match(displayName, @"^\d+\.\d+.\d+"); - if (match == null || !match.Success || string.IsNullOrEmpty(match.Value)) - throw new MonoVersionCanNotBeDeterminedException($"Display name does not seem to include version number. Retrieved value: {displayName}."); - - return Version.Parse(match.Value); - } - public static Version SafelyGetPowerShellVersion() { try diff --git a/source/Calamari.Terraform.Tests/CommandsFixture.cs b/source/Calamari.Terraform.Tests/CommandsFixture.cs index 716b4b4225..e22d441b9f 100644 --- a/source/Calamari.Terraform.Tests/CommandsFixture.cs +++ b/source/Calamari.Terraform.Tests/CommandsFixture.cs @@ -29,6 +29,7 @@ namespace Calamari.Terraform.Tests { [TestFixture("0.13.7")] [TestFixture("1.8.5")] + [Category(TestCategories.Windows2016OrLater)] public class CommandsFixture { string? customTerraformExecutable; diff --git a/source/Calamari.Testing/Helpers/TestCategory.cs b/source/Calamari.Testing/Helpers/TestCategory.cs deleted file mode 100644 index a4a67dbcb9..0000000000 --- a/source/Calamari.Testing/Helpers/TestCategory.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; - -namespace Calamari.Testing.Helpers -{ - public static class TestCategory - { - public static class ScriptingSupport - { - public const string DotnetScript = "dotnet-script"; - } - - public static class CompatibleOS - { - public const string OnlyNix = "Nix"; - - public const string OnlyWindows = "Windows"; - - public const string OnlyMac = "macOS"; - - public const string OnlyNixOrMac = "nixMacOS"; - } - - public const string PlatformAgnostic = "PlatformAgnostic"; - - public const string RunOnceOnWindowsAndLinux = "RunOnceOnWindowsAndLinux"; - } -} \ No newline at end of file diff --git a/source/Calamari.Testing/Requirements/RequiresNon32BitWindowsAttribute.cs b/source/Calamari.Testing/Requirements/RequiresNon32BitWindowsAttribute.cs deleted file mode 100644 index aef609bec8..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresNon32BitWindowsAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Calamari.Common.Plumbing; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; - -namespace Calamari.Testing.Requirements -{ - public class RequiresNon32BitWindowsAttribute : NUnitAttribute, IApplyToTest - { - public void ApplyToTest(Test test) - { - if (CalamariEnvironment.IsRunningOnWindows && !Environment.Is64BitOperatingSystem) - { - test.RunState = RunState.Skipped; - test.Properties.Set(PropertyNames.SkipReason, "This test does not run on 32Bit Windows"); - } - } - } -} \ No newline at end of file diff --git a/source/Calamari.Testing/Requirements/RequiresNonFreeBSDPlatformAttribute.cs b/source/Calamari.Testing/Requirements/RequiresNonFreeBSDPlatformAttribute.cs deleted file mode 100644 index 665e0757c9..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresNonFreeBSDPlatformAttribute.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Calamari.Common.Plumbing.Extensions; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; - -namespace Calamari.Testing.Requirements -{ - public class RequiresNonFreeBSDPlatformAttribute : NUnitAttribute, IApplyToTest - { - readonly string? reason; - - public RequiresNonFreeBSDPlatformAttribute() - { - } - - public RequiresNonFreeBSDPlatformAttribute(string reason) - { - this.reason = reason; - } - - public void ApplyToTest(Test test) - { - if (ScriptingEnvironment.IsRunningOnMono() && (Environment.GetEnvironmentVariable("TEAMCITY_BUILDCONF_NAME")?.Contains("FreeBSD") ?? false)) - { - var skipReason = "This test does not run on FreeBSD"; - if (!string.IsNullOrWhiteSpace(reason)) - { - skipReason += $" because {reason}"; - } - - test.RunState = RunState.Skipped; - test.Properties.Set(PropertyNames.SkipReason, skipReason); - } - } - } -} diff --git a/source/Calamari.Testing/Requirements/RequiresNonMacAttribute.cs b/source/Calamari.Testing/Requirements/RequiresNonMacAttribute.cs deleted file mode 100644 index 734dd810bf..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresNonMacAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Calamari.Common.Plumbing; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; - -namespace Calamari.Testing.Requirements -{ - public class RequiresNonMacAttribute : NUnitAttribute, IApplyToTest - { - public void ApplyToTest(Test test) - { - if (CalamariEnvironment.IsRunningOnMac) - { - test.RunState = RunState.Skipped; - test.Properties.Set(PropertyNames.SkipReason, "This test does not run on MacOS"); - } - } - } -} \ No newline at end of file diff --git a/source/Calamari.Testing/Requirements/RequiresNonWindowsAttribute.cs b/source/Calamari.Testing/Requirements/RequiresNonWindowsAttribute.cs deleted file mode 100644 index 1f8b720d43..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresNonWindowsAttribute.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; -using OSPlatform = System.Runtime.InteropServices.OSPlatform; - -namespace Calamari.Testing.Requirements -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] - public class NonWindowsTestAttribute : NUnitAttribute, IApplyToTest - { - readonly string message; - - public NonWindowsTestAttribute() : this("This test does not run on windows") - { - } - - public NonWindowsTestAttribute(string message) - { - this.message = message; - } - - static bool IsRunningOnWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - - public void ApplyToTest(Test test) - { - if (test.RunState == RunState.NotRunnable || test.RunState == RunState.Ignored) - return; - - if (IsRunningOnWindows) - { - test.RunState = RunState.Skipped; - test.Properties.Add(PropertyNames.SkipReason, message); - } - } - } -} \ No newline at end of file diff --git a/source/Calamari.Testing/Requirements/RequiresPowerShell5Attribute.cs b/source/Calamari.Testing/Requirements/RequiresPowerShell5Attribute.cs deleted file mode 100644 index 101cc15277..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresPowerShell5Attribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Calamari.Common.Plumbing.Extensions; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; - -namespace Calamari.Testing.Requirements -{ - public class RequiresPowerShell5OrLowerAttribute : NUnitAttribute, IApplyToTest - { - public void ApplyToTest(Test test) - { - if (ScriptingEnvironment.SafelyGetPowerShellVersion().Major > 5) - { - test.RunState = RunState.Skipped; - test.Properties.Set(PropertyNames.SkipReason, "This test requires PowerShell 5 or older."); - } - } - } -} diff --git a/source/Calamari.Testing/Requirements/RequiresAdminAttribute.cs b/source/Calamari.Testing/Requirements/RequiresWindowsAdminAttribute.cs similarity index 64% rename from source/Calamari.Testing/Requirements/RequiresAdminAttribute.cs rename to source/Calamari.Testing/Requirements/RequiresWindowsAdminAttribute.cs index 2d4ae5effe..22d3361b45 100644 --- a/source/Calamari.Testing/Requirements/RequiresAdminAttribute.cs +++ b/source/Calamari.Testing/Requirements/RequiresWindowsAdminAttribute.cs @@ -5,16 +5,20 @@ namespace Calamari.Testing.Requirements { - public class RequiresAdminAttribute : TestAttribute, ITestAction + public class RequiresWindowsAdminAttribute : TestAttribute, ITestAction { public void BeforeTest(ITest testDetails) { - if (!OperatingSystem.IsWindows()) return; + if (!OperatingSystem.IsWindows()) + { + Assert.Fail("This can only be run on Windows"); + return; + } var isAdmin = (new WindowsPrincipal(WindowsIdentity.GetCurrent())).IsInRole(WindowsBuiltInRole.Administrator); if (!isAdmin) { - Assert.Ignore("Requires Admin Rights"); + Assert.Ignore("Requires Admin rights"); } } diff --git a/source/Calamari.Testing/Requirements/RequiresWindowsAttribute.cs b/source/Calamari.Testing/Requirements/RequiresWindowsAttribute.cs deleted file mode 100644 index 3996cc664b..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresWindowsAttribute.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; -using OSPlatform = System.Runtime.InteropServices.OSPlatform; - -namespace Calamari.Testing.Requirements -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] - public class WindowsTestAttribute : NUnitAttribute, IApplyToTest - { - readonly string message; - - public WindowsTestAttribute() : this("This test only runs on Windows") - { - } - - public WindowsTestAttribute(string message) - { - this.message = message; - } - - static bool IsRunningOnWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - - public void ApplyToTest(Test test) - { - if (test.RunState == RunState.NotRunnable || test.RunState == RunState.Ignored) - return; - - if (!IsRunningOnWindows) - { - test.RunState = RunState.Skipped; - test.Properties.Add(PropertyNames.SkipReason, message); - } - } - } -} \ No newline at end of file diff --git a/source/Calamari.Testing/Requirements/RequiresWindowsServer2012OrAboveAttribute.cs b/source/Calamari.Testing/Requirements/RequiresWindowsServer2012OrAboveAttribute.cs deleted file mode 100644 index c4388b5f4f..0000000000 --- a/source/Calamari.Testing/Requirements/RequiresWindowsServer2012OrAboveAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Calamari.Common.Plumbing; -using NUnit.Framework; -using NUnit.Framework.Interfaces; - -namespace Calamari.Testing.Requirements; - -public class RequiresWindowsServer2012OrAboveAttribute : TestAttribute, ITestAction -{ - public void BeforeTest(ITest testDetails) - { - // If a test truly requires Windows only, the [WindowsTest] Attribute should also be used - if (!OperatingSystem.IsWindows()) - { - return; - } - if (!OperatingSystem.IsWindowsVersionAtLeast(6, 2, 9200)) - { - Assert.Ignore("Requires Windows Server 2012 or above"); - } - } - - public void AfterTest(ITest testDetails) - { - } - - public ActionTargets Targets { get; set; } -} diff --git a/source/Calamari.Testing/Requirements/RequiresWindowsServer2016OrAboveAttribute.cs b/source/Calamari.Testing/Requirements/RequiresWindowsServer2016OrAboveAttribute.cs index 8077227972..0e581bd106 100644 --- a/source/Calamari.Testing/Requirements/RequiresWindowsServer2016OrAboveAttribute.cs +++ b/source/Calamari.Testing/Requirements/RequiresWindowsServer2016OrAboveAttribute.cs @@ -4,7 +4,7 @@ namespace Calamari.Testing.Requirements; -public class RequiresWindowsServer2016OrAboveAttribute(string reason) : TestAttribute, ITestAction +public class RequiresWindowsServer2016OrAboveAttribute(string reason) : NUnitAttribute, ITestAction { public void BeforeTest(ITest testDetails) { diff --git a/source/Calamari.Testing/TestCategories.cs b/source/Calamari.Testing/TestCategories.cs new file mode 100644 index 0000000000..1b097f425a --- /dev/null +++ b/source/Calamari.Testing/TestCategories.cs @@ -0,0 +1,6 @@ +namespace Calamari.Testing; + +public static class TestCategories +{ + public const string Windows2016OrLater = "Windows2016OrLater"; +} \ No newline at end of file diff --git a/source/Calamari.Testing/TestPlatform.cs b/source/Calamari.Testing/TestPlatform.cs new file mode 100644 index 0000000000..7904799642 --- /dev/null +++ b/source/Calamari.Testing/TestPlatform.cs @@ -0,0 +1,14 @@ +using System; + +namespace Calamari.Testing; + +//Directly taken from the OctopusDeploy repo +[Flags] +public enum TestPlatforms +{ + Windows = 0b001, + Linux = 0b010, + MacOs = 0b100, + + Unix = Linux | MacOs +} \ No newline at end of file diff --git a/source/Calamari.Testing/TestPlatformsAttribute.cs b/source/Calamari.Testing/TestPlatformsAttribute.cs new file mode 100644 index 0000000000..323db03678 --- /dev/null +++ b/source/Calamari.Testing/TestPlatformsAttribute.cs @@ -0,0 +1,39 @@ +using System; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace Calamari.Testing; + +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] +public class TestPlatformsAttribute(TestPlatforms supportedPlatforms) : NUnitAttribute, ITestAction, IApplyToTest +{ + string GetSkipReason() => + $"This test only runs on: {string.Join(", ", TestPlatformsHelpers.GetSpecificPlatforms(supportedPlatforms))}"; + + public void BeforeTest(ITest test) + { + var currentPlatform = TestPlatformsHelpers.GetCurrentPlatform(); + + if ((currentPlatform & supportedPlatforms) == 0) + { + Assert.Ignore(GetSkipReason()); + } + } + + public void AfterTest(ITest test) + { + } + + public ActionTargets Targets { get; set; } + + public void ApplyToTest(Test test) + { + //for each specific platform, add the category + //if you specify Unix as your TestPlatforms, you will get Linux and MacOs as the specific platforms + foreach (var testPlatform in TestPlatformsHelpers.GetSpecificPlatforms(supportedPlatforms)) + { + test.Properties.Add(PropertyNames.Category, testPlatform.ToString()); + } + } +} \ No newline at end of file diff --git a/source/Calamari.Testing/TestPlatformsHelpers.cs b/source/Calamari.Testing/TestPlatformsHelpers.cs new file mode 100644 index 0000000000..2ff89e0ce1 --- /dev/null +++ b/source/Calamari.Testing/TestPlatformsHelpers.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Calamari.Testing; + +//Directly taken from the OctopusDeploy repo +public static class TestPlatformsHelpers +{ + static readonly TestPlatforms[] SpecificPlatforms = [TestPlatforms.Windows, TestPlatforms.Linux, TestPlatforms.MacOs]; + + /// Enumerate the specific platforms set in the given bit flags. + public static IEnumerable GetSpecificPlatforms(TestPlatforms flags) => + SpecificPlatforms.Where(platform => (platform & flags) != 0); + + public static TestPlatforms GetCurrentPlatform() => + OperatingSystem.IsLinux() ? TestPlatforms.Linux : + OperatingSystem.IsWindows() ? TestPlatforms.Windows : + OperatingSystem.IsMacOS() ? TestPlatforms.MacOs : + throw new InvalidOperationException("Unknown test platform."); +} diff --git a/source/Calamari.Tests/AWS/AwsAuthenticationProviderFixture.cs b/source/Calamari.Tests/AWS/AwsAuthenticationProviderFixture.cs index b12dcbe1a1..6a5c0af74f 100644 --- a/source/Calamari.Tests/AWS/AwsAuthenticationProviderFixture.cs +++ b/source/Calamari.Tests/AWS/AwsAuthenticationProviderFixture.cs @@ -13,7 +13,6 @@ namespace Calamari.Tests.AWS { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class AwsAuthenticationProviderFixture { static readonly CancellationTokenSource CancellationTokenSource = new CancellationTokenSource(); diff --git a/source/Calamari.Tests/AWS/CloudFormation/CloudFormationFixture.cs b/source/Calamari.Tests/AWS/CloudFormation/CloudFormationFixture.cs index 0673e11ca3..c0ace7a311 100644 --- a/source/Calamari.Tests/AWS/CloudFormation/CloudFormationFixture.cs +++ b/source/Calamari.Tests/AWS/CloudFormation/CloudFormationFixture.cs @@ -9,7 +9,6 @@ namespace Calamari.Tests.AWS.CloudFormation { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class CloudFormationFixture { string GenerateStackName() => $"calamaricloudformation{Guid.NewGuid():N}"; diff --git a/source/Calamari.Tests/AWS/CloudFormation/CloudFormationVariableReplacementFixture.cs b/source/Calamari.Tests/AWS/CloudFormation/CloudFormationVariableReplacementFixture.cs index 061afdbef6..28da843712 100644 --- a/source/Calamari.Tests/AWS/CloudFormation/CloudFormationVariableReplacementFixture.cs +++ b/source/Calamari.Tests/AWS/CloudFormation/CloudFormationVariableReplacementFixture.cs @@ -8,7 +8,6 @@ namespace Calamari.Tests.AWS.CloudFormation { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class CloudFormationVariableReplacementFixture { string StackName; diff --git a/source/Calamari.Tests/AWS/CloudFormationStackNameGeneratorFixture.cs b/source/Calamari.Tests/AWS/CloudFormationStackNameGeneratorFixture.cs index 9fc2157ae1..72dcc3d028 100644 --- a/source/Calamari.Tests/AWS/CloudFormationStackNameGeneratorFixture.cs +++ b/source/Calamari.Tests/AWS/CloudFormationStackNameGeneratorFixture.cs @@ -7,7 +7,6 @@ namespace Calamari.Tests.AWS { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class CloudFormationStackNameGeneratorTests { [TestCase("Environments-1", "Tenants-1", "cf-environments1-tenants1")] diff --git a/source/Calamari.Tests/AWS/CreateAwsS3CommandFixture.cs b/source/Calamari.Tests/AWS/CreateAwsS3CommandFixture.cs index 78c4053bfe..483293700d 100644 --- a/source/Calamari.Tests/AWS/CreateAwsS3CommandFixture.cs +++ b/source/Calamari.Tests/AWS/CreateAwsS3CommandFixture.cs @@ -25,7 +25,6 @@ namespace Calamari.Tests.AWS { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class CreateAwsS3CommandFixture { const string Region = "ap-southeast-2"; diff --git a/source/Calamari.Tests/AWS/UploadAwsS3CommandFixture.cs b/source/Calamari.Tests/AWS/UploadAwsS3CommandFixture.cs index 5f3bbd420b..7488b18002 100644 --- a/source/Calamari.Tests/AWS/UploadAwsS3CommandFixture.cs +++ b/source/Calamari.Tests/AWS/UploadAwsS3CommandFixture.cs @@ -36,7 +36,6 @@ namespace Calamari.Tests.AWS { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class UploadAwsS3FixtureForExistingBucket : UploadAwsS3CommandFixture { // S3 Bucket operations are only eventually consistent (https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html#ConsistencyModel), @@ -519,7 +518,6 @@ await Validate(async client => } [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class UploadAwsS3FixtureForNewBucket : UploadAwsS3CommandFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/Bash/BashProxyFixture.cs b/source/Calamari.Tests/Fixtures/Bash/BashProxyFixture.cs index 3f1f1214f0..afa5b39c59 100644 --- a/source/Calamari.Tests/Fixtures/Bash/BashProxyFixture.cs +++ b/source/Calamari.Tests/Fixtures/Bash/BashProxyFixture.cs @@ -5,7 +5,7 @@ namespace Calamari.Tests.Fixtures.Bash { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public class BashProxyFixture : ScriptProxyFixtureBase { protected override CalamariResult RunScript() diff --git a/source/Calamari.Tests/Fixtures/Certificates/ImportCertificateCommandFixture.cs b/source/Calamari.Tests/Fixtures/Certificates/ImportCertificateCommandFixture.cs index c65ddc3722..de9be08fd8 100644 --- a/source/Calamari.Tests/Fixtures/Certificates/ImportCertificateCommandFixture.cs +++ b/source/Calamari.Tests/Fixtures/Certificates/ImportCertificateCommandFixture.cs @@ -16,7 +16,8 @@ namespace Calamari.Tests.Fixtures.Certificates { - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestFixture] + [TestPlatforms(TestPlatforms.Windows)] [SupportedOSPlatform("windows")] public class ImportCertificateCommandFixture : CalamariFixture { diff --git a/source/Calamari.Tests/Fixtures/Certificates/PrivateKeyAccessRuleExtensionMethodsTests.cs b/source/Calamari.Tests/Fixtures/Certificates/PrivateKeyAccessRuleExtensionMethodsTests.cs index 261ae5dfe5..6696aef306 100644 --- a/source/Calamari.Tests/Fixtures/Certificates/PrivateKeyAccessRuleExtensionMethodsTests.cs +++ b/source/Calamari.Tests/Fixtures/Certificates/PrivateKeyAccessRuleExtensionMethodsTests.cs @@ -8,7 +8,7 @@ namespace Calamari.Tests.Fixtures.Certificates { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [SupportedOSPlatform("windows")] public class PrivateKeyAccessRuleExtensionMethodsTests { diff --git a/source/Calamari.Tests/Fixtures/Certificates/WindowsX509CertificateStoreFixture.cs b/source/Calamari.Tests/Fixtures/Certificates/WindowsX509CertificateStoreFixture.cs index de1b934e34..94298bc30a 100644 --- a/source/Calamari.Tests/Fixtures/Certificates/WindowsX509CertificateStoreFixture.cs +++ b/source/Calamari.Tests/Fixtures/Certificates/WindowsX509CertificateStoreFixture.cs @@ -16,7 +16,7 @@ namespace Calamari.Tests.Fixtures.Certificates { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [SupportedOSPlatform("windows")] public class WindowsX509CertificateStoreFixture { diff --git a/source/Calamari.Tests/Fixtures/ConfigurationTransforms/TransformFileLocatorFixture.cs b/source/Calamari.Tests/Fixtures/ConfigurationTransforms/TransformFileLocatorFixture.cs index 20e8445129..c656a4968e 100644 --- a/source/Calamari.Tests/Fixtures/ConfigurationTransforms/TransformFileLocatorFixture.cs +++ b/source/Calamari.Tests/Fixtures/ConfigurationTransforms/TransformFileLocatorFixture.cs @@ -6,7 +6,7 @@ namespace Calamari.Tests.Fixtures.ConfigurationTransforms { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class TransformFileLocatorFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/Deployment/Conventions/ConfigurationTransformConventionFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/Conventions/ConfigurationTransformConventionFixture.cs index 06a981cf4b..26d6841ec5 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/Conventions/ConfigurationTransformConventionFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/Conventions/ConfigurationTransformConventionFixture.cs @@ -200,7 +200,7 @@ public void ShouldApplyTransformToMulipleTargetFiles() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [TestCase("bar.blah => *.Bar.Blah", "xyz.bar.blah", "bar.blah")] [TestCase("*.Bar.Blah => bar.blah", "bar.blah", "xyz.bar.blah")] [TestCase("foo.bar.config => Foo.Config", "foo.config", "foo.bar.config")] @@ -214,7 +214,7 @@ public void CaseInsensitiveOnWindows(string pattern, string from, string to) } [Test] - [Category(TestCategory.CompatibleOS.OnlyNix)] + [TestPlatforms(TestPlatforms.Windows)] [TestCase("bar.blah => *.Bar.Blah", "xyz.bar.blah", "bar.blah")] [TestCase("*.Bar.Blah => bar.blah", "bar.blah", "xyz.bar.blah")] [TestCase("foo.bar.config => Foo.Config", "foo.config", "foo.bar.config")] @@ -231,7 +231,7 @@ public void CaseSensitiveOnNix(string pattern, string from, string to) } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldOutputDiagnosticsLoggingIfEnabled() { var calamariFileSystem = Substitute.For(); diff --git a/source/Calamari.Tests/Fixtures/Deployment/Conventions/CopyPackageToCustomInstallationDirectoryConventionFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/Conventions/CopyPackageToCustomInstallationDirectoryConventionFixture.cs index c79b463c9d..43d0274ce6 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/Conventions/CopyPackageToCustomInstallationDirectoryConventionFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/Conventions/CopyPackageToCustomInstallationDirectoryConventionFixture.cs @@ -115,7 +115,7 @@ public void ShouldFailIfCustomInstallationDirectoryIsRelativePath() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] [ExpectedException(ExpectedMessage = "Access to the path /var/tmp/myCustomInstallDir was denied. Ensure that the application that uses this directory is not running.")] public void ShouldNotIncludeIISRelatedInfoInErrorMessageWhenAccessDeniedException() { @@ -128,7 +128,7 @@ public void ShouldNotIncludeIISRelatedInfoInErrorMessageWhenAccessDeniedExceptio [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [ExpectedException(ExpectedMessage = "Access to the path C:\\myCustomInstallDir was denied. Ensure that the application that uses this directory is not running. If this is an IIS website, stop the application pool or use an app_offline.htm file (see https://g.octopushq.com/TakingWebsiteOffline).")] public void ShouldIncludeIISRelatedInfoInErrorMessageWhenAccessDeniedException() { diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployBilingualPackageFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployBilingualPackageFixture.cs index 97e2fbda0c..6b8f822644 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployBilingualPackageFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployBilingualPackageFixture.cs @@ -17,7 +17,7 @@ public override void SetUp() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldOnlyRunPowerShellScriptsOnWindows() { using (var nupkgFile = new TemporaryFile(PackageBuilder.BuildSamplePackage("Acme.PackageBilingual", "1.0.0"))) @@ -40,7 +40,7 @@ public void ShouldOnlyRunPowerShellScriptsOnWindows() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void ShouldOnlyRunBashScriptsOnMacOrNix() { using (var tarFile = new TemporaryFile(TarGzBuilder.BuildSamplePackage("Acme.PackageBilingual", "1.0.0", false))) diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployPackageWithScriptsFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployPackageWithScriptsFixture.cs index bd82616de7..62bd3476b4 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployPackageWithScriptsFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployPackageWithScriptsFixture.cs @@ -1,5 +1,6 @@ using Calamari.Common.Plumbing.FileSystem; using Calamari.Integration.FileSystem; +using Calamari.Testing; using Calamari.Testing.Helpers; using Calamari.Tests.Fixtures.Deployment.Packages; using Calamari.Tests.Helpers; @@ -8,7 +9,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class DeployPackageWithScriptsFixture : DeployPackageFixture { private const string ServiceName = "Acme.Package"; diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployVhdFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployVhdFixture.cs index 21e915650e..d0371a195f 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployVhdFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployVhdFixture.cs @@ -12,7 +12,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class DeployVhdFixture : DeployPackageFixture { private const string ServiceName = "Acme.Vhd"; @@ -32,8 +32,7 @@ public override void CleanUp() } [Test] - [RequiresAdmin] - [RequiresWindowsServer2012OrAbove] + [RequiresWindowsAdmin] [SupportedOSPlatform("windows")] public void ShouldDeployAVhd() { @@ -75,8 +74,7 @@ public void ShouldDeployAVhd() } [Test] - [RequiresAdmin] - [RequiresWindowsServer2012OrAbove] + [RequiresWindowsAdmin] [SupportedOSPlatform("windows")] public void ShouldDeployAVhdWithTwoPartitions() { @@ -126,8 +124,7 @@ public void ShouldDeployAVhdWithTwoPartitions() } [Test] - [RequiresAdmin] - [RequiresWindowsServer2012OrAbove] + [RequiresWindowsAdmin] [SupportedOSPlatform("windows")] public void ShouldBlockMountAndOverrideAppPath() { diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageFixture.cs index a17a0c7d2d..c25f8ef3f1 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageFixture.cs @@ -51,7 +51,7 @@ public void Dispose() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldDeployPackageOnWindows() { var result = DeployPackage(); @@ -64,12 +64,9 @@ public void ShouldDeployPackageOnWindows() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void ShouldDeployPackageOnMacOrNix() { - if (!CalamariEnvironment.IsRunningOnMac && !CalamariEnvironment.IsRunningOnNix) - Assert.Inconclusive("This test is designed to run on *Nix or Mac."); - var result = DeployPackage(); result.AssertSuccess(); @@ -141,7 +138,6 @@ public void ShouldTransformConfig() } [Test] - [Category(TestCategory.ScriptingSupport.DotnetScript)] public void ShouldInvokeDeployFailedOnError() { Variables.Set("ShouldFail", "yes"); @@ -191,7 +187,7 @@ public void ShouldExecuteFeatureScripts(DeploymentType deploymentType) } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldModifyIisWebsiteRoot() { // If the 'UpdateIisWebsite' variable is set, the website root will be updated diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageToIISFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageToIISFixture.cs index 5dfbe77618..ee9b4a9c2c 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageToIISFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWebPackageToIISFixture.cs @@ -22,7 +22,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [SupportedOSPlatform("windows")] public class DeployWebPackageToIISFixture : DeployPackageFixture { @@ -68,7 +68,6 @@ public override void CleanUp() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDeployAsWebSite() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; @@ -108,7 +107,6 @@ public void ShouldDeployAsWebSite() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDeployAsVirtualDirectory() { iis.CreateWebSiteOrVirtualDirectory(uniqueValue, null, ".", 1083); @@ -137,7 +135,6 @@ public void ShouldDeployAsVirtualDirectory() [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldKeepExistingBindingsWhenExistingBindingsIsMerge() { // The variable we are testing @@ -170,7 +167,6 @@ public void ShouldKeepExistingBindingsWhenExistingBindingsIsMerge() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldExcludeTempBindingWhenExistingBindingsIsMerge() { // The variable we are testing @@ -201,7 +197,6 @@ public void ShouldExcludeTempBindingWhenExistingBindingsIsMerge() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldRemoveExistingBindingsByDefault() { const int existingBindingPort = 1083; @@ -231,7 +226,6 @@ public void ShouldRemoveExistingBindingsByDefault() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDeployNewVersion() { iis.CreateWebSiteOrVirtualDirectory(uniqueValue, null, ".", 1083); @@ -258,7 +252,6 @@ public void ShouldDeployNewVersion() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldNotAllowMissingParentSegments() { iis.CreateWebSiteOrVirtualDirectory(uniqueValue, null, ".", 1084); @@ -280,7 +273,6 @@ public void ShouldNotAllowMissingParentSegments() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldNotAllowMissingWebSiteForVirtualFolders() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "virtualDirectory"; @@ -298,7 +290,6 @@ public void ShouldNotAllowMissingWebSiteForVirtualFolders() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDeployAsWebApplication() { iis.CreateWebSiteOrVirtualDirectory(uniqueValue, null, ".", 1085); @@ -335,7 +326,6 @@ public void ShouldDeployAsWebApplication() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDetectAttemptedConversionFromVirtualDirectoryToWebApplication() { iis.CreateWebSiteOrVirtualDirectory(uniqueValue, $"/{uniqueValue}", ".", 1086); @@ -360,7 +350,6 @@ public void ShouldDetectAttemptedConversionFromVirtualDirectoryToWebApplication( } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldDeployWhenVirtualPathAlreadyExistsAndPointsToPhysicalDirectory() { var webSitePhysicalPath = Path.Combine(Path.GetTempPath(), uniqueValue); @@ -388,7 +377,6 @@ public void ShouldDeployWhenVirtualPathAlreadyExistsAndPointsToPhysicalDirectory } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldCreateHttpsBindingUsingCertificatePassedAsVariable() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; @@ -433,7 +421,6 @@ public void ShouldCreateHttpsBindingUsingCertificatePassedAsVariable() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldFindAndUseExistingCertificateInStoreIfPresent() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; @@ -476,7 +463,6 @@ public void ShouldFindAndUseExistingCertificateInStoreIfPresent() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldCreateHttpsBindingUsing_SingleCertificatePassedAsThumbprint() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; @@ -513,7 +499,6 @@ public void ShouldCreateHttpsBindingUsing_SingleCertificatePassedAsThumbprint() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldCreateHttpsBindingUsing_MultipleCertificates_InMultipleStores_PassedAsThumbprint() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; @@ -563,7 +548,6 @@ public void ShouldCreateHttpsBindingUsing_MultipleCertificates_InMultipleStores_ } [Test] // https://github.com/OctopusDeploy/Issues/issues/3378 - [Category(TestCategory.CompatibleOS.OnlyWindows)] public void ShouldNotFailIfDisabledBindingUsesUnavailableCertificateVariable() { Variables["Octopus.Action.IISWebSite.DeploymentType"] = "webSite"; diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceArgumentsFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceArgumentsFixture.cs index 302e514e08..41f82eee57 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceArgumentsFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceArgumentsFixture.cs @@ -11,7 +11,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class DeployWindowsServiceArgumentsFixture : DeployWindowsServiceAbstractFixture { protected override string ServiceName => "DumpArgs"; diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceFixture.cs index d2abda0464..006cfd80ae 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceFixture.cs @@ -11,7 +11,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] [SupportedOSPlatform("Windows")] public class DeployWindowsServiceFixture : DeployWindowsServiceAbstractFixture { diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceRunningStateFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceRunningStateFixture.cs index efdd0c0962..6666fe6737 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceRunningStateFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceRunningStateFixture.cs @@ -10,7 +10,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class DeployWindowsServiceRunningStateFixture : DeployWindowsServiceAbstractFixture { protected override string ServiceName => "RunningStateFixture"; diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceWithCustomServiceNameFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceWithCustomServiceNameFixture.cs index 85049e0de5..9aa6772e84 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceWithCustomServiceNameFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployWindowsServiceWithCustomServiceNameFixture.cs @@ -6,7 +6,7 @@ namespace Calamari.Tests.Fixtures.Deployment { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class DeployWindowsServiceWithCustomServiceNameFixture : DeployWindowsServiceAbstractFixture { protected override string ServiceName => @"[f`o]o$b'[a]r"; diff --git a/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptFixture.cs b/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptFixture.cs index 15a485e5de..697a2615c0 100644 --- a/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptFixture.cs +++ b/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptFixture.cs @@ -12,7 +12,6 @@ namespace Calamari.Tests.Fixtures.DotnetScript { [TestFixture] - [Category(TestCategory.ScriptingSupport.DotnetScript)] public class DotnetScriptFixture : CalamariFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptProxyFixture.cs b/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptProxyFixture.cs index f400bc545d..f5c1b3aad1 100644 --- a/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptProxyFixture.cs +++ b/source/Calamari.Tests/Fixtures/DotnetScript/DotnetScriptProxyFixture.cs @@ -8,7 +8,6 @@ namespace Calamari.Tests.Fixtures.DotnetScript { [TestFixture] - [Category(TestCategory.ScriptingSupport.DotnetScript)] public class DotnetScriptProxyFixture : WindowsScriptProxyFixtureBase { protected override CalamariResult RunScript() @@ -17,7 +16,7 @@ protected override CalamariResult RunScript() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public override void Initialize_HasSystemProxy_UseSystemProxyWithExceptions() { // If the HTTP_PROXY environment variable have been set .NET Core will only take entries in the NO_PROXY environment variable into account, @@ -28,7 +27,7 @@ public override void Initialize_HasSystemProxy_UseSystemProxyWithExceptions() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public override void Initialize_HasSystemProxy_UseSystemProxyWithCredentials() { // .NET Core first unescapes the username and password, then splits the auth string on ':' and finally escapes the username and password again. diff --git a/source/Calamari.Tests/Fixtures/FunctionCodeGen/DynamicFunctionFixture.cs b/source/Calamari.Tests/Fixtures/FunctionCodeGen/DynamicFunctionFixture.cs index bde84d51b4..39d5af84d6 100644 --- a/source/Calamari.Tests/Fixtures/FunctionCodeGen/DynamicFunctionFixture.cs +++ b/source/Calamari.Tests/Fixtures/FunctionCodeGen/DynamicFunctionFixture.cs @@ -22,8 +22,6 @@ namespace Calamari.Tests.Fixtures.FunctionCodeGen { [TestFixture] - [RequiresNonFreeBSDPlatform] - [Category(TestCategory.PlatformAgnostic)] public class DynamicFunctionFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/Iis/IisFixture.cs b/source/Calamari.Tests/Fixtures/Iis/IisFixture.cs index 64d09d515c..bdc68eb0a6 100644 --- a/source/Calamari.Tests/Fixtures/Iis/IisFixture.cs +++ b/source/Calamari.Tests/Fixtures/Iis/IisFixture.cs @@ -6,7 +6,7 @@ namespace Calamari.Tests.Fixtures.Iis { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class IisFixture { readonly WebServerSupport webServer = new WebServerSevenSupport(); diff --git a/source/Calamari.Tests/Fixtures/Integration/FileSystem/CalamariPhysicalFileSystemFixture.cs b/source/Calamari.Tests/Fixtures/Integration/FileSystem/CalamariPhysicalFileSystemFixture.cs index 0c86e767f5..5144a59e8f 100644 --- a/source/Calamari.Tests/Fixtures/Integration/FileSystem/CalamariPhysicalFileSystemFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/FileSystem/CalamariPhysicalFileSystemFixture.cs @@ -38,7 +38,7 @@ public void TearDown() [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void WindowsUsesWindowsFileSystem() { var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); @@ -46,7 +46,7 @@ public void WindowsUsesWindowsFileSystem() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void NonWindowsUsesWindowsFileSystem() { var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); @@ -358,7 +358,7 @@ public void EnumerateFilesWithGlobShouldIgnoreGroups(string directory, string gl } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void LongFilePathsShouldWork() { var paths = new Stack(); diff --git a/source/Calamari.Tests/Fixtures/Integration/FileSystem/PathExtensionsFixture.cs b/source/Calamari.Tests/Fixtures/Integration/FileSystem/PathExtensionsFixture.cs index d4591b32c0..698c276c31 100644 --- a/source/Calamari.Tests/Fixtures/Integration/FileSystem/PathExtensionsFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/FileSystem/PathExtensionsFixture.cs @@ -25,7 +25,7 @@ public class PathExtensionsFixture [TestCase(@"c:\foo\..\bar\baz", @"c:\foo", false)] [TestCase(@"c:\foo\..\bar\baz", @"c:\bar", true)] [TestCase(@"c:\foo\..\bar\baz", @"c:\barr", false)] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void IsChildOfTest(string child, string parent, bool result) { child.IsChildOf(parent).Should().Be(result); @@ -35,7 +35,7 @@ public void IsChildOfTest(string child, string parent, bool result) [TestCase(@"c:\foo\a.txt", @"c:\FOO", true)] [TestCase(@"c:\foo", @"c:", true)] [TestCase(@"c:\foo", @"c:\", true)] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void IsChildOfTestWindows(string child, string parent, bool result) { child.IsChildOf(parent).Should().Be(result); @@ -46,7 +46,7 @@ public void IsChildOfTestWindows(string child, string parent, bool result) [TestCase(@"/", @"/", true)] [TestCase(@"/foo", @"/", true)] [TestCase(@"/", @"/foo", false)] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void IsChildOfTestUnix(string child, string parent, bool result) { child.IsChildOf(parent).Should().Be(result); diff --git a/source/Calamari.Tests/Fixtures/Integration/FileSystem/WindowsPhysicalFileSystemFixture.cs b/source/Calamari.Tests/Fixtures/Integration/FileSystem/WindowsPhysicalFileSystemFixture.cs index e7b03d65e0..80e8c07312 100644 --- a/source/Calamari.Tests/Fixtures/Integration/FileSystem/WindowsPhysicalFileSystemFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/FileSystem/WindowsPhysicalFileSystemFixture.cs @@ -7,7 +7,7 @@ namespace Calamari.Tests.Fixtures.Integration.FileSystem { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class WindowsPhysicalFileSystemFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/Integration/Packages/GitHubPackageDownloadFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Packages/GitHubPackageDownloadFixture.cs index 7f4fbc83c3..27e315d234 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Packages/GitHubPackageDownloadFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Packages/GitHubPackageDownloadFixture.cs @@ -12,6 +12,7 @@ namespace Calamari.Tests.Fixtures.Integration.Packages { [TestFixture] + [TestPlatforms(TestPlatforms.Windows)] //Keeps rate limit low public class GitHubPackageDownloadFixture { //See "GitHub Test Account" @@ -49,7 +50,6 @@ public void SetUp() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] //Keeps rate limit low public void DownloadsPackageFromGitHub() { var downloader = GetDownloader(); @@ -64,7 +64,6 @@ public void DownloadsPackageFromGitHub() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] //Keeps rate limit low public void WillReUseFileIfItExists() { var downloader = GetDownloader(); @@ -85,7 +84,6 @@ public void WillReUseFileIfItExists() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] //Keeps rate limit low public void DownloadsPackageFromGitHubWithDifferentVersionFormat() { var downloader = GetDownloader(); diff --git a/source/Calamari.Tests/Fixtures/Integration/Packages/MavenPackageDownloaderFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Packages/MavenPackageDownloaderFixture.cs index 6c60d921c0..9a22e077e4 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Packages/MavenPackageDownloaderFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Packages/MavenPackageDownloaderFixture.cs @@ -27,7 +27,6 @@ public void TestFixtureTearDown() } [Test] - [RequiresNonFreeBSDPlatform] public void DownloadMavenPackage() { var downloader = GetDownloader(); @@ -38,7 +37,6 @@ public void DownloadMavenPackage() } [Test] - [RequiresNonFreeBSDPlatform] public void DownloadMavenSourcePackage() { var downloader = GetDownloader(); diff --git a/source/Calamari.Tests/Fixtures/Integration/Packages/NpmPackageDownloaderFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Packages/NpmPackageDownloaderFixture.cs index 3fd47abc92..a5d3e273c4 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Packages/NpmPackageDownloaderFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Packages/NpmPackageDownloaderFixture.cs @@ -29,7 +29,6 @@ public void TestFixtureTearDown() } [Test] - [RequiresNonFreeBSDPlatform] public void DownloadNpmPackage() { var downloader = GetDownloader(); @@ -41,7 +40,6 @@ public void DownloadNpmPackage() } [Test] - [RequiresNonFreeBSDPlatform] public void DownloadScopedNpmPackage() { var downloader = GetDownloader(); @@ -53,7 +51,6 @@ public void DownloadScopedNpmPackage() } [Test] - [RequiresNonFreeBSDPlatform] public void DownloadNpmPackageFromCache() { var downloader = GetDownloader(); diff --git a/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/NixSystemSemaphoreFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/NixSystemSemaphoreFixture.cs index cf91569434..e778b0ee98 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/NixSystemSemaphoreFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/NixSystemSemaphoreFixture.cs @@ -4,7 +4,7 @@ namespace Calamari.Tests.Fixtures.Integration.Process.Semaphores { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public class NixSystemSemaphoreFixture : SemaphoreFixtureBase { } diff --git a/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/WindowsSystemSemaphoreFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/WindowsSystemSemaphoreFixture.cs index b2baacefa2..487556cf20 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/WindowsSystemSemaphoreFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Process/Semaphores/WindowsSystemSemaphoreFixture.cs @@ -4,7 +4,7 @@ namespace Calamari.Tests.Fixtures.Integration.Process.Semaphores { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class WindowsSystemSemaphoreFixture : SemaphoreFixtureBase { } } \ No newline at end of file diff --git a/source/Calamari.Tests/Fixtures/Integration/Proxies/ProxyEnvironmentVariablesGeneratorFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Proxies/ProxyEnvironmentVariablesGeneratorFixture.cs index 4609800cd5..aa8a3de1df 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Proxies/ProxyEnvironmentVariablesGeneratorFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Proxies/ProxyEnvironmentVariablesGeneratorFixture.cs @@ -41,7 +41,7 @@ static void ResetSystemProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void Initialize_HasSystemProxy_NoProxy() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -51,7 +51,7 @@ public void Initialize_HasSystemProxy_NoProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void Initialize_HasSystemProxy_UseSystemProxy() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -61,7 +61,7 @@ public void Initialize_HasSystemProxy_UseSystemProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void Initialize_HasSystemProxy_UseSystemProxyWithCredentials() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -71,7 +71,7 @@ public void Initialize_HasSystemProxy_UseSystemProxyWithCredentials() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void Initialize_HasSystemProxy_CustomProxy() { ProxyRoutines.SetProxy(BadproxyUrl).Should().BeTrue(); @@ -81,7 +81,7 @@ public void Initialize_HasSystemProxy_CustomProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void Initialize_HasSystemProxy_CustomProxyWithCredentials() { ProxyRoutines.SetProxy(BadproxyUrl).Should().BeTrue(); diff --git a/source/Calamari.Tests/Fixtures/Integration/Proxies/WebProxyInitializerFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Proxies/WebProxyInitializerFixture.cs index ce31e3e832..2578441362 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Proxies/WebProxyInitializerFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Proxies/WebProxyInitializerFixture.cs @@ -9,7 +9,7 @@ namespace Calamari.Tests.Fixtures.Integration.Proxies { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class ProxyInitializerFixture { const string BadproxyUrl = "http://proxy-initializer-fixture-bad-proxy:1234"; diff --git a/source/Calamari.Tests/Fixtures/Integration/Proxies/WindowsScriptProxyFixtureBase.cs b/source/Calamari.Tests/Fixtures/Integration/Proxies/WindowsScriptProxyFixtureBase.cs index ad7dc08a47..efe781fc4f 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Proxies/WindowsScriptProxyFixtureBase.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Proxies/WindowsScriptProxyFixtureBase.cs @@ -25,7 +25,7 @@ public void ResetSystemProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_NoProxy() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -35,7 +35,7 @@ public virtual void Initialize_HasSystemProxy_NoProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_UseSystemProxy() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -45,7 +45,7 @@ public virtual void Initialize_HasSystemProxy_UseSystemProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_UseSystemProxyWithExceptions() { var proxyException = "octopustestbypassurl.com"; @@ -57,7 +57,7 @@ public virtual void Initialize_HasSystemProxy_UseSystemProxyWithExceptions() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_UseSystemProxyWithCredentials() { ProxyRoutines.SetProxy(proxyUrl).Should().BeTrue(); @@ -67,7 +67,7 @@ public virtual void Initialize_HasSystemProxy_UseSystemProxyWithCredentials() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_CustomProxy() { ProxyRoutines.SetProxy(BadproxyUrl).Should().BeTrue(); @@ -77,7 +77,7 @@ public virtual void Initialize_HasSystemProxy_CustomProxy() } [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public virtual void Initialize_HasSystemProxy_CustomProxyWithCredentials() { ProxyRoutines.SetProxy(BadproxyUrl).Should().BeTrue(); diff --git a/source/Calamari.Tests/Fixtures/Integration/Scripting/BashScriptEngineFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Scripting/BashScriptEngineFixture.cs index f4b858e4d7..20a1f938e7 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Scripting/BashScriptEngineFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Scripting/BashScriptEngineFixture.cs @@ -14,7 +14,7 @@ namespace Calamari.Tests.Fixtures.Integration.Scripting public class BashScriptEngineFixture : ScriptEngineFixtureBase { [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void BashDecryptsVariables() { using (var scriptFile = new TemporaryFile(Path.ChangeExtension(Path.GetTempFileName(), "sh"))) diff --git a/source/Calamari.Tests/Fixtures/Integration/Scripting/CSharpScriptEngineFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Scripting/CSharpScriptEngineFixture.cs index bc1e079c75..4c76a59055 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Scripting/CSharpScriptEngineFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Scripting/CSharpScriptEngineFixture.cs @@ -13,7 +13,6 @@ namespace Calamari.Tests.Fixtures.Integration.Scripting [TestFixture] public class CSharpScriptEngineFixture : ScriptEngineFixtureBase { - [Category(TestCategory.ScriptingSupport.DotnetScript)] [Test] public void DotnetScript_CSharpDecryptsVariables() { diff --git a/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellCoreBootstrapperFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellCoreBootstrapperFixture.cs index dd48809538..450da7e38c 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellCoreBootstrapperFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellCoreBootstrapperFixture.cs @@ -16,7 +16,7 @@ namespace Calamari.Tests.Fixtures.Integration.Scripting { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class PowerShellCoreBootstrapperFixture { [Test] diff --git a/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellScriptEngineFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellScriptEngineFixture.cs index 9a09b8a9a3..bb27faf43a 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellScriptEngineFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Scripting/PowerShellScriptEngineFixture.cs @@ -14,7 +14,6 @@ namespace Calamari.Tests.Fixtures.Integration.Scripting public class PowerShellScriptEngineFixture : ScriptEngineFixtureBase { [Test] - [RequiresNonFreeBSDPlatform] public void PowerShellDecryptsVariables() { using (var scriptFile = new TemporaryFile(Path.ChangeExtension(Path.GetTempFileName(), "ps1"))) @@ -30,7 +29,6 @@ public void PowerShellDecryptsVariables() [TestCase("True")] [TestCase("1")] [TestCase("2")] - [RequiresNonFreeBSDPlatform] [RequiresPowerShell5OrAbove] public void PowerShellCanSetTraceMode(string variableValue) { @@ -63,7 +61,6 @@ public void PowerShellCanSetTraceMode(string variableValue) [TestCase("True")] [TestCase("1")] [TestCase("2")] - [RequiresNonFreeBSDPlatform] [RequiresPowerShell4] public void PowerShell4DoesntSupport(string variableValue) { @@ -90,7 +87,6 @@ public void PowerShell4DoesntSupport(string variableValue) [TestCase("False")] [TestCase("false")] [TestCase("")] - [RequiresNonFreeBSDPlatform] public void PowerShellDoesntForceTraceMode(string variableValue) { using (var scriptFile = new TemporaryFile(Path.ChangeExtension(Path.GetTempFileName(), "ps1"))) @@ -109,7 +105,6 @@ public void PowerShellDoesntForceTraceMode(string variableValue) } [Test] - [RequiresNonFreeBSDPlatform] public void PowerShellWorksWithStrictMode() { using (var scriptFile = new TemporaryFile(Path.ChangeExtension(Path.GetTempFileName(), "ps1"))) @@ -130,7 +125,6 @@ public void PowerShellWorksWithStrictMode() [Test] [TestCase("false")] [TestCase("")] - [RequiresNonFreeBSDPlatform] public void PowerShellDoesntForceStrictMode(string variableValue) { using (var scriptFile = new TemporaryFile(Path.ChangeExtension(Path.GetTempFileName(), "ps1"))) diff --git a/source/Calamari.Tests/Fixtures/Integration/Scripting/ScriptEngineFixture.cs b/source/Calamari.Tests/Fixtures/Integration/Scripting/ScriptEngineFixture.cs index 9596bd02c9..dce82e56cc 100644 --- a/source/Calamari.Tests/Fixtures/Integration/Scripting/ScriptEngineFixture.cs +++ b/source/Calamari.Tests/Fixtures/Integration/Scripting/ScriptEngineFixture.cs @@ -31,14 +31,14 @@ public class ScriptEngineFixture }; [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void DeterminesCorrectScriptTypePreferenceOrderWindows() { DeterminesCorrectScriptTypePreferenceOrder(ScriptPreferencesWindows); } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void DeterminesCorrectScriptTypePreferencesOrderNonWindows() { DeterminesCorrectScriptTypePreferenceOrder(ScriptPreferencesNonWindows); diff --git a/source/Calamari.Tests/Fixtures/Nginx/NginxFixture.cs b/source/Calamari.Tests/Fixtures/Nginx/NginxFixture.cs index e5a4d507d4..afe91a9b15 100644 --- a/source/Calamari.Tests/Fixtures/Nginx/NginxFixture.cs +++ b/source/Calamari.Tests/Fixtures/Nginx/NginxFixture.cs @@ -23,7 +23,7 @@ namespace Calamari.Tests.Fixtures.Nginx { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public class NginxFixture : CalamariFixture { readonly ICalamariFileSystem fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); @@ -164,7 +164,7 @@ public void SetupStaticContentWithReverseProxySite() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void SetupReverseProxyWithSslSite() { var locations = diff --git a/source/Calamari.Tests/Fixtures/PackageDownload/NuGetFeedSupportFixture.cs b/source/Calamari.Tests/Fixtures/PackageDownload/NuGetFeedSupportFixture.cs index 1a41aadaaf..85d129b0f4 100644 --- a/source/Calamari.Tests/Fixtures/PackageDownload/NuGetFeedSupportFixture.cs +++ b/source/Calamari.Tests/Fixtures/PackageDownload/NuGetFeedSupportFixture.cs @@ -13,7 +13,7 @@ namespace Calamari.Tests.Fixtures.PackageDownload { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class NuGetFeedVersionSupportFixture : CalamariFixture { diff --git a/source/Calamari.Tests/Fixtures/PackageDownload/PackageDownloadFixture.cs b/source/Calamari.Tests/Fixtures/PackageDownload/PackageDownloadFixture.cs index 31a1cb6a16..37402ed17c 100644 --- a/source/Calamari.Tests/Fixtures/PackageDownload/PackageDownloadFixture.cs +++ b/source/Calamari.Tests/Fixtures/PackageDownload/PackageDownloadFixture.cs @@ -88,7 +88,6 @@ public void ShouldDownloadPackage() } [Test] - [RequiresNonFreeBSDPlatform] public void ShouldDownloadMavenPackage() { var result = DownloadPackage( @@ -151,7 +150,6 @@ public void ShouldUsePackageFromCache() } [Test] - [RequiresNonFreeBSDPlatform] public void ShouldUseMavenPackageFromCache() { DownloadPackage(MavenPublicFeed.PackageId, @@ -179,7 +177,6 @@ public void ShouldUseMavenPackageFromCache() } [Test] - [RequiresNonFreeBSDPlatform] public void ShouldUseMavenSnapshotPackageFromCache() { DownloadPackage(MavenPublicFeed.PackageId, @@ -228,7 +225,6 @@ public void ShouldByPassCacheAndDownloadPackage() } [Test] - [RequiresNonFreeBSDPlatform] public void ShouldByPassCacheAndDownloadMavenPackage() { var firstDownload = DownloadPackage( diff --git a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreOnWindowsFixture.cs b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreOnWindowsFixture.cs index 67f6e3028d..2682430933 100644 --- a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreOnWindowsFixture.cs +++ b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreOnWindowsFixture.cs @@ -15,7 +15,7 @@ namespace Calamari.Tests.Fixtures.PowerShell { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class PowerShellCoreOnWindowsFixture : PowerShellFixtureBase { protected override PowerShellEdition PowerShellEdition => PowerShellEdition.Core; diff --git a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreProxyFixture.cs b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreWindowsScriptProxyFixture.cs similarity index 81% rename from source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreProxyFixture.cs rename to source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreWindowsScriptProxyFixture.cs index 8db4e4cba7..b33f8cfebd 100644 --- a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreProxyFixture.cs +++ b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellCoreWindowsScriptProxyFixture.cs @@ -1,16 +1,14 @@ using System.Collections.Generic; using Calamari.Common.Plumbing.Variables; -using Calamari.Deployment; using Calamari.Testing.Helpers; using Calamari.Tests.Fixtures.Integration.Proxies; -using Calamari.Tests.Helpers; using NUnit.Framework; namespace Calamari.Tests.Fixtures.PowerShell { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] - public class PowerShellCoreProxyFixture : WindowsScriptProxyFixtureBase + [TestPlatforms(TestPlatforms.Windows)] + public class PowerShellCoreWindowsScriptProxyFixture : WindowsScriptProxyFixtureBase { [SetUp] public void Setup() diff --git a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellOnLinuxOrMacFixture.cs b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellOnLinuxOrMacFixture.cs index f4bc8e0bd7..e5f8316a19 100644 --- a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellOnLinuxOrMacFixture.cs +++ b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellOnLinuxOrMacFixture.cs @@ -13,7 +13,7 @@ namespace Calamari.Tests.Fixtures.PowerShell { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public class PowerShellOnLinuxOrMacFixture : PowerShellFixtureBase { [SetUp] diff --git a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellProxyFixture.cs b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellProxyFixture.cs index f95757f7be..52362fe9ff 100644 --- a/source/Calamari.Tests/Fixtures/PowerShell/PowerShellProxyFixture.cs +++ b/source/Calamari.Tests/Fixtures/PowerShell/PowerShellProxyFixture.cs @@ -5,7 +5,7 @@ namespace Calamari.Tests.Fixtures.PowerShell { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class PowerShellProxyFixture : WindowsScriptProxyFixtureBase { protected override CalamariResult RunScript() diff --git a/source/Calamari.Tests/Fixtures/PowerShell/WindowsPowerShellFixture.cs b/source/Calamari.Tests/Fixtures/PowerShell/WindowsPowerShellFixture.cs index 6c9b1b8d12..0a2f6d8106 100644 --- a/source/Calamari.Tests/Fixtures/PowerShell/WindowsPowerShellFixture.cs +++ b/source/Calamari.Tests/Fixtures/PowerShell/WindowsPowerShellFixture.cs @@ -10,7 +10,7 @@ namespace Calamari.Tests.Fixtures.PowerShell { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class WindowsPowerShellFixture : PowerShellFixtureBase { protected override PowerShellEdition PowerShellEdition => PowerShellEdition.Desktop; diff --git a/source/Calamari.Tests/Fixtures/Python/PythonFixture.cs b/source/Calamari.Tests/Fixtures/Python/PythonFixture.cs index 6b879230df..6a0197f10a 100644 --- a/source/Calamari.Tests/Fixtures/Python/PythonFixture.cs +++ b/source/Calamari.Tests/Fixtures/Python/PythonFixture.cs @@ -63,7 +63,7 @@ public void ShouldSetVariables() } [Test, RequiresMinimumPython3Version(4)] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldWriteServiceMessageForArtifactsOnWindows() { var (output, _) = RunScript("createartifactwin.py"); @@ -72,7 +72,7 @@ public void ShouldWriteServiceMessageForArtifactsOnWindows() } [Test, RequiresMinimumPython3Version(4)] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void ShouldWriteServiceMessageForArtifactsOnNix() { var (output, _) = RunScript("createartifactnix.py"); diff --git a/source/Calamari.Tests/Fixtures/Util/CrossPlatformFixture.cs b/source/Calamari.Tests/Fixtures/Util/CrossPlatformFixture.cs index 71e0a5fc97..b72390aee7 100644 --- a/source/Calamari.Tests/Fixtures/Util/CrossPlatformFixture.cs +++ b/source/Calamari.Tests/Fixtures/Util/CrossPlatformFixture.cs @@ -27,7 +27,7 @@ public void ClearEnvironmentVariable() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void TildePrefixReplacedWithHome() { // This usage of Environment.GetEnvironmentVariable is fine as it's not accessing a test dependency variable @@ -50,7 +50,7 @@ public void TildePrefixReplacedWithHome() [TestCase("%MARIO_BROTHER%/blah%20blah.zip", "LUIGI/blah%20blah.zip", Description = "Windows-style variable (%VAR%) is expanded, and URL-encoded space (%20) in filename is preserved")] [TestCase("$MARIO_BROTHER/blah%2520blah.zip", "LUIGI/blah%2520blah.zip", Description = "Linux-style variable ($VAR) is expanded, but URL-encoded space encoded twice (%2520) in filename is preserved")] [TestCase("%MARIO_BROTHER%/blah%2520blah.zip", "LUIGI/blah%2520blah.zip", Description = "Windows-style variable (%VAR%) is expanded, and URL-encoded space encoded twice (%2520) in filename is preserved")] - [Category(TestCategory.CompatibleOS.OnlyNixOrMac)] + [TestPlatforms(TestPlatforms.Unix)] public void NixEnvironmentVariableReplaced(string inputValue, string expectedResult) { var value = CrossPlatform.ExpandPathEnvironmentVariables(inputValue); @@ -60,7 +60,7 @@ public void NixEnvironmentVariableReplaced(string inputValue, string expectedRes [Test] [TestCase("$MARIO_BROTHER/blah", "$MARIO_BROTHER/blah", Description = "Nix variable format ignored")] [TestCase("IMA%MARIO_BROTHER%PLUMBER", "IMALUIGIPLUMBER", Description = "Variables demarcated by percent character")] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void WindowsEnvironmentVariableReplaced(string inputValue, string expectedResult) { var value = CrossPlatform.ExpandPathEnvironmentVariables(inputValue); diff --git a/source/Calamari.Tests/Fixtures/Util/StringExtensionsFixture.cs b/source/Calamari.Tests/Fixtures/Util/StringExtensionsFixture.cs index ef72f9a9c1..e907b879c2 100644 --- a/source/Calamari.Tests/Fixtures/Util/StringExtensionsFixture.cs +++ b/source/Calamari.Tests/Fixtures/Util/StringExtensionsFixture.cs @@ -38,7 +38,7 @@ public void NullValueShouldThrowException() [TestCase(@"C:/Path/To/File4.txt", @"C:/Path", @"To/File4.txt")] [TestCase(@"C:/Path/To/File5 With Spaces.txt", @"C:/Path", @"To/File5 With Spaces.txt")] [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void AsRelativePathFrom(string source, string baseDirectory, string expected) { Assert.AreEqual(expected, source.AsRelativePathFrom(baseDirectory)); diff --git a/source/Calamari.Tests/Fixtures/Variables/ContributeEnvironmentVariablesFixture.cs b/source/Calamari.Tests/Fixtures/Variables/ContributeEnvironmentVariablesFixture.cs index e08aae8616..827eb5063a 100644 --- a/source/Calamari.Tests/Fixtures/Variables/ContributeEnvironmentVariablesFixture.cs +++ b/source/Calamari.Tests/Fixtures/Variables/ContributeEnvironmentVariablesFixture.cs @@ -14,7 +14,7 @@ namespace Calamari.Tests.Fixtures.Variables public class ContributeEnvironmentVariablesFixture { [Test] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public void ShouldAddWindowsEnvironmentVariables() { if (!CalamariEnvironment.IsRunningOnWindows) @@ -25,7 +25,7 @@ public void ShouldAddWindowsEnvironmentVariables() } [Test] - [Category(TestCategory.CompatibleOS.OnlyNix)] + [TestPlatforms(TestPlatforms.Linux)] public void ShouldAddLinuxEnvironmentVariables() { if (!CalamariEnvironment.IsRunningOnNix) @@ -36,7 +36,7 @@ public void ShouldAddLinuxEnvironmentVariables() } [Test] - [Category(TestCategory.CompatibleOS.OnlyMac)] + [TestPlatforms(TestPlatforms.MacOs)] public void ShouldAddMacEnvironmentVariables() { // Mac running in TeamCity agent service does not contain $HOME variable diff --git a/source/Calamari.Tests/GlobalUsings.cs b/source/Calamari.Tests/GlobalUsings.cs new file mode 100644 index 0000000000..ea22ed25f6 --- /dev/null +++ b/source/Calamari.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Calamari.Testing; \ No newline at end of file diff --git a/source/Calamari.Tests/KubernetesFixtures/Helm3UpgradeFixture.cs b/source/Calamari.Tests/KubernetesFixtures/Helm3UpgradeFixture.cs index a6e2130ab5..6efda96e61 100644 --- a/source/Calamari.Tests/KubernetesFixtures/Helm3UpgradeFixture.cs +++ b/source/Calamari.Tests/KubernetesFixtures/Helm3UpgradeFixture.cs @@ -14,9 +14,6 @@ namespace Calamari.Tests.KubernetesFixtures public class Helm3UpgradeFixture : HelmUpgradeFixture { [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void Upgrade_Succeeds() { var result = DeployPackage(); @@ -31,18 +28,12 @@ public void Upgrade_Succeeds() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public async Task CustomHelmExeInPackage_RelativePath() { await TestCustomHelmExeInPackage_RelativePath("3.0.1"); } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void HelmVersionNewerThanMinimumVersion_ReportsObjectStatus() { Variables.AddFlag(SpecialVariables.ResourceStatusCheck, true); @@ -76,9 +67,6 @@ public void HelmVersionNewerThanMinimumVersion_ReportsObjectStatus() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public async Task HelmVersionOlderThanMinimumVersion_DoesNotRunObjectStatus() { //minimum version is helm 3.13 @@ -106,9 +94,6 @@ public async Task HelmVersionOlderThanMinimumVersion_DoesNotRunObjectStatus() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void HooksOnlyPackage_RetrievesEmptyManifestButDoesNotReportObjectStatus() { Variables.AddFlag(SpecialVariables.ResourceStatusCheck, true); @@ -134,9 +119,6 @@ public void HooksOnlyPackage_RetrievesEmptyManifestButDoesNotReportObjectStatus( } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void EmptyChart_RetrievesEmptyManifestButDoesNotReportObjectStatus() { Variables.AddFlag(SpecialVariables.ResourceStatusCheck, true); @@ -162,10 +144,6 @@ public void EmptyChart_RetrievesEmptyManifestButDoesNotReportObjectStatus() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [RequiresNonMac] - [Category(TestCategory.PlatformAgnostic)] public void TargetingANamespaceThatDoesNotExistAbortsTheManifestSearchingLoop() { Variables.AddFlag(SpecialVariables.ResourceStatusCheck, true); diff --git a/source/Calamari.Tests/KubernetesFixtures/HelmInstalledVersionUpgradeFixture.cs b/source/Calamari.Tests/KubernetesFixtures/HelmInstalledVersionUpgradeFixture.cs index fa0cd8aaf4..b8fa79b7e5 100644 --- a/source/Calamari.Tests/KubernetesFixtures/HelmInstalledVersionUpgradeFixture.cs +++ b/source/Calamari.Tests/KubernetesFixtures/HelmInstalledVersionUpgradeFixture.cs @@ -1,5 +1,3 @@ -using Calamari.Testing.Helpers; -using Calamari.Testing.Requirements; using NUnit.Framework; namespace Calamari.Tests.KubernetesFixtures @@ -8,10 +6,6 @@ namespace Calamari.Tests.KubernetesFixtures public class HelmInstalledVersionUpgradeFixture : HelmUpgradeFixture { [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [RequiresNonMac] - [Category(TestCategory.PlatformAgnostic)] public void Upgrade_Succeeds() { var result = DeployPackage(); diff --git a/source/Calamari.Tests/KubernetesFixtures/HelmUpgradeFixture.cs b/source/Calamari.Tests/KubernetesFixtures/HelmUpgradeFixture.cs index 9e5252673b..1694794fb7 100644 --- a/source/Calamari.Tests/KubernetesFixtures/HelmUpgradeFixture.cs +++ b/source/Calamari.Tests/KubernetesFixtures/HelmUpgradeFixture.cs @@ -136,9 +136,6 @@ public virtual void SetUp() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void NoValues_EmbeddedValuesUsed() { var result = DeployPackage(); @@ -149,9 +146,6 @@ public void NoValues_EmbeddedValuesUsed() } [Test(Description = "Test the case where the package ID does not match the directory inside the helm archive.")] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void MismatchPackageIDAndHelmArchivePathWorks() { var packageName = $"{Variables.Get(PackageVariables.PackageId)}-{Variables.Get(PackageVariables.PackageVersion)}.tgz"; @@ -166,9 +160,6 @@ public void MismatchPackageIDAndHelmArchivePathWorks() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ExplicitValues_NewValuesUsed() { //Helm Config @@ -180,9 +171,6 @@ public void ExplicitValues_NewValuesUsed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromPackage_NewValuesUsed() { //Additional Package @@ -200,9 +188,6 @@ public void ValuesFromPackage_NewValuesUsed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromChartPackage_NewValuesUsed() { //Additional Package @@ -214,9 +199,6 @@ public void ValuesFromChartPackage_NewValuesUsed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromChartPackage_GetSubstituted() { Variables.Set(PackageVariables.PackageVersion, "0.3.8"); @@ -228,9 +210,6 @@ public void ValuesFromChartPackage_GetSubstituted() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromChartPackageWithoutSubDirectory_NewValuesUsed() { //Additional Package @@ -242,9 +221,6 @@ public void ValuesFromChartPackageWithoutSubDirectory_NewValuesUsed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromPackageAndExplicit_ExplicitTakesPrecedence() { //Helm Config (lets make sure Explicit values take precedence @@ -266,9 +242,6 @@ public void ValuesFromPackageAndExplicit_ExplicitTakesPrecedence() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void ValuesFromRawYaml_ValuesAdded() { Variables.Set(Kubernetes.SpecialVariables.Helm.YamlValues, "\"SpecialMessage\": \"YAML\""); @@ -286,7 +259,7 @@ protected async Task TestCustomHelmExeInPackage_RelativePath(string version) var result = DeployPackage(); result.AssertSuccess(); - result.AssertOutput($"Using custom helm executable at {HelmOsPlatform}\\helm from inside package. Full path at"); + result.AssertOutput($"Using custom helm executable at {HelmOsPlatform}{Path.DirectorySeparatorChar}helm from inside package. Full path at"); } } @@ -311,9 +284,6 @@ protected async Task UseCustomHelmExeInPackage(string version) } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void Namespace_Override_Used() { const string @namespace = "calamari-testing-foo"; @@ -326,9 +296,6 @@ public void Namespace_Override_Used() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void AdditionalArgumentsPassed() { Variables.Set(Kubernetes.SpecialVariables.Helm.AdditionalArguments, "--dry-run"); @@ -340,9 +307,6 @@ public void AdditionalArgumentsPassed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void DoesNotReportManifestsWhenDryRunIsSet() { Variables.Set(Kubernetes.SpecialVariables.Helm.AdditionalArguments, "--dry-run"); @@ -356,10 +320,6 @@ public void DoesNotReportManifestsWhenDryRunIsSet() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [RequiresNonMac] - [Category(TestCategory.PlatformAgnostic)] public void WhenTheChartDirectoryVariableIsSet_TheChartAtThatLocationIsUsed() { Variables.Set(Kubernetes.SpecialVariables.Helm.ChartDirectory, "specific/location/for/my/chart"); @@ -368,9 +328,6 @@ public void WhenTheChartDirectoryVariableIsSet_TheChartAtThatLocationIsUsed() } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void WhenTheChartDirectoryVariableIsSet_AndTheChartDoesNotExist_AnErrorIsReturned() { Variables.Set(Kubernetes.SpecialVariables.Helm.ChartDirectory, "specific/location/for/my/chart"); @@ -380,9 +337,6 @@ public void WhenTheChartDirectoryVariableIsSet_AndTheChartDoesNotExist_AnErrorIs } [Test] - [RequiresNonFreeBSDPlatform] - [RequiresNon32BitWindows] - [Category(TestCategory.PlatformAgnostic)] public void WhenChartIsInRootOfPackage_ShouldUseTheRootStagingDirectory() { var result = DeployPackage("mychart-with-no-root-folder-0.3.8.tgz"); diff --git a/source/Calamari.Tests/KubernetesFixtures/Integration/HelmCliTests.cs b/source/Calamari.Tests/KubernetesFixtures/Integration/HelmCliTests.cs index 941a549af2..f5db415114 100644 --- a/source/Calamari.Tests/KubernetesFixtures/Integration/HelmCliTests.cs +++ b/source/Calamari.Tests/KubernetesFixtures/Integration/HelmCliTests.cs @@ -57,7 +57,7 @@ public void UsesCustomHelmExecutable() } [Test] - [NonWindowsTest] + [TestPlatforms(TestPlatforms.Unix)] public void ChmodsCustomHelmExecutableWhenNotOnWindows() { const string expectedExecutable = "my-custom-exe"; diff --git a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperFixture.cs b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperFixture.cs index 982832ae65..3cdf6b1b05 100644 --- a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperFixture.cs +++ b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperFixture.cs @@ -230,7 +230,7 @@ public void ExecutionWithUsernamePassword() } [Test] - [WindowsTest] // This test requires the aws cli tools. Currently only configured to install on Linux & Windows + [TestPlatforms(TestPlatforms.Windows)] // This test requires the aws cli tools. Currently only configured to install on Windows public async Task ExecutionWithEKS_IAMAuthenticator() { await InstallTools(InstallAwsCli); @@ -249,7 +249,7 @@ public async Task ExecutionWithEKS_IAMAuthenticator() } [Test] - [WindowsTest] // This test requires the aws cli tools. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] // This test requires the aws cli tools. Currently only configured to install on Windows public async Task ExecutionWithEKS_AwsCLIAuthenticator() { await InstallTools(InstallAwsCli); @@ -270,7 +270,7 @@ public async Task ExecutionWithEKS_AwsCLIAuthenticator() } [Test] - [WindowsTest] // This test requires the aws cli tools. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] // This test requires the aws cli tools. Currently only configured to install on Windows public async Task ExecutionWithEKS_AwsCLIAuthenticator_WithExecFeatureToggleEnabled() { await InstallTools(InstallAwsCli); @@ -301,7 +301,7 @@ public async Task ExecutionWithEKS_AwsCLIAuthenticator_WithExecFeatureToggleEnab } [Test] - [WindowsTest] // This test requires the GKE GCloud Auth plugin. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] // This test requires the GKE GCloud Auth plugin. Currently only configured to install on Windows public async Task ExecutionWithGoogleCloudAccount_WhenZoneIsProvided() { await InstallTools(InstallGCloud); @@ -319,7 +319,7 @@ public async Task ExecutionWithGoogleCloudAccount_WhenZoneIsProvided() } [Test] - [WindowsTest] // This test requires the GKE GCloud Auth plugin. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] public async Task ExecutionWithGoogleCloudAccount_WhenRegionIsProvided() { await InstallTools(InstallGCloud); @@ -337,7 +337,7 @@ public async Task ExecutionWithGoogleCloudAccount_WhenRegionIsProvided() } [Test] - [WindowsTest] // This test requires the GKE GCloud Auth plugin. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] public async Task ExecutionWithGoogleCloudAccount_WhenBothZoneAndRegionAreProvided() { await InstallTools(InstallGCloud); @@ -356,7 +356,7 @@ public async Task ExecutionWithGoogleCloudAccount_WhenBothZoneAndRegionAreProvid } [Test] - [WindowsTest] // This test requires the GKE GCloud Auth plugin. Currently only configured to install on Windows + [TestPlatforms(TestPlatforms.Windows)] public async Task ExecutionWithGoogleCloudAccount_WhenNeitherZoneOrRegionAreProvided() { variables.Set(Deployment.SpecialVariables.Account.AccountType, "GoogleCloudAccount"); diff --git a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAks.cs b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAks.cs index a6e8c625da..589dfc8e80 100644 --- a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAks.cs +++ b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAks.cs @@ -19,7 +19,6 @@ namespace Calamari.Tests.KubernetesFixtures { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class KubernetesContextScriptWrapperLiveFixtureAks : KubernetesContextScriptWrapperLiveFixture { string aksClusterHost; diff --git a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAksLocalAccessDisabled.cs b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAksLocalAccessDisabled.cs index dd69ce5186..372188d86b 100644 --- a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAksLocalAccessDisabled.cs +++ b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureAksLocalAccessDisabled.cs @@ -17,7 +17,6 @@ namespace Calamari.Tests.KubernetesFixtures { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class KubernetesContextScriptWrapperLiveFixtureAksLocalAccessDisabled : KubernetesContextScriptWrapperLiveFixture { string aksClusterName; diff --git a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureEks.cs b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureEks.cs index a7b5faf4d0..7a20b4e9ec 100644 --- a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureEks.cs +++ b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureEks.cs @@ -30,7 +30,6 @@ namespace Calamari.Tests.KubernetesFixtures { [TestFixture] - [Category(TestCategory.RunOnceOnWindowsAndLinux)] public class KubernetesContextScriptWrapperLiveFixtureEks: KubernetesContextScriptWrapperLiveFixture { private const string ResourcePackageFileName = "package.1.0.0.zip"; @@ -291,7 +290,6 @@ public void AuthorisingWithAmazonAccount(bool runAsScript) [Test] [TestCase(true)] [TestCase(false)] - [WindowsTest] // We are having an issue with this test running on Linux. The test successfully executes on Windows. public void AuthorisingWithAmazonAccount_WithExecFeatureToggleEnabled(bool runAsScript) { SetVariablesToAuthoriseWithAmazonAccount(); diff --git a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureGke.cs b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureGke.cs index 134d30baf9..dc444862cc 100644 --- a/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureGke.cs +++ b/source/Calamari.Tests/KubernetesFixtures/KubernetesContextScriptWrapperLiveFixtureGke.cs @@ -12,7 +12,7 @@ namespace Calamari.Tests.KubernetesFixtures { [TestFixture] - [Category(TestCategory.CompatibleOS.OnlyWindows)] + [TestPlatforms(TestPlatforms.Windows)] public class KubernetesContextScriptWrapperLiveFixtureGke : KubernetesContextScriptWrapperLiveFixture { string gkeToken; diff --git a/source/Calamari.Tests/NewPipeline/PipelineCommandFixture.cs b/source/Calamari.Tests/NewPipeline/PipelineCommandFixture.cs index 46f936b1d8..44c2804981 100644 --- a/source/Calamari.Tests/NewPipeline/PipelineCommandFixture.cs +++ b/source/Calamari.Tests/NewPipeline/PipelineCommandFixture.cs @@ -22,8 +22,6 @@ namespace Calamari.Tests.NewPipeline { [TestFixture] - [RequiresNonFreeBSDPlatform] - [Category(TestCategory.PlatformAgnostic)] public class PipelineCommandFixture { readonly string[] defaultScriptStages = { DeploymentStages.PreDeploy, DeploymentStages.Deploy, DeploymentStages.PostDeploy };