Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions test/IntegrationTests/AspNetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum AppPoolMode

private ITestOutputHelper Output { get; } = output;

[Theory]
[WindowsAdministratorTheory]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
[InlineData(AppPoolMode.Classic, Gac.UseGac)]
Expand All @@ -59,8 +59,6 @@ public enum AppPoolMode
[InlineData(AppPoolMode.Integrated, Gac.UseLocal)]
public async Task SubmitsTraces(AppPoolMode appPoolMode, Gac useGac)
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand All @@ -86,7 +84,7 @@ public async Task SubmitsTraces(AppPoolMode appPoolMode, Gac useGac)
collector.AssertExpectations();
}

[Theory]
[WindowsAdministratorTheory]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
[InlineData(AppPoolMode.Classic, Gac.UseGac)]
Expand All @@ -95,8 +93,6 @@ public async Task SubmitsTraces(AppPoolMode appPoolMode, Gac useGac)
[InlineData(AppPoolMode.Integrated, Gac.UseLocal)]
public async Task SubmitTracesCapturesHttpHeaders(AppPoolMode appPoolMode, Gac useGac)
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand Down Expand Up @@ -161,13 +157,11 @@ public async Task SubmitTracesCapturesHttpHeaders(AppPoolMode appPoolMode, Gac u
collector.AssertExpectations();
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
public async Task TracesResource()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand Down Expand Up @@ -197,13 +191,11 @@ public async Task TracesResource()
collector.ResourceExpector.AssertExpectations();
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
public async Task SubmitMetrics()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand Down
4 changes: 1 addition & 3 deletions test/IntegrationTests/DomainNeutralTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ public DomainNeutralTests(ITestOutputHelper output)
{
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
public void SubmitsTraces()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

using var collector = new MockSpansCollector(Output);
SetExporter(collector);
collector.Expect("ByteCode.Plugin.StrongNamedValidation");
Expand Down
8 changes: 2 additions & 6 deletions test/IntegrationTests/OwinIISTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ public OwinIISTests(ITestOutputHelper output)

private ITestOutputHelper Output { get; }

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
public async Task SubmitsTraces()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand All @@ -56,13 +54,11 @@ public async Task SubmitsTraces()
collector.AssertExpectations();
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
public async Task SubmitMetrics()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand Down
2 changes: 1 addition & 1 deletion test/IntegrationTests/WcfDotNetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static TheoryData<string, Func<ITestOutputHelper, WcfServerTestHelperBase
}

[Trait("Category", "EndToEnd")]
[Theory]
[WindowsAdministratorTheory]
[MemberData(nameof(TestData))]
public async Task SubmitTraces(string clientPackageVersion, Func<ITestOutputHelper, WcfServerTestHelperBase> wcfServerTestHelperFactory)
{
Expand Down
4 changes: 1 addition & 3 deletions test/IntegrationTests/WcfIISTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public WcfIISTests(ITestOutputHelper output)
{
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Windows")]
public async Task SubmitsTraces()
{
Assert.True(EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");

// Using "*" as host requires Administrator. This is needed to make the mock collector endpoint
// accessible to the Windows docker container where the test application is executed by binding
// the endpoint to all network interfaces. In order to do that it is necessary to open the port
Expand Down
2 changes: 1 addition & 1 deletion test/IntegrationTests/WcfNetFrameworkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public WcfNetFrameworkTests(ITestOutputHelper output)
{
}

[Fact]
[WindowsAdministratorFact]
[Trait("Category", "EndToEnd")]
public async Task SubmitsTraces()
{
Expand Down
1 change: 0 additions & 1 deletion test/IntegrationTests/WcfTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ protected virtual void Dispose(bool disposing)

protected async Task SubmitsTracesInternal(string clientPackageVersion, WcfServerTestHelperBase wcfServerTestHelperBase)
{
Assert.True(!EnvironmentTools.IsWindows() || EnvironmentTools.IsWindowsAdministrator(), "This test requires Windows Administrator privileges.");
#if NET
Assert.NotNull(wcfServerTestHelperBase);
#else
Expand Down
19 changes: 19 additions & 0 deletions test/IntegrationTests/WindowsAdministratorFactAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using IntegrationTests.Helpers;

namespace IntegrationTests;

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class WindowsAdministratorFactAttribute : FactAttribute
{
public WindowsAdministratorFactAttribute()
: base()
{
Skip = GetSkipReason();
}

internal static string? GetSkipReason() =>
!EnvironmentTools.IsWindows() || EnvironmentTools.IsWindowsAdministrator() ? null : "This test requires administrative privileges on Windows.";
}
14 changes: 14 additions & 0 deletions test/IntegrationTests/WindowsAdministratorTheoryAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

namespace IntegrationTests;

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class WindowsAdministratorTheoryAttribute : TheoryAttribute
{
public WindowsAdministratorTheoryAttribute()
: base()
{
Skip = WindowsAdministratorFactAttribute.GetSkipReason();
}
}
Loading