diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..51c8d0c29c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,75 @@ +# Steeltoe Build and Test Guide for Developers and CI/CD Agents + +This document provides essential guidelines for working with the Steeltoe codebase. For detailed build and test procedures, refer to the [GitHub workflows](.github/workflows/) which serve as the source of truth. + +## General Guidelines + +### Code Review and Suggestions +- Only make high confidence suggestions when reviewing code changes. +- Always use the latest stable version of C#. +- Never add or change `global.json` unless explicitly asked to. +- Never change `NuGet.config` files unless explicitly asked to. + +### Null Handling +- Declare variables non-nullable, and check for null at public API entry points. +- For internal code, trust the C# null annotations and don't add null checks when the type system says a value cannot be null. + +### Writing Tests +- Do not emit "Act", "Arrange" or "Assert" comments in test code. +- Tests should pass before committing and pushing changes. +- When possible, code coverage levels should be increased or at least maintained. + +## Prerequisites + +- **.NET SDK 10.0** (latest patch version) +- **.NET Runtime 8.0** (latest patch version) +- **.NET Runtime 9.0** (latest patch version) + +Verify your installation: +```bash +dotnet --list-sdks +dotnet --list-runtimes +``` + +## Quick Start + +For quick iteration during development: +```bash +dotnet build +dotnet test +``` + +For final validation before committing changes: +```bash +dotnet build src/Steeltoe.All.sln --configuration Release +dotnet test src/Steeltoe.All.sln --configuration Release +``` + +### Run Tests + +For detailed test procedures including environment-specific filters, test categories, and coverage collection, see [`.github/workflows/Steeltoe.All.yml`](.github/workflows/Steeltoe.All.yml). + +**Important context for agents:** +- Tests run on multiple frameworks: net8.0, net9.0, and net10.0 +- Tests use xUnit trait categories: `Integration` (requires Docker services), `MemoryDumps` (generates memory dumps) +- Platform-specific test skipping uses attributes like `[FactSkippedOnPlatform]` and `[TheorySkippedOnPlatform]` instead of trait categories +- Integration tests require Docker containers to be running (e.g., Config Server, Eureka Server) and are primarily designed for Linux CI environments +- When writing tests, use `[Trait("Category", "Integration")]` for tests requiring external services like Docker containers + +## Code Style Validation + +Steeltoe uses ReSharper/Rider code cleanup tools via `regitlint` to enforce consistent code style. The CI workflow (`.github/workflows/verify-code-style.yml`) automatically verifies code style on all pull requests. + +To run code cleanup locally: +```powershell +./cleanupcode.ps1 main +``` + +If your PR fails the code style check, run `cleanupcode.ps1` locally and commit the changes. + +## Additional Resources + +- [Steeltoe Documentation](https://steeltoe.io/) +- [Contributing Guidelines](https://github.com/SteeltoeOSS/Steeltoe/wiki) +- [CI Workflow](.github/workflows/Steeltoe.All.yml) +- [Code Style Workflow](.github/workflows/verify-code-style.yml) diff --git a/src/Management/test/Endpoint.Test/ManagementOptionsTest.cs b/src/Management/test/Endpoint.Test/ManagementOptionsTest.cs index 096108dd39..0868057508 100644 --- a/src/Management/test/Endpoint.Test/ManagementOptionsTest.cs +++ b/src/Management/test/Endpoint.Test/ManagementOptionsTest.cs @@ -20,7 +20,7 @@ namespace Steeltoe.Management.Endpoint.Test; public sealed class ManagementOptionsTest { - private static readonly JsonSerializerOptions DefaultJsonSerializerOptions = new JsonSerializerOptions + private static readonly JsonSerializerOptions ExpectedJsonSerializerOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, Converters = @@ -51,7 +51,7 @@ public async Task Configures_default_settings() options.Port.Should().Be(0); options.SslEnabled.Should().BeFalse(); options.UseStatusCodeFromResponse.Should().BeTrue(); - options.SerializerOptions.Should().BeEquivalentTo(DefaultJsonSerializerOptions); + options.SerializerOptions.Should().BeEquivalentTo(ExpectedJsonSerializerOptions); options.CustomJsonConverters.Should().BeEmpty(); options.GetBasePath("/cloudfoundryapplication/info").Should().Be("/cloudfoundryapplication"); @@ -97,7 +97,7 @@ public async Task Configures_custom_settings() options.SslEnabled.Should().BeTrue(); options.UseStatusCodeFromResponse.Should().BeFalse(); - options.SerializerOptions.Should().BeEquivalentTo(new JsonSerializerOptions(DefaultJsonSerializerOptions) + options.SerializerOptions.Should().BeEquivalentTo(new JsonSerializerOptions(ExpectedJsonSerializerOptions) { WriteIndented = true, Converters =