GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — test(dashboard): cover hosting and routing behavior by ReubenBond · Pull Request #10885 · dotnet/orleans Conversation
|
| Severity | Finding |
|---|---|
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/TimeSpanConverterTests.cs — JsonSerializer.Deserialize wraps exceptions thrown by custom converters (including… |
|
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/EmbeddedAssetTests.cs — EmbeddedAssetProvider only serves gzip when a precompressed representation exists and it is… |
Adds a comprehensive behavior-focused test suite for the Orleans.Dashboard package to close a major coverage gap (per #10865) without changing production code. The new tests validate service registration/DI wiring, endpoint routing/authorization and failure responses, host lifecycle behavior, embedded static assets (caching/compression), logging fanout, and TimeSpan JSON conversion.
Changes:
TimeSpan JSON converter behavior; expand embedded asset provider assertions.| File | Description |
|---|---|
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/TimeSpanConverterTests.cs | Adds TimeSpanConverter serialization/deserialization tests (format, error paths). |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/ServiceCollectionExtensionsTests.cs | Adds DI graph and registration/lifetime tests for AddDashboard and core services. |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/ServiceCollectionExtensionsRoutingTests.cs | Adds routing/authorization/API forwarding/static asset behavior tests for MapOrleansDashboard. |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/Implementation/DashboardLoggerTests.cs | Adds tests for DashboardLogger subscriber behavior and formatting. |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/EmbeddedAssetTests.cs | Strengthens embedded asset provider tests to assert headers/body/caching/compression behavior. |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/DashboardOptionsTests.cs | Adds tests for default options and option configuration via client/silo builders. |
| test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/DashboardHostTests.cs | Adds tests for DashboardHost activation warnings, lifecycle behavior, and telemetry disposal safety. |
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/TimeSpanConverterTests.cs:88
JsonSerializer.Deserialize<TimeSpan>("null", ...) will surface a JsonException (potentially with an ArgumentNullException inner exception) rather than throwing ArgumentNullException directly. As written, this test is likely to fail on modern System.Text.Json behavior. public void Read_NullToken_ThrowsArgumentNullException()
{
var exception = Assert.Throws<ArgumentNullException>(
() => JsonSerializer.Deserialize<TimeSpan>("null", SerializerOptions));
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Code coverage78.84% line coverage - 99,816 / 126,605 lines Coverage details
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: None
| Severity | Finding |
|---|---|
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/EmbeddedAssetTests.cs — EmbeddedAssetProvider only serves gzip when a precompressed representation exists and it is… View resolved comment |
|
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/TimeSpanConverterTests.cs — JsonSerializer.Deserialize wraps exceptions thrown by custom converters (including… View resolved comment |
Previously missed (2) — in code that hasn't changed since the last review.
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/ServiceCollectionExtensionsRoutingTests.cs:118
Assert.Equal(StatusCodes.Status200OK, response.StatusCode);
Assert.Equal("text/css", response.ContentType);
Assert.Equal(expectedBody.Length, response.ContentLength);
Assert.Equal("no-store, no-cache", response.Headers.CacheControl.ToString());
Assert.True(EntityTagHeaderValue.TryParse(response.Headers.ETag.ToString(), out var entityTag));
Assert.Equal(expectedBody, response.Body);
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/DashboardHostTests.cs:163
host.Dispose();
Assert.Equal(1, trackingProvider.DisposeCalls);
}
finally
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: None
Previously missed (2) — in code that hasn't changed since the last review.
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/TimeSpanConverterTests.cs:80
JsonException.Message substring from System.Text.Json. That message text is not part of the converter’s contract and can change between .NET versions, making the test brittle. Prefer asserting stable properties (exception type + Path) and that the message is non-empty. public void Read_NonStringToken_ThrowsJsonException(string json)
{
var exception = Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<TimeSpan>(json, SerializerOptions));
Assert.Equal("$", exception.Path);
Assert.Contains(
"The JSON value could not be converted to System.TimeSpan.",
exception.Message,
StringComparison.Ordinal);
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/ServiceCollectionExtensionsRoutingTests.cs:571
traceId/extensions) depending on ASP.NET Core defaults and registered services, so asserting the complete property list is brittle. It’s usually enough to assert the status code/content-type and the specific fields you care about.This issue also appears on line 572 of the same file.
Assert.Equal(
["detail", "status", "title", "type"],
root.EnumerateObject()
.Select(property => property.Name)
.OrderBy(static name => name, StringComparer.Ordinal));
test/Orleans.Dashboard.Tests/Orleans.Dashboard.UnitTests/ServiceCollectionExtensionsRoutingTests.cs:574
type value to a specific RFC URL which is produced by the framework, not the dashboard code. That constant can change between ASP.NET Core versions; consider only asserting that type is present and non-empty. Assert.Equal(
"https://tools.ietf.org/html/rfc9110#section-15.5.4",
root.GetProperty("type").GetString());
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: None
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
test(hosting): close long-tail package coverage gaps
There was an error while loading. Please reload this page.