Skip to content

Commit

Permalink
Add RequiresAdminOnWindows Attribute, and dont make test users (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeButters authored Feb 5, 2024
1 parent 18975d0 commit fb134bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Octopus.Tentacle.Tests.Integration.Startup
public class WindowsServiceConfiguratorFixture
{
[Test]
[RequiresAdminOnWindows]
public void CanInstallWindowsService()
{
const string serviceName = "OctopusShared.ServiceHelperTest";
Expand Down Expand Up @@ -70,6 +71,7 @@ public void CanInstallWindowsService()
}

[Test]
[RequiresAdminOnWindows]
public void ThrowsOnBadServiceDependency()
{
const string serviceName = "OctopusShared.ServiceHelperTest";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;
using NUnit.Framework;

namespace Octopus.Tentacle.Tests.Integration.Support.TestAttributes
{
[AttributeUsage(AttributeTargets.Method)]
public class RequiresAdminOnWindowsAttribute : CategoryAttribute
{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class RunningScriptFixture : IntegrationTest
IScriptWorkspace workspace;
TestScriptLog scriptLog;
RunningScript runningScript;
TestUserPrincipal user;

[SetUp]
public void SetUpLocal()
Expand All @@ -39,7 +38,6 @@ public void SetUpLocal()
{
testRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), $"OctopusTest-{nameof(RunningScriptFixture)}");
shell = new PowerShell();
user = new TestUserPrincipal("test-runningscript");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class SilentProcessRunnerFixture : IntegrationTest
{
const int SIG_TERM = 143;
const int SIG_KILL = 137;
TestUserPrincipal user;
string command;
string commandParam;

Expand All @@ -23,7 +22,6 @@ public void SetUpLocal()
{
if (PlatformDetection.IsRunningOnWindows)
{
user = new TestUserPrincipal("test-silentprocess");
command = "cmd.exe";
commandParam = "/c";
}
Expand Down

0 comments on commit fb134bb

Please sign in to comment.