Skip to content

Commit

Permalink
[WASI] disable part of HttpBuildThenRunThenPublish (dotnet#108186)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara authored and sirntar committed Sep 30, 2024
1 parent c20f025 commit fbdf015
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/mono/wasi/testassets/Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public static async Task<int> MainAsync(string[] args)
impatientClient1.Timeout = TimeSpan.FromMilliseconds(10);
try {
await impatientClient1.GetAsync("https://corefx-net-http11.azurewebsites.net/Echo.ashx?delay10sec");
throw new Exception("request should have timed out");
// in reality server side doesn't delay because it doesn't implement it. So 10ms is bit fragile.
// TODO: remove this once we have real WASI HTTP library unit tests with local server loop in Xharness.
// https://github.com/dotnet/xharness/pull/1244

// https://github.com/dotnet/runtime/issues/107530
// TODO throw new Exception("request should have timed out");
} catch (TaskCanceledException) {
Console.WriteLine("1st impatientClient was canceled as expected");
}
Expand All @@ -48,11 +53,9 @@ public static async Task<int> MainAsync(string[] args)
impatientClient2.DefaultRequestHeaders.Add("User-Agent", "dotnet WASI unit test");
var cts = new CancellationTokenSource(10);
try {
// in reality server side doesn't delay because it doesn't implement it. So 10ms is bit fragile.
// TODO: remove this once we have real WASI HTTP library unit tests with local server loop in Xharness.
// https://github.com/dotnet/xharness/pull/1244
await impatientClient2.GetAsync("https://corefx-net-http11.azurewebsites.net/Echo.ashx?delay10sec", cts.Token);
throw new Exception("request should have timed out");
// https://github.com/dotnet/runtime/issues/107530
// TODO throw new Exception("request should have timed out");
} catch (TaskCanceledException tce) {
if (cts.Token != tce.CancellationToken)
{
Expand All @@ -64,7 +67,7 @@ public static async Task<int> MainAsync(string[] args)
using HttpClient client = new();
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Add("User-Agent", "dotnet WASI unit test");

var query="https://corefx-net-http11.azurewebsites.net/Echo.ashx";
var json = await client.GetStringAsync(query);

Expand Down

0 comments on commit fbdf015

Please sign in to comment.