Skip to content

[release/8.0] Fix ResponseCompressionMiddleware tests #60884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: release/8.0
Choose a base branch
from
Open
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
@@ -1324,7 +1324,8 @@
}
Assert.NotNull(response.Content.Headers.GetValues(HeaderNames.ContentMD5));
Assert.Empty(response.Content.Headers.ContentEncoding);
Assert.Equal(expectedBodyLength, response.Content.Headers.ContentLength);
// Check that compressed size is within a reasonable range
Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength! - 5), (int)(expectedBodyLength! + 5));

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-quarantined-pr

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-quarantined-pr

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-ci

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.

Check failure on line 1328 in src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs

Azure Pipelines / aspnetcore-ci

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs#L1328

src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs(1328,16): error CS0313: (NETCORE_ENGINEERING_TELEMETRY=Build) The type 'long?' cannot be used as type parameter 'T' in the generic type or method 'Assert.InRange<T>(T, T, T)'. The nullable type 'long?' does not satisfy the constraint of 'System.IComparable'. Nullable types can not satisfy any interface constraints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength! - 5), (int)(expectedBodyLength! + 5));
Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength.Value - 5), (int)(expectedBodyLength.Value + 5));

}

private static void AssertLog(WriteContext log, LogLevel level, string message)
Loading