From 12ec2d9e4404931ffd7f537b151264cd0d59790c Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 10:13:16 +0100 Subject: [PATCH 1/8] feat: Add Aspire AppHost testing. --- .github/workflows/main.yml | 44 ++++++++++++++++++- {Aspire => DistHaul}/.gitignore | 0 .../DistHaul.AppHost/DistHaul.AppHost.csproj | 2 + .../DistHaul.AppHost}/Program.cs | 0 .../Properties/launchSettings.json | 0 DistHaul/DistHaul.Tests/DistHaul.Tests.csproj | 34 ++++++++++++++ DistHaul/DistHaul.Tests/UnitTest1.cs | 10 +++++ DistHaul/DistHaul.Tests/xunit.runner.json | 3 ++ {Aspire => DistHaul}/DistHaul.sln | 16 ++++++- aspire.config.json | 2 +- global.json | 5 +++ 11 files changed, 112 insertions(+), 4 deletions(-) rename {Aspire => DistHaul}/.gitignore (100%) rename Aspire/AppHost/AppHost.csproj => DistHaul/DistHaul.AppHost/DistHaul.AppHost.csproj (83%) rename {Aspire/AppHost => DistHaul/DistHaul.AppHost}/Program.cs (100%) rename {Aspire/AppHost => DistHaul/DistHaul.AppHost}/Properties/launchSettings.json (100%) create mode 100644 DistHaul/DistHaul.Tests/DistHaul.Tests.csproj create mode 100644 DistHaul/DistHaul.Tests/UnitTest1.cs create mode 100644 DistHaul/DistHaul.Tests/xunit.runner.json rename {Aspire => DistHaul}/DistHaul.sln (55%) create mode 100644 global.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ace34f4..fe18be0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,8 @@ name: CI/CD on: + pull_request: + branches: [main] push: branches: [main] @@ -159,6 +161,44 @@ jobs: contents: read steps: - - name: All checks passed - run: echo "All resource checks passed. E2E integration tests will be added here." + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + with: + toolchain: stable + targets: wasm32-unknown-unknown + + - name: Install cargo-binstall + uses: cargo-bins/cargo-binstall@0b24824336e2b3800b0f89d9e08b2c08bfa3dcdd # v1.17.9 + + - name: Install tools + run: cargo binstall -y trunk wasm-bindgen-cli + shell: bash + + - name: Cache Rust compilation + uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + with: + workspaces: | + client-management -> target + ui -> target + cache-on-failure: true + + - name: Setup .NET + uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 + with: + dotnet-version: 10.x + + - name: Restore Aspire AppHost Dependencies + run: dotnet restore DistHaul.sln + shell: bash + working-directory: DistHaul + + - name: Build Aspire AppHost + run: dotnet build DistHaul.sln --confiugration Release --no-restore + + - name: Execute Aspire AppHost Tests + run: dotnet test --solution .\DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory .\TestResults --coverage --coverage-output-format cobertura shell: bash + working-directory: DistHaul diff --git a/Aspire/.gitignore b/DistHaul/.gitignore similarity index 100% rename from Aspire/.gitignore rename to DistHaul/.gitignore diff --git a/Aspire/AppHost/AppHost.csproj b/DistHaul/DistHaul.AppHost/DistHaul.AppHost.csproj similarity index 83% rename from Aspire/AppHost/AppHost.csproj rename to DistHaul/DistHaul.AppHost/DistHaul.AppHost.csproj index 5eb338e..9dcec81 100644 --- a/Aspire/AppHost/AppHost.csproj +++ b/DistHaul/DistHaul.AppHost/DistHaul.AppHost.csproj @@ -6,6 +6,7 @@ enable enable true + true $(NoWarn);ASPIRECERTIFICATES001 @@ -14,6 +15,7 @@ + diff --git a/Aspire/AppHost/Program.cs b/DistHaul/DistHaul.AppHost/Program.cs similarity index 100% rename from Aspire/AppHost/Program.cs rename to DistHaul/DistHaul.AppHost/Program.cs diff --git a/Aspire/AppHost/Properties/launchSettings.json b/DistHaul/DistHaul.AppHost/Properties/launchSettings.json similarity index 100% rename from Aspire/AppHost/Properties/launchSettings.json rename to DistHaul/DistHaul.AppHost/Properties/launchSettings.json diff --git a/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj new file mode 100644 index 0000000..5139eb3 --- /dev/null +++ b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj @@ -0,0 +1,34 @@ + + + + enable + enable + Exe + DistHaul.Tests + net10.0 + true + true + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + diff --git a/DistHaul/DistHaul.Tests/UnitTest1.cs b/DistHaul/DistHaul.Tests/UnitTest1.cs new file mode 100644 index 0000000..d3b206d --- /dev/null +++ b/DistHaul/DistHaul.Tests/UnitTest1.cs @@ -0,0 +1,10 @@ +namespace DistHaul.Tests; + +public class UnitTest1 +{ + [Fact] + public void Test1() + { + Assert.True(true); + } +} diff --git a/DistHaul/DistHaul.Tests/xunit.runner.json b/DistHaul/DistHaul.Tests/xunit.runner.json new file mode 100644 index 0000000..249d815 --- /dev/null +++ b/DistHaul/DistHaul.Tests/xunit.runner.json @@ -0,0 +1,3 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json" +} diff --git a/Aspire/DistHaul.sln b/DistHaul/DistHaul.sln similarity index 55% rename from Aspire/DistHaul.sln rename to DistHaul/DistHaul.sln index fac19db..9c839a3 100644 --- a/Aspire/DistHaul.sln +++ b/DistHaul/DistHaul.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppHost", "AppHost\AppHost.csproj", "{5DA93E71-D203-44FF-9924-9FAE6497E935}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistHaul.AppHost", "DistHaul.AppHost\DistHaul.AppHost.csproj", "{5DA93E71-D203-44FF-9924-9FAE6497E935}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistHaul.Tests", "DistHaul.Tests\DistHaul.Tests.csproj", "{9B2CE424-D97E-4716-BE57-870DFC1B92B3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,18 @@ Global {5DA93E71-D203-44FF-9924-9FAE6497E935}.Release|x64.Build.0 = Release|Any CPU {5DA93E71-D203-44FF-9924-9FAE6497E935}.Release|x86.ActiveCfg = Release|Any CPU {5DA93E71-D203-44FF-9924-9FAE6497E935}.Release|x86.Build.0 = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|x64.ActiveCfg = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|x64.Build.0 = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Debug|x86.Build.0 = Debug|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|Any CPU.Build.0 = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|x64.ActiveCfg = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|x64.Build.0 = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|x86.ActiveCfg = Release|Any CPU + {9B2CE424-D97E-4716-BE57-870DFC1B92B3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/aspire.config.json b/aspire.config.json index fba0fa7..3a4ccbb 100644 --- a/aspire.config.json +++ b/aspire.config.json @@ -1,5 +1,5 @@ { "appHost": { - "path": "Aspire/AppHost/AppHost.csproj" + "path": "DistHaul/DistHaul.AppHost/DistHaul.AppHost.csproj" } } diff --git a/global.json b/global.json new file mode 100644 index 0000000..802ab21 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} \ No newline at end of file From 5a02d426d9edb0dbd4a28502b58a84ed04f808ae Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 10:16:31 +0100 Subject: [PATCH 2/8] fix: execute cargo fmt --- client-management/api/src/main.rs | 4 ++-- client-management/api/src/telemetry.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client-management/api/src/main.rs b/client-management/api/src/main.rs index 4154c49..8a81d97 100644 --- a/client-management/api/src/main.rs +++ b/client-management/api/src/main.rs @@ -24,8 +24,8 @@ async fn main() -> Result<()> { let settings = Settings::load().context("Failed to load configuration")?; - let telemetry_guard = telemetry::init_telemetry(&settings.tls) - .context("Failed to initialise telemetry")?; + let telemetry_guard = + telemetry::init_telemetry(&settings.tls).context("Failed to initialise telemetry")?; let app = Router::new() .route("/health", get(routes::health)) diff --git a/client-management/api/src/telemetry.rs b/client-management/api/src/telemetry.rs index 7b2b5eb..f2367ab 100644 --- a/client-management/api/src/telemetry.rs +++ b/client-management/api/src/telemetry.rs @@ -136,8 +136,12 @@ pub fn init_telemetry(tls_settings: &TlsSettings) -> Result { /// trusted CA root allows tonic/rustls to complete the TLS handshake with the /// Aspire dashboard's gRPC OTLP endpoint. fn build_tls_config(tls_settings: &TlsSettings) -> Result { - let pem = std::fs::read(Path::new(&tls_settings.certificate_path)) - .with_context(|| format!("Failed to read TLS certificate from {}", tls_settings.certificate_path))?; + let pem = std::fs::read(Path::new(&tls_settings.certificate_path)).with_context(|| { + format!( + "Failed to read TLS certificate from {}", + tls_settings.certificate_path + ) + })?; let tls_config = ClientTlsConfig::new().ca_certificate(Certificate::from_pem(pem)); From 16ad5dbd5b468dda0c1a341f5e321e81fe220ccc Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 10:22:28 +0100 Subject: [PATCH 3/8] fix: correct typo in dotnet comamnd --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe18be0..a240789 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -196,7 +196,7 @@ jobs: working-directory: DistHaul - name: Build Aspire AppHost - run: dotnet build DistHaul.sln --confiugration Release --no-restore + run: dotnet build DistHaul.sln --configuration Release --no-restore - name: Execute Aspire AppHost Tests run: dotnet test --solution .\DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory .\TestResults --coverage --coverage-output-format cobertura From 9ab107f95ace2ef21296c09b854dfa9996fd4706 Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 10:26:57 +0100 Subject: [PATCH 4/8] fix: supply working-directory and shell type --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a240789..51adfed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -197,6 +197,8 @@ jobs: - name: Build Aspire AppHost run: dotnet build DistHaul.sln --configuration Release --no-restore + shell: bash + working-directory: DistHaul - name: Execute Aspire AppHost Tests run: dotnet test --solution .\DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory .\TestResults --coverage --coverage-output-format cobertura From 9870c628618fc64e54530bbc66688c6bb645e015 Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 11:51:55 +0100 Subject: [PATCH 5/8] fix: correct the slash --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51adfed..1ed87a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -201,6 +201,6 @@ jobs: working-directory: DistHaul - name: Execute Aspire AppHost Tests - run: dotnet test --solution .\DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory .\TestResults --coverage --coverage-output-format cobertura + run: dotnet test --solution DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory ./TestResults --coverage --coverage-output-format cobertura shell: bash working-directory: DistHaul From 4005d7411bd78790a019856827deab6332c0428a Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 16:38:39 +0100 Subject: [PATCH 6/8] fix: Add Microsoft.Testing.Extensions.CodeCoverage nuget package. --- DistHaul/DistHaul.Tests/DistHaul.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj index 5139eb3..1547849 100644 --- a/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj +++ b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj @@ -12,6 +12,7 @@ + all From 2dcbd8dc769f52c323539c0b36743cbf0dd43150 Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Sun, 12 Apr 2026 19:05:58 +0100 Subject: [PATCH 7/8] fix: indentation. --- DistHaul/DistHaul.Tests/DistHaul.Tests.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj index 1547849..728809f 100644 --- a/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj +++ b/DistHaul/DistHaul.Tests/DistHaul.Tests.csproj @@ -28,8 +28,8 @@ - - - + + + From cc94c5100b5bb6115241179c41b8bab743534430 Mon Sep 17 00:00:00 2001 From: Stephen Newman Date: Tue, 14 Apr 2026 13:15:41 +0100 Subject: [PATCH 8/8] feat: Upload Aspire Code Coverage Report Not sure how useful this is tbh, but let's see where is takes us. --- .github/workflows/main.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1ed87a4..257ac38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -201,6 +201,24 @@ jobs: working-directory: DistHaul - name: Execute Aspire AppHost Tests + id: test run: dotnet test --solution DistHaul.sln --configuration Release --no-build --verbosity normal --results-directory ./TestResults --coverage --coverage-output-format cobertura shell: bash working-directory: DistHaul + + - name: Code Coverage Report + run: | + dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.5.4 + reportgenerator -reports:TestResults/**.cobertura.xml -targetdir:coveragereport -reporttypes:Html "-filefilters:-*.g.cs" -verbosity:Warning + cd coveragereport + zip -r ../code-coverage-report.zip . + shell: bash + working-directory: DistHaul + + - name: Archive Test Report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1 + if: ${{ steps.test.conclusion == 'success' && always()}} + with: + name: aspire-code-coverage-report + path: ./DistHaul/coveragereport/ + retention-days: 7 \ No newline at end of file