-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Upgrade to .NET 10 and add unit tests #86
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
Conversation
- Upgrade from .NET 8 to .NET 10 - Update all NuGet packages to latest versions (.NET 10.0.0, xunit 2.9.3) - Add 29 new unit and integration tests - Fix CA2022 warning in IntegrationTests - Add macOS support for local development (NullStateCollector) - Update GitHub Actions workflow to .NET 10 - Update README to reflect .NET 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to upgrade the HAProxy Agent Check application from .NET 8 to .NET 10, while adding comprehensive unit tests and improving macOS development support. However, there are critical issues: .NET 10 does not exist yet (the latest stable version as of January 2025 is .NET 9), and several package versions are being downgraded unexpectedly.
Key Changes:
- Attempted upgrade to .NET 10 SDK and runtime (currently non-existent)
- Added 29 new unit tests covering rule validation, weight calculation, maintenance status, custom counters, TCP responses, and HTTP endpoints
- Added macOS support for development/testing with
NullStateCollector - Fixed CA2022 warning in IntegrationTests.cs for inexact Stream.ReadAsync usage
- Switched from
coverlet.msbuildtocoverlet.collectorfor code coverage
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
global.json |
Updates SDK to 10.0.100 (non-existent version) |
README.md |
Updates documentation reference from .NET Core 3.1 to .NET 10 |
Haproxy.AgentCheck/Hosting/HostBuilderExtensions.cs |
Adds macOS support with no-op collector for development |
Haproxy.AgentCheck/Haproxy.AgentCheck.csproj |
Changes target framework to net10.0 and removes System.IO.Pipelines |
Haproxy.AgentCheck.Tests/Haproxy.AgentCheck.Tests.csproj |
Updates target framework to net10.0 and switches to coverlet.collector |
Haproxy.AgentCheck.Tests/WeightRuleTests.cs |
Adds 4 tests for linear weight calculation logic |
Haproxy.AgentCheck.Tests/TcpResponseTests.cs |
Adds 4 tests for TCP response formatting scenarios |
Haproxy.AgentCheck.Tests/RuleConfigTests.cs |
Adds 7 tests for rule validation logic |
Haproxy.AgentCheck.Tests/MaintenanceStatusTests.cs |
Adds 3 tests for maintenance mode state management |
Haproxy.AgentCheck.Tests/IntegrationTests.cs |
Fixes CA2022 warning by properly handling Stream.ReadAsync byte count |
Haproxy.AgentCheck.Tests/HttpEndpointTests.cs |
Adds 6 tests for HTTP endpoints with authentication |
Haproxy.AgentCheck.Tests/CountersStateTests.cs |
Adds 5 tests for custom counter metrics behavior |
Directory.Packages.props |
Updates package versions including downgrades of OpenTelemetry and xunit.runner.visualstudio |
.github/workflows/dotnetcore.yml |
Updates CI workflow to use .NET 10 SDK (non-existent) |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.11.2" /> | ||
| <PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.2" /> | ||
| <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.11.2" /> | ||
| <PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.1" /> |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenTelemetry packages are being downgraded from 1.14.0 to 1.11.1/1.11.2. This is a regression - downgrading packages during an upgrade PR could reintroduce bugs or remove features. Consider keeping these at the latest stable versions (1.14.0 or newer).
| <PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.11.2" /> | |
| <PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.2" /> | |
| <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.11.2" /> | |
| <PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.1" /> | |
| <PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.14.0" /> | |
| <PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" /> | |
| <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" /> | |
| <PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0" /> |
| </PackageVersion> | ||
| <PackageVersion Include="xunit" Version="2.9.3" /> | ||
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5"> | ||
| <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"> |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xunit.runner.visualstudio is being downgraded from 3.1.5 to 2.8.2. The description mentions "v2 stable" but version 3.x is the current stable version series. Downgrading could lose compatibility with newer xunit features or tooling. Consider keeping version 3.1.5 unless there's a specific compatibility issue.
| <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"> | |
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5"> |
|
|
||
| private WebApplicationFactory<Program> CreateFactory() | ||
| { | ||
| return new WebApplicationFactory<Program>() |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'WebApplicationFactory' is created but not disposed.
Description
This PR upgrades the project from .NET 8 to .NET 10 and adds comprehensive unit and integration tests.
Changes
π .NET 10 Upgrade
global.json8.0.409β10.0.100Haproxy.AgentCheck.csprojnet8.0βnet10.0Haproxy.AgentCheck.Tests.csprojnet8.0βnet10.0.github/workflows/dotnetcore.yml8.0.xβ10.0.xπ¦ Package Updates
π§ͺ New Tests (29 tests added)
RuleConfigTests.csWeightRuleTests.csMaintenanceStatusTests.csCountersStateTests.csTcpResponseTests.csHttpEndpointTests.csπ§ Code Changes
HostBuilderExtensions.csNullStateCollectorfor local dev/testingIntegrationTests.csREADME.mdSystem.IO.Pipelinespackage reference (included in .NET 10 runtime)Test Results
Breaking Changes
None - this is a runtime upgrade only. The API and behavior remain unchanged.
Checklist