Skip to content

Commit 89ce0fd

Browse files
Attempt to run Action tests on Linux
1 parent d7dcc36 commit 89ce0fd

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

tests/ImageSharp.Web.Tests/Actions/ActionTests.cs

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

4-
using System.Runtime.InteropServices;
54
using System.Threading.Tasks;
65
using Microsoft.AspNetCore.Http;
76
using Microsoft.AspNetCore.TestHost;
@@ -12,35 +11,13 @@ namespace SixLabors.ImageSharp.Web.Tests.Actions
1211
{
1312
public class ActionTests
1413
{
14+
private const string Command = "?width=20";
15+
1516
[Theory]
1617
[InlineData(ImageSharpTestServer.PhysicalTestImage)]
1718
[InlineData(ImageSharpTestServer.AzureTestImage)]
1819
public async Task ShouldRunOnValidateActionAsync(string url)
1920
{
20-
// Running this test with Azurite https://github.com/Azure/Azurite/ on Travis results in the following exception.
21-
//
22-
// Error Message:
23-
// Microsoft.Azure.Storage.StorageException : Unexpected response code, Expected:PartialContent, Received:OK
24-
// Stack Trace:
25-
// at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
26-
// at Microsoft.Azure.Storage.Blob.BlobReadStream.DispatchReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
27-
// at Microsoft.Azure.Storage.Blob.BlobReadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
28-
// at SixLabors.ImageSharp.Image.InternalDetectFormat(Stream stream, Configuration config)
29-
// at SixLabors.ImageSharp.Image.DiscoverDecoder(Stream stream, Configuration config, IImageFormat& format)
30-
// at SixLabors.ImageSharp.Image.Decode[TPixel](Stream stream, Configuration config)
31-
// at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Stream stream, IImageFormat& format)
32-
// at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context) in /home/travis/build/SixLabors/ImageSharp.Web/src/ImageSharp.Web/Middleware/ImageSharpMiddleware.cs:line 228
33-
// at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.Invoke(HttpContext httpContext)
34-
// at Microsoft.AspNetCore.TestHost.ClientHandler.<>c__DisplayClass3_0.<<SendAsync>b__0>d.MoveNext()
35-
// --- End of stack trace from previous location where exception was thrown ---
36-
// at Microsoft.AspNetCore.TestHost.ClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
37-
// at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
38-
// at SixLabors.ImageSharp.Web.Tests.Actions.ActionTests.ShouldRunOnValidateAction(String url) in /home/travis/build/SixLabors/ImageSharp.Web/tests/ImageSharp.Web.Tests/Actions/ActionTests.cs:line 31
39-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
40-
{
41-
// return;
42-
}
43-
4421
bool complete = false;
4522
void OnParseCommands(ImageCommandContext context)
4623
{
@@ -53,7 +30,7 @@ void OnParseCommands(ImageCommandContext context)
5330

5431
using (TestServer server = ImageSharpTestServer.CreateWithActions(OnParseCommands))
5532
{
56-
await server.CreateClient().GetAsync(url + "?width=20");
33+
await server.CreateClient().GetAsync(url + Command);
5734
}
5835

5936
Assert.True(complete);
@@ -63,11 +40,6 @@ void OnParseCommands(ImageCommandContext context)
6340
[InlineData(ImageSharpTestServer.AzureTestImage)]
6441
public async Task ShouldRunOnValidateActionNoCommandsAsync(string url)
6542
{
66-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
67-
{
68-
// return;
69-
}
70-
7143
bool complete = false;
7244
void OnParseCommands(ImageCommandContext context)
7345
{
@@ -100,7 +72,7 @@ void OnBeforeSave(FormattedImage image)
10072

10173
using (TestServer server = ImageSharpTestServer.CreateWithActions(null, OnBeforeSave))
10274
{
103-
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + "?width=20");
75+
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + Command);
10476
}
10577

10678
Assert.True(complete);
@@ -121,7 +93,7 @@ void OnProcessed(ImageProcessingContext context)
12193

12294
using (TestServer server = ImageSharpTestServer.CreateWithActions(null, null, OnProcessed))
12395
{
124-
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + "?width=20");
96+
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + Command);
12597
}
12698

12799
Assert.True(complete);
@@ -140,7 +112,7 @@ void OnPrepareResponse(HttpContext context)
140112

141113
using (TestServer server = ImageSharpTestServer.CreateWithActions(null, null, null, OnPrepareResponse))
142114
{
143-
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + "?width=20");
115+
await server.CreateClient().GetAsync(ImageSharpTestServer.PhysicalTestImage + Command);
144116
}
145117

146118
Assert.True(complete);

0 commit comments

Comments
 (0)