Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .github/SUPPORT.md

This file was deleted.

105 changes: 105 additions & 0 deletions .github/copy-sc-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Testing

ServiceControl tests are designed to test different components and behaviors. This document outlines the tests in the repository and what they are meant to test.

## Unit tests

ServiceControl components have specific unit test projects verifying their behaviors and API.

## Packaging tests

Packaging tests check:

- Folder structure and content of the [packaging process](packaging.md) output.
- That packaged [assembly versions match](packaging.md#assembly-mismatches).

## Installation engine tests

Installation engine tests run partial installations and checks:

- That the generated configuration is correct.
- That transport and persistence are correctly extracted.

## Persistence tests

Persistence tests check assumptions at the persistence seam level by exercising each persister.
For local setup details, see [Local Testing of Persistence Providers](testing-persistence.md).

## Transport tests

Transport tests are done by executing the transport test suite for each transport.

## Acceptance tests

Run ServiceControl full version and use the HTTP API to validate results. LearningTransport is used for all tests.

### Windows prerequisite: register the event sources

On Windows, every acceptance test fails on first run with:

```
System.Security.SecurityException : The source ServiceControl was not found on computer .,
but some or all event logs could not be searched. Inaccessible logs: Security.
```

Setup registers a Windows event source, and checking whether one already exists enumerates every event log, including `Security`, which a process without administrator rights cannot read.

Register both sources once, from an **elevated** PowerShell prompt:

```powershell
[System.Diagnostics.EventLog]::CreateEventSource('ServiceControl', 'Application')
[System.Diagnostics.EventLog]::CreateEventSource('ServiceControl.Audit', 'Application')
```

Use the .NET API as shown rather than `New-EventLog`, which is not available in PowerShell 7. Afterwards the tests run normally without elevation, because the lookup finds the registered source before it needs to read `Security`.

## Multi-instance tests

Multi-instance tests validate the interaction between different ServiceControl instances. ServiceControl instances are run in-memory in the same process. LearningTransport is used for all tests.

## Container tests

Container images generated for all builds are pushed to the [GitHub container registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry). Once pushed, all images are tested by [spinning them all up for each supported transport](/src/container-integration-test/).

Containers built by a PR and stored on GitHub Container Registry can be tested locally:

1. [Authenticate to the GitHub Container Registry using a personal access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic).
- Create a [classic token](https://github.com/settings/tokens). Select the scope for `read:packages`
- Copy the newly created token text.
- Run the following command in a terminal:
```shell
docker login ghcr.io
```
you will be prompted for a username (your particular.net email) and a password (the token)
- ensure that you get a successful login message.
- Use `docker logout ghcr.io` once the following steps are complete and consider removing the token from github if its no longer needed
2. In the terminal, navigate to [`/docs/test-ghcr-tag`](/docs/test/ghcr-tag).
3. Edit the [`.env` file](/docs/test-ghcr-tag/.env) to specify the PR-based tag (in the form `pr-####`) to test.
4. Run `docker compose up -d`.
5. Services will be available at the following URLs:
* [RabbitMQ Management](http://localhost:15672) (Login: `guest`/`guest`)
* [RavenDB](http://localhost:8080)
* [ServiceControl API](http://localhost:33333/api)
* [Audit API](http://localhost:44444/api)
* [Monitoring API](http://localhost:33633)
* [ServicePulse (latest from Docker Hub)](http://localhost:9090)
6. Tear down services using `docker compose down`.

## Container tests using Aspire

The [Particular.Aspire.Hosting.ServicePlatform](https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform) package integrates the Particular Platform with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`test-ghcr-tag-aspire`](/docs/test-ghcr-tag-aspire) to start up serviceconrol from a prerelease container image.

Containers built by a PR and stored on GitHub Container Registry can be tested locally:

1. Set up your github container registry credentials as described in the [Container tests](#container-tests) section above.
2. Make sure you have the [Aspire CLI installed](https://aspire.dev/get-started/install-cli/).
3. Run `aspire update` to ensure that the testing AppHost file `docs/test-ghcr-tag-aspire/AppHost.cs` is running the latest aspire SDK and RabbitMQ integration package.
4. Run `aspire run docs/test-ghcr-tag-aspire/AppHost.cs -- tag` to start the application, where `tag` is the PR-based tag (in the form `pr-####`) to test. If no tag is provided, it will default to the `latest` tag.
5. Once running you can open the dashboard from the link in the terminal, this dashboard will provide the assigned ports for each service.
* RabbitMQ Management (Login: `guest`/`guest`)
* RavenDB
* ServiceControl API
* Audit API
* Monitoring API
* ServicePulse (latest from Docker Hub)
6. Aspire will automatically tear down the application when you exit the CLI process.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ jobs:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
uses: actions/checkout@v10.0.0-fake
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6.0.0
uses: actions/setup-dotnet@v10.0.0-fake
with:
global-json-file: global.json
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
if: matrix.name == 'Windows'
uses: actions/upload-artifact@v7.0.1
uses: actions/upload-artifact@v10.0.0-fake
with:
name: NuGet packages
path: nugets/
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
uses: actions/checkout@v10.0.0-fake
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6.0.0
uses: actions/setup-dotnet@v10.0.0-fake
with:
global-json-file: global.json
- name: Build
Expand All @@ -31,7 +31,7 @@ jobs:
client-secret: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }}
certificate-name: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }}
- name: Publish artifacts
uses: actions/upload-artifact@v7.0.1
uses: actions/upload-artifact@v10.0.0-fake
with:
name: nugets
path: nugets/*
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "10.0.100",
"allowPrerelease": false,
"version": "11.0.100",
"allowPrerelease": true,
"rollForward": "latestFeature"
}
}
1 change: 1 addition & 0 deletions src/Custom.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<MinVerMinimumMajorMinor>2.0</MinVerMinimumMajorMinor>
<MinVerAutoIncrement>minor</MinVerAutoIncrement>
<LangVersion>preview</LangVersion>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBusTests.snk</AssemblyOriginatorKeyFile>
Expand Down
8 changes: 4 additions & 4 deletions src/NServiceBus.ClaimCheck/NServiceBus.ClaimCheck.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net11.0</TargetFramework>
<ImplicitUsings>whatever</ImplicitUsings>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="10.2.7" />
<PackageReference Include="Particular.Packaging" Version="4.5.0" PrivateAssets="All" />
<PackageReference Include="NServiceBus" Version="11.0.0" />
<PackageReference Include="Particular.Packaging" Version="5.0.0" PrivateAssets="All" />

</ItemGroup>

Expand Down
Loading