Skip to content

V3.0.2/package maintenance #8

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

Closed
wants to merge 6 commits into from
Closed

Conversation

gimlichael
Copy link
Member

@gimlichael gimlichael commented Apr 3, 2025

This pull request includes several important changes to the build and test configurations, as well as updates to project dependencies and the addition of new test projects and test cases.

Build and Test Configuration Updates:

  • .github/workflows/pipelines.yml: Updated the runs-on version to ubuntu-24.04 for build, pack, and deploy jobs, and added a new test job with a matrix strategy for ubuntu-24.04 and windows-2022. Replaced the sonarcloud job with test, and added new sonarcloud and codecov jobs. [1] [2] [3] [4]

Project Dependency Updates:

  • Directory.Build.props: Updated PackageReference for Codebelt.Extensions.Xunit to Codebelt.Extensions.Xunit.App.
  • Directory.Packages.props: Updated versions for several package dependencies including Codebelt.Extensions.Xunit.App, Cuemon.Core, Cuemon.Extensions.Hosting, Microsoft.NET.Test.Sdk, Microsoft.AspNetCore.OpenApi, Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation, Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection.Abstractions, and Microsoft.Extensions.Hosting.

New Test Projects and Test Cases:

Environment Configuration:

Summary by CodeRabbit

  • Chores
    • Modernized the CI/CD pipeline by upgrading the build environment and integrating external workflows for code quality and analysis.
    • Updated package dependencies for improved stability and compatibility.
  • Tests
    • Expanded testing infrastructure with new projects and utilities to enhance overall quality.
    • Configured multiple test environments to support diverse execution settings.
    • Introduced new test classes and methods to validate application startup, service registration, and background service functionalities.
    • Added a new background service to log application startup times.

@gimlichael gimlichael requested a review from Copilot April 3, 2025 19:50
@gimlichael gimlichael self-assigned this Apr 3, 2025
Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

This pull request updates the CI/CD pipeline by upgrading OS versions, introducing a new test matrix with Ubuntu and Windows, and offloading analysis tasks to external workflows. The solution is enhanced with new testing projects and updated package references. Additionally, new test host fixtures, startup classes, and test-specific configurations are added to support both functional and unit testing.

Changes

File(s) Change Summary
.github/workflows/pipelines.yml Updated OS versions from ubuntu-22.04 to ubuntu-24.04; restructured jobs (build, pack, deploy) and replaced sonarcloud steps with a new test job (matrix strategy); added external workflow calls for SonarCloud, Codecov, and CodeQL.
Codebelt.Bootstrapper.sln Added three new projects: "test", "Codebelt.Bootstrapper.Tests", and "Codebelt.Bootstrapper.FunctionalTests", with corresponding configuration settings under the solution.
Directory.Build.props
Directory.Packages.props
Updated package references and versions; switched Codebelt.Extensions.Xunit to Codebelt.Extensions.Xunit.App and bumped versions for Cuemon, Microsoft.NET.Test.Sdk, xunit.runner.visualstudio, and others under conditional groups.
test/Codebelt.Bootstrapper.FunctionalTests/* New functional test assets including TestFixture.cs, TestStartup.cs, BootstrapperLifetimeTest.cs and the project file, establishing a test host and lifetime verification tests.
test/Codebelt.Bootstrapper.Tests/* New unit test assets including StartupRootUnsafeAccessor.cs, TestStartupRoot.cs, StartupRootTest.cs and the corresponding project file to validate configuration, environment, and service registrations.
testenvironments.json Introduced a JSON configuration file defining testing environments (WSL-Ubuntu and Docker-Ubuntu).

Sequence Diagram(s)

sequenceDiagram
    participant GitHub as GitHub Actions
    participant Build as Build Job (ubuntu-24.04)
    participant Test as Test Job (matrix: ubuntu-24.04, windows-2022)
    participant Sonar as External SonarCloud Workflow
    participant Codecov as External Codecov Workflow
    participant CodeQL as External CodeQL Workflow
    participant Deploy as Deploy Job (ubuntu-24.04)

    GitHub->>Build: Trigger build
    Build->>Test: Trigger tests
    Test->>Sonar: Call external SonarCloud workflow
    Test->>Codecov: Call external Codecov workflow
    Test->>CodeQL: Call external CodeQL workflow
    Sonar-->>Deploy: Notify complete
    Codecov-->>Deploy: Notify complete
    CodeQL-->>Deploy: Notify complete
    Deploy->>GitHub: Deploy finished
Loading
sequenceDiagram
    participant Runner as TestRunner
    participant Fixture as TestHostFixture
    participant Builder as HostBuilder
    participant Startup as TestStartup

    Runner->>Fixture: Initialize test host
    Fixture->>Builder: Create default host builder
    Builder->>Startup: Configure services & configuration
    Startup-->>Builder: Return configuration
    Builder-->>Fixture: Build host
    Fixture->>Runner: Provide test host for execution
Loading

Possibly related PRs

  • V2.0.0/alm+gha #1: Restructures the CI/CD pipeline; closely related to the changes in .github/workflows/pipelines.yml by introducing a similar modular workflow approach.

Poem

I'm a rabbit, hopping through the code,
Upgrading pipelines on a brand new road.
With tests and workflows leaping in a row,
My tiny paws help new features grow.
I nibble bugs and cheer with glee,
A bouncy code journey for you and me!
🐇🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd2c44 and c4c78c9.

📒 Files selected for processing (4)
  • test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestBackgroundService.cs (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/HostedServiceExtensionsTest.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj
  • test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestBackgroundService.cs
  • test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs

Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 13 changed files in this pull request and generated 1 comment.

Files not reviewed (6)
  • Codebelt.Bootstrapper.sln: Language not supported
  • Directory.Build.props: Language not supported
  • Directory.Packages.props: Language not supported
  • test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj: Language not supported
  • test/Codebelt.Bootstrapper.Tests/Codebelt.Bootstrapper.Tests.csproj: Language not supported
  • testenvironments.json: Language not supported

Copy link

codecov bot commented Apr 3, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (13)
test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestStartup.cs (2)

7-16: Add documentation to TestStartup class

The TestStartup class inherits from StartupRoot but contains an empty ConfigureServices implementation, unlike its counterpart TestStartupRoot which adds test services. Consider adding XML documentation to explain the purpose of this class and why its ConfigureServices method is empty.

 namespace Codebelt.Bootstrapper.Assets
 {
+    /// <summary>
+    /// Provides a test startup implementation for functional tests.
+    /// Unlike TestStartupRoot used in unit tests, this implementation
+    /// doesn't register any test services by default, allowing functional
+    /// tests to work with services configured by the application under test.
+    /// </summary>
     public class TestStartup : StartupRoot
     {
         public TestStartup(IConfiguration configuration, IHostEnvironment environment) : base(configuration, environment)
         {
         }

+        /// <summary>
+        /// Override to configure services for functional tests.
+        /// Currently empty by design to use services as configured by the application.
+        /// </summary>
         public override void ConfigureServices(IServiceCollection services)
         {
         }
     }
 }

13-15: Consider test-specific service configuration

The empty ConfigureServices method might need implementation as functional tests evolve. Consider whether any common test services or mocks might be useful across functional tests.

Would you like me to suggest any common test services that might be beneficial to add here based on patterns in similar functional test setups?

test/Codebelt.Bootstrapper.Tests/Codebelt.Bootstrapper.Tests.csproj (1)

1-11: Consider adding standard test project properties

While the project file is functional, consider making it more explicitly a test project by adding standard test project properties. This would make the file more self-contained and easier to understand at a glance.

 <Project Sdk="Microsoft.NET.Sdk">

   <PropertyGroup>
     <RootNamespace>Codebelt.Bootstrapper</RootNamespace>
+    <IsPackable>false</IsPackable>
+    <IsTestProject>true</IsTestProject>
   </PropertyGroup>

   <ItemGroup>
     <ProjectReference Include="..\..\src\Codebelt.Bootstrapper\Codebelt.Bootstrapper.csproj" />
   </ItemGroup>

 </Project>
test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj (1)

8-10: Consider removing unused NewFolder references

There are references to removing a "NewFolder" directory which appears to be unused. If this is leftover from a template or initial setup, consider removing these lines to keep the project file clean.

-  <ItemGroup>
-    <Compile Remove="NewFolder\**" />
-    <EmbeddedResource Remove="NewFolder\**" />
-    <None Remove="NewFolder\**" />
-  </ItemGroup>
test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (1)

14-18: Consider adding additional test services

The implementation provides a basic test service, which is good for initial testing. As the project evolves, consider expanding this with additional test services that might be needed for comprehensive testing.

testenvironments.json (1)

12-12: Document the Docker image specification

The Docker image gimlichael/ubuntu-testrunner:net8.0.407-9.0.202 is used for testing. Consider adding documentation that explains what this image contains and why this specific version was chosen to help future maintainers.

test/Codebelt.Bootstrapper.Tests/Assets/StartupRootUnsafeAccessor.cs (1)

9-10: Consider documenting the purpose of accessing private properties.

While using UnsafeAccessor for testing is valid, it might be helpful to add a brief comment explaining why this approach was chosen over making the properties public or internal with [InternalsVisibleTo].

test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestFixture.cs (1)

16-23: Consider documenting the purpose of callbacks.

The ConfigureCallback and ConfigureServicesCallback methods being used aren't clearly documented. Adding XML comments to explain their purpose would improve code maintainability.

-                {
-                    ConfigureCallback(config.Build(), context.HostingEnvironment);
-                })
-                .ConfigureServices((context, services) =>
-                {
-                    Configuration = context.Configuration;
-                    HostingEnvironment = context.HostingEnvironment;
-                    ConfigureServicesCallback(services);
-                })
+                {
+                    // Apply additional test-specific configuration settings
+                    ConfigureCallback(config.Build(), context.HostingEnvironment);
+                })
+                .ConfigureServices((context, services) =>
+                {
+                    // Store context resources for test accessibility
+                    Configuration = context.Configuration;
+                    HostingEnvironment = context.HostingEnvironment;
+                    // Apply test-specific service configuration
+                    ConfigureServicesCallback(services);
+                })
test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs (1)

85-99: Remove commented-out code.

The commented-out methods appear to be older versions of the test setup that have been refactored. These should be removed to improve code clarity.

-
-
-        //public override void ConfigureServices(IServiceCollection services)
-        //{
-        //    services.AddXunitTestLoggingOutputHelperAccessor();
-        //    services.AddXunitTestLogging(TestOutput);
-        //}
-
-        //protected override void ConfigureHost(IHostBuilder hb)
-        //{
-        //    BootstrapperLifetime.OnApplicationStartedCallback = () => { _started = true; };
-        //    BootstrapperLifetime.OnApplicationStoppingCallback = () => { _stopping = true; };
-        //    BootstrapperLifetime.OnApplicationStoppedCallback = () => { _stopped = true; };
-        //    hb.UseBootstrapperLifetime();
-        //    hb.UseBootstrapperStartup<TestStartup>();
-        //}
test/Codebelt.Bootstrapper.Tests/StartupRootTest.cs (1)

50-52: Remove unnecessary empty lines.

There are two consecutive empty lines that can be reduced to one for better code consistency.

-

-

+
.github/workflows/pipelines.yml (3)

111-119: SonarCloud Job – External Workflow Integration and YAML Formatting
The SonarCloud job now calls an external workflow and correctly depends on both the build and test jobs. However, the needs list is declared as [build,test] on line 113. For improved readability and to conform to YAML style guidelines, please add a space after the comma (i.e., [build, test]).

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 113-113: too few spaces after comma

(commas)


121-127: Codecov Job – External Workflow and List Formatting
The Codecov job correctly invokes an external workflow and depends on the build and test jobs. Similar to the SonarCloud job, updating the needs list from [build,test] to [build, test] (line 123) will enhance readability and adhere to style best practices.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 123-123: too few spaces after comma

(commas)


129-132: CodeQL Job – External Workflow and YAML List Format
The CodeQL job is properly configured to depend on the build and test jobs and to call its external workflow. Please reformat the needs list at line 131 by ensuring a space after the comma (i.e., [build, test]) to comply with YAML formatting standards.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 131-131: too few spaces after comma

(commas)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09c42b2 and 5ee6616.

📒 Files selected for processing (13)
  • .github/workflows/pipelines.yml (4 hunks)
  • Codebelt.Bootstrapper.sln (3 hunks)
  • Directory.Build.props (1 hunks)
  • Directory.Packages.props (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestFixture.cs (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestStartup.cs (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs (1 hunks)
  • test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj (1 hunks)
  • test/Codebelt.Bootstrapper.Tests/Assets/StartupRootUnsafeAccessor.cs (1 hunks)
  • test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (1 hunks)
  • test/Codebelt.Bootstrapper.Tests/Codebelt.Bootstrapper.Tests.csproj (1 hunks)
  • test/Codebelt.Bootstrapper.Tests/StartupRootTest.cs (1 hunks)
  • testenvironments.json (1 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (1)
test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestStartup.cs (1)
  • ConfigureServices (13-15)
test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestStartup.cs (1)
test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (1)
  • ConfigureServices (14-18)
test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestFixture.cs (2)
test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestStartup.cs (1)
  • ConfigureServices (13-15)
test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (1)
  • ConfigureServices (14-18)
test/Codebelt.Bootstrapper.Tests/StartupRootTest.cs (2)
test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (3)
  • TestStartupRoot (7-19)
  • TestStartupRoot (9-12)
  • ConfigureServices (14-18)
test/Codebelt.Bootstrapper.Tests/Assets/StartupRootUnsafeAccessor.cs (1)
  • StartupRootUnsafeAccessor (7-14)
🪛 YAMLlint (1.35.1)
.github/workflows/pipelines.yml

[warning] 113-113: too few spaces after comma

(commas)


[warning] 123-123: too few spaces after comma

(commas)


[warning] 131-131: too few spaces after comma

(commas)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: 🧪 Test (windows-2022, Debug)
  • GitHub Check: 🧪 Test (windows-2022, Release)
🔇 Additional comments (30)
Codebelt.Bootstrapper.sln (3)

42-47: Good addition of test projects structure

The new test folder and projects are properly organized in the solution structure, following the established pattern in the project. This addition aligns well with the package maintenance goals outlined in the PR.


118-125: Build configurations properly set

The build configurations for both test projects are correctly configured for Debug and Release configurations, ensuring they will build properly in all solution configurations.


147-148: Proper solution folder nesting

Test projects are correctly nested under the test solution folder, maintaining a clean and organized solution structure.

Directory.Packages.props (3)

8-15: Package version updates for testing packages

All testing-related packages have been updated to their latest versions, including Cuemon dependencies, Microsoft.NET.Test.Sdk, and xunit.runner.visualstudio. These updates are important for ensuring compatibility with the latest test runners and frameworks.


18-29: Framework-specific package updates

The Microsoft packages for both net9 and net8 target frameworks have been updated to their latest patches (9.0.3 and 8.0.14 respectively). This indicates proper maintenance of dependencies across different framework targets.


7-7:

❓ Verification inconclusive

Package reference change from Xunit to Xunit.App

The change from Codebelt.Extensions.Xunit to Codebelt.Extensions.Xunit.App represents a significant shift in the testing infrastructure. This aligns with the new test projects being added and may provide additional functionality needed for the expanded test coverage.


🏁 Script executed:

#!/bin/bash
# Check if there are existing projects using the old package reference
rg -g "*.csproj" "Codebelt\.Extensions\.Xunit" --files-with-matches
# Check for any breaking changes in this switch by searching for migration guides
rg -g "*.md" -i "migration|upgrade|breaking.*Codebelt\.Extensions\.Xunit\.App" -A 3 -B 3

Length of output: 160


Verify updated package references and confirm migration impact

The update replacing Codebelt.Extensions.Xunit with Codebelt.Extensions.Xunit.App (version 9.1.3) aligns with the new test infrastructure, and our initial automated searches didn’t reveal any remaining references to the old package or specific migration guides. However, because the shell scripts produced no output—and thus the inference remains inconclusive—please perform a manual verification to ensure that all project files and documentation reflect this change correctly and that the new package meets all test requirements.

  • Confirm that no .csproj, .props, or .targets files still reference the old package.
  • Verify that any related documentation or migration notes (if available) have been updated accordingly.
test/Codebelt.Bootstrapper.Tests/Codebelt.Bootstrapper.Tests.csproj (1)

3-5:

✅ Verification successful

Verify target framework inheritance

The project doesn't explicitly specify a TargetFramework. Verify that it's properly inheriting this from Directory.Build.props to ensure it's targeting the appropriate framework version(s).


🏁 Script executed:

#!/bin/bash
# Check Directory.Build.props for target framework definitions
rg "TargetFramework" -g "Directory.Build.props"
# Check if any test projects explicitly define target frameworks
rg "TargetFramework" -g "*Test*.csproj"

Length of output: 239


Target Framework Inheritance Verified
The Directory.Build.props file correctly defines <TargetFrameworks>net9.0;net8.0</TargetFrameworks>, and no test project (e.g., Codebelt.Bootstrapper.Tests.csproj) explicitly overrides this setting. Please confirm that these target frameworks are the intended defaults for the test projects.

test/Codebelt.Bootstrapper.FunctionalTests/Codebelt.Bootstrapper.FunctionalTests.csproj (1)

1-17: LGTM! New functional test project setup looks good

The functional test project is correctly configured with the appropriate root namespace and project reference to the main library.

test/Codebelt.Bootstrapper.Tests/Assets/TestStartupRoot.cs (2)

1-20: LGTM! Test startup implementation is properly structured

The TestStartupRoot class correctly inherits from StartupRoot and passes the required parameters to the base constructor. The ConfigureServices method is properly overridden to add test-specific services.


5-20: Note the difference from TestStartup in FunctionalTests

I notice that TestStartupRoot registers a test service, while the similar TestStartup class in the functional tests project has an empty ConfigureServices implementation. Ensure this difference is intentional based on the different testing needs of each project.

Directory.Build.props (2)

76-76: LGTM! Package reference updated appropriately

The package reference has been updated from Codebelt.Extensions.Xunit to Codebelt.Extensions.Xunit.App as part of the package maintenance effort described in the PR objectives.


76-76:

❓ Verification inconclusive

Verify compatibility with existing tests

Ensure that the transition from Codebelt.Extensions.Xunit to Codebelt.Extensions.Xunit.App doesn't introduce breaking changes in existing tests. The .App suffix suggests a different implementation that might have different APIs or behaviors.


🏁 Script executed:

#!/bin/bash
# Find any references to the old package in test files
rg -l "Codebelt\.Extensions\.Xunit" --type csharp

Length of output: 239


Ensure Compatibility with Package Transition

The update in Directory.Build.props (Line 76) switches the package reference to Codebelt.Extensions.Xunit.App, but our test files are still referencing Codebelt.Extensions.Xunit (e.g., in test/Codebelt.Bootstrapper.Tests/StartupRootTest.cs, test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs, and test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestFixture.cs). Please verify that the new package version maintains backward compatibility with the APIs these tests rely on. If there are breaking changes, update the tests accordingly or provide adapter methods to align with the new implementation.

testenvironments.json (2)

1-15: LGTM! Test environment configuration looks well-structured

The test environments configuration is well-structured with clear definitions for WSL and Docker environments. This aligns with the PR objective to update environment configurations.


7-7: Verify Ubuntu-24.04 availability in CI/CD

The WSL distribution is specified as "Ubuntu-24.04". Ensure this exact version is available in your CI/CD environments where tests will run. This matches the updated ubuntu-24.04 runner in the CI pipeline.

test/Codebelt.Bootstrapper.Tests/Assets/StartupRootUnsafeAccessor.cs (1)

7-14: Well-implemented UnsafeAccessor pattern for testing private members.

This class uses the UnsafeAccessor attribute to access non-public properties of the StartupRoot class in a type-safe way, which is more modern than traditional reflection. It's properly focused on testing purposes and follows good naming conventions.

test/Codebelt.Bootstrapper.FunctionalTests/Assets/TestFixture.cs (1)

11-33: Solid implementation of test host fixture configuration.

The ConfigureHost method effectively sets up the testing infrastructure by configuring a host builder with the necessary components for test execution.

test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs (4)

22-38: Well-structured test for service registration.

This test effectively verifies that the BootstrapperLifetime is properly registered as an IHostLifetime implementation.


40-58: Well-implemented callback verification test.

This test correctly verifies that the OnApplicationStartedCallback is invoked when the host starts.


60-82: Well-structured test for multiple lifecycle callbacks.

This test effectively verifies that both stopping and stopped callbacks are invoked during the host shutdown process.


44-44:

❓ Verification inconclusive

Caution: Static callbacks can cause test interference.

Using static callback properties can potentially cause interference between tests if run in parallel. Consider using instance-level callback approaches if possible.


🏁 Script executed:

#!/bin/bash
# Check if BootstrapperLifetime.OnApplicationStartedCallback is static
rg -A 5 'OnApplicationStartedCallback' --type csharp

Length of output: 6042


Attention: Verify Static Callback Usage for Test Isolation

It’s been confirmed that BootstrapperLifetime.OnApplicationStartedCallback is a static property (see src/Codebelt.Bootstrapper/BootstrapperLifetime.cs). Assignments like the one at line 44 in test/Codebelt.Bootstrapper.FunctionalTests/BootstrapperLifetimeTest.cs directly affect global state. This can potentially lead to interference between tests if they run in parallel. If parallel execution is expected, please verify that tests remain isolated or consider refactoring to use instance-level callbacks.

test/Codebelt.Bootstrapper.Tests/StartupRootTest.cs (4)

19-35: Well-structured test setup with proper in-memory configuration.

The constructor correctly sets up an in-memory configuration and a hosting environment for testing purposes.


37-48: Good use of UnsafeAccessor to test private properties.

This test verifies that the Configuration property returns the injected configuration, using the UnsafeAccessor pattern appropriately.


53-63: Well-structured test for Environment property.

This test effectively verifies that the Environment property returns the injected environment.


65-79: Well-structured test for service registration.

This test effectively verifies that the ConfigureServices method adds services to the service collection as expected. Good use of the Arrange-Act-Assert pattern.

.github/workflows/pipelines.yml (6)

24-24: Build Job OS Upgrade Verified
The build job now explicitly runs on ubuntu-24.04, which aligns with the PR objective to update the pipeline’s environment.


65-65: Pack Job OS Upgrade Verified
The pack job’s runtime has been updated to ubuntu-24.04, ensuring consistency with the build environment.


83-92: New Test Job Integration
A new test job has been introduced with a matrix strategy that supports both ubuntu-24.04 and windows-2022. The use of a 15-minute timeout and distinct configurations (Debug and Release) looks well-aligned with the enhanced testing framework.


102-104: .NET Tool - Report Generator Step Added
The addition of the step to install the .NET Tool for Report Generator is appropriate and supports test reporting.


105-109: Test Step Configuration Verified
The test step utilizes codebeltnet/dotnet-test@v3 with the matrix-based configuration. The inclusion of the build switch (-p:SkipSignAssembly=true) is noted; please confirm this flag is intended for your signing strategy.


137-138: Deploy Job Dependency and Environment Confirmation
The deploy job now runs on ubuntu-24.04 and correctly depends on all preceding jobs (build, pack, test, sonarcloud, codecov, codeql), which establishes a robust dependency chain. This update meets the PR objectives.

Copy link

sonarqubecloud bot commented Apr 4, 2025

@gimlichael
Copy link
Member Author

Decided to opt-in for breaking changes; hance, this PR is closed.

@gimlichael gimlichael closed this Apr 11, 2025
@gimlichael gimlichael deleted the v3.0.2/package-maintenance branch April 11, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant