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
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ await response.Content.ReadAsStringAsync(),

[OuterLoop("Uses external servers")]
[ConditionalFact(nameof(IsSocketsHttpHandlerAndRemoteExecutorSupported))]
public void Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy()
public async Task Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy()
{
RemoteExecutor.Invoke(async (useVersionString) =>
await RemoteExecutor.Invoke(async (useVersionString) =>
{
var options = new LoopbackProxyServer.Options { AddViaRequestHeader = true };
using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create(options))
Expand All @@ -134,7 +134,7 @@ public void Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy()
Assert.Contains(proxyServer.ViaHeader, body);
}
}
}, UseVersion.ToString()).Dispose();
}, UseVersion.ToString()).DisposeAsync();
}

const string BasicAuth = "Basic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class HttpClientAuthenticationTest
[InlineData(EnterpriseTestConfiguration.DigestAuthWebServer, true)]
[InlineData(EnterpriseTestConfiguration.DigestAuthWebServer, false)]
[InlineData(EnterpriseTestConfiguration.NtlmAuthWebServer, true)]
public void HttpClient_ValidAuthentication_Success(string url, bool useDomain, bool useAltPort = false)
public async Task HttpClient_ValidAuthentication_Success(string url, bool useDomain, bool useAltPort = false)
{
RemoteExecutor.Invoke((url, useAltPort, useDomain) =>
await RemoteExecutor.Invoke((url, useAltPort, useDomain) =>
{
// This is safe as we have no parallel tests
if (!string.IsNullOrEmpty(useAltPort))
Expand All @@ -35,7 +35,7 @@ public void HttpClient_ValidAuthentication_Success(string url, bool useDomain, b

using HttpResponseMessage response = client.GetAsync(url).GetAwaiter().GetResult();
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}, url, useAltPort ? "true" : "" , useDomain ? "true" : "").Dispose();
}, url, useAltPort ? "true" : "" , useDomain ? "true" : "").DisposeAsync();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@

<Compile Include="$(CommonTestPath)System\Net\EnterpriseTests\EnterpriseTestConfiguration.cs"
Link="Common\System\Net\EnterpriseTests\EnterpriseTestConfiguration.cs" />
<Compile Include="$(CommonTestPath)System\Net\RemoteExecutorExtensions.cs"
Link="Common\System\Net\RemoteExecutorExtensions.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,9 @@ public static IEnumerable<object[]> UseSocketsHttpHandler_WithIdFormat_MemberDat
[InlineData("fAlSe")]
[InlineData("helloworld")]
[InlineData("")]
public void SendAsync_SuppressedGlobalStaticPropagationEnvVar(string envVarValue)
public async Task SendAsync_SuppressedGlobalStaticPropagationEnvVar(string envVarValue)
{
RemoteExecutor.Invoke(async (useVersion, testAsync, envVarValue) =>
await RemoteExecutor.Invoke(async (useVersion, testAsync, envVarValue) =>
{
Environment.SetEnvironmentVariable(EnableActivityPropagationEnvironmentVariableSettingName, envVarValue);

Expand Down Expand Up @@ -1283,7 +1283,7 @@ await GetFactoryForVersion(useVersion).CreateClientAndServerAsync(

Assert.Equal(isInstrumentationEnabled, anyEventLogged);
}
}, UseVersion.ToString(), TestAsync.ToString(), envVarValue).Dispose();
}, UseVersion.ToString(), TestAsync.ToString(), envVarValue).DisposeAsync();
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1405,9 +1405,9 @@ await test.LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
public static bool RemoteExecutorAndSocketsHttpHandlerSupported => RemoteExecutor.IsSupported && SocketsHttpHandler.IsSupported;

[ConditionalFact(nameof(RemoteExecutorAndSocketsHttpHandlerSupported))]
public void AllSocketsHttpHandlerCounters_Success_Recorded()
public async Task AllSocketsHttpHandlerCounters_Success_Recorded()
{
RemoteExecutor.Invoke(static async Task () =>
await RemoteExecutor.Invoke(static async Task () =>
{
TaskCompletionSource clientWaitingTcs = new(TaskCreationOptions.RunContinuationsAsynchronously);

Expand Down Expand Up @@ -1453,7 +1453,7 @@ await server.AcceptConnectionAsync(async connection =>
await connection.WaitForCloseAsync(CancellationToken.None);
});
});
}).Dispose();
}).DisposeAsync();
}

[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,14 +996,14 @@ await GetFactoryForVersion(version).CreateServerAsync((originalServer, originalU
[ConditionalTheory(nameof(SupportsRemoteExecutorAndAlpn))]
[InlineData(false)]
[InlineData(true)]
public void EventSource_Proxy_LogsIPAddress(bool useSsl)
public async Task EventSource_Proxy_LogsIPAddress(bool useSsl)
{
if (UseVersion.Major == 3)
{
return;
}

RemoteExecutor.Invoke(static async (string useVersionString, string useSslString) =>
await RemoteExecutor.Invoke(static async (string useVersionString, string useSslString) =>
{
using var listener = new TestEventListener("System.Net.Http", EventLevel.Verbose, eventCounterInterval: 0.1d);
listener.AddActivityTracking();
Expand Down Expand Up @@ -1038,7 +1038,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
ip.Equals(IPAddress.Loopback) ||
ip.Equals(IPAddress.IPv6Loopback));
}
}, UseVersion.ToString(), useSsl.ToString()).Dispose();
}, UseVersion.ToString(), useSsl.ToString()).DisposeAsync();
}

protected static async Task WaitForEventCountersAsync(ConcurrentQueue<(EventWrittenEventArgs Event, Guid ActivityId)> events)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Threading.Tasks;
using Microsoft.DotNet.RemoteExecutor;
using Xunit;

Expand All @@ -13,7 +14,7 @@ public class RuntimeSettingParserTest
[ConditionalTheory(nameof(SupportsRemoteExecutor))]
[InlineData(false)]
[InlineData(true)]
public void QueryRuntimeSettingSwitch_WhenNotSet_DefaultIsUsed(bool defaultValue)
public async Task QueryRuntimeSettingSwitch_WhenNotSet_DefaultIsUsed(bool defaultValue)
{
static void RunTest(string defaultValueStr)
{
Expand All @@ -22,11 +23,11 @@ static void RunTest(string defaultValueStr)
Assert.Equal(expected, actual);
}

RemoteExecutor.Invoke(RunTest, defaultValue.ToString()).Dispose();
await RemoteExecutor.Invoke(RunTest, defaultValue.ToString()).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingSwitch_AppContextHasPriority()
public async Task QueryRuntimeSettingSwitch_AppContextHasPriority()
{
static void RunTest()
{
Expand All @@ -37,11 +38,11 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "true";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingSwitch_EnvironmentVariable()
public async Task QueryRuntimeSettingSwitch_EnvironmentVariable()
{
static void RunTest()
{
Expand All @@ -51,11 +52,11 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "false";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingSwitch_InvalidValue_FallbackToDefault()
public async Task QueryRuntimeSettingSwitch_InvalidValue_FallbackToDefault()
{
static void RunTest()
{
Expand All @@ -65,13 +66,13 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "cheese";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalTheory(nameof(SupportsRemoteExecutor))]
[InlineData(0)]
[InlineData(42)]
public void QueryRuntimeSettingInt32_WhenNotSet_DefaultIsUsed(int defaultValue)
public async Task QueryRuntimeSettingInt32_WhenNotSet_DefaultIsUsed(int defaultValue)
{
static void RunTest(string defaultValueStr)
{
Expand All @@ -80,11 +81,11 @@ static void RunTest(string defaultValueStr)
Assert.Equal(expected, actual);
}

RemoteExecutor.Invoke(RunTest, defaultValue.ToString()).Dispose();
await RemoteExecutor.Invoke(RunTest, defaultValue.ToString()).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingInt32_AppContextHasPriority()
public async Task QueryRuntimeSettingInt32_AppContextHasPriority()
{
static void RunTest()
{
Expand All @@ -95,11 +96,11 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "3";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingInt32_EnvironmentVariable()
public async Task QueryRuntimeSettingInt32_EnvironmentVariable()
{
static void RunTest()
{
Expand All @@ -109,12 +110,12 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "1";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}


[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void QueryRuntimeSettingInt32_InvalidValue_FallbackToDefault()
public async Task QueryRuntimeSettingInt32_InvalidValue_FallbackToDefault()
{
static void RunTest()
{
Expand All @@ -124,22 +125,22 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "cheese";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseInt32EnvironmentVariableValue_WhenNotSet_DefaultIsUsed()
public async Task ParseInt32EnvironmentVariableValue_WhenNotSet_DefaultIsUsed()
{
static void RunTest()
{
int actual = RuntimeSettingParser.ParseInt32EnvironmentVariableValue("FOO_BAR", -42);
Assert.Equal(-42, actual);
}
RemoteExecutor.Invoke(RunTest).Dispose();
await RemoteExecutor.Invoke(RunTest).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseInt32EnvironmentVariableValue_ValidValue()
public async Task ParseInt32EnvironmentVariableValue_ValidValue()
{
static void RunTest()
{
Expand All @@ -150,11 +151,11 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "84";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseInt32EnvironmentVariableValue_InvalidValue_FallbackToDefault()
public async Task ParseInt32EnvironmentVariableValue_InvalidValue_FallbackToDefault()
{
static void RunTest()
{
Expand All @@ -165,22 +166,22 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "-~4!";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseDoubleEnvironmentVariableValue_WhenNotSet_DefaultIsUsed()
public async Task ParseDoubleEnvironmentVariableValue_WhenNotSet_DefaultIsUsed()
{
static void RunTest()
{
double actual = RuntimeSettingParser.ParseDoubleEnvironmentVariableValue("FOO_BAR", -0.42);
Assert.Equal(-0.42, actual);
}
RemoteExecutor.Invoke(RunTest).Dispose();
await RemoteExecutor.Invoke(RunTest).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseDoubleEnvironmentVariableValue_ValidValue()
public async Task ParseDoubleEnvironmentVariableValue_ValidValue()
{
static void RunTest()
{
Expand All @@ -191,11 +192,11 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "0.84";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}

[ConditionalFact(nameof(SupportsRemoteExecutor))]
public void ParseDoubleEnvironmentVariableValue_InvalidValue_FallbackToDefault()
public async Task ParseDoubleEnvironmentVariableValue_InvalidValue_FallbackToDefault()
{
static void RunTest()
{
Expand All @@ -206,7 +207,7 @@ static void RunTest()
RemoteInvokeOptions options = new RemoteInvokeOptions();
options.StartInfo.EnvironmentVariables["FOO_BAR"] = "-~4!";

RemoteExecutor.Invoke(RunTest, options).Dispose();
await RemoteExecutor.Invoke(RunTest, options).DisposeAsync();
}
}
}
Loading