Skip to content

Commit afa28ab

Browse files
committed
test(gsd-orchestrator): track test suite; ignore TestResults; update ci
- Add tests/Orchestrator.Tests.ps1 (Pester): smoke-tests every exported function of the GsdOrchestrator PowerShell module by invoking each and asserting it does not throw. - Ignore **/TestResults/ (covers both the root TestResults/ dir and the nested src/GsdOrchestrator.Tests/TestResults/ produced by dotnet test --collect coverage) — these are generated run artifacts, not source. - Update .github/workflows/ci.yml to enforce 100% line coverage after the test step: parses TestResults/**/coverage.cobertura.xml and fails the job if line-rate < 1.0.
1 parent 347e729 commit afa28ab

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ jobs:
4242
- name: Test
4343
run: dotnet test src/GsdOrchestrator.Tests/GsdOrchestrator.Tests.csproj --configuration Release --logger trx --no-build --collect:"XPlat Code Coverage" --results-directory ./TestResults
4444

45+
- name: Enforce 100% Coverage
46+
shell: pwsh
47+
run: |
48+
$file = Get-ChildItem -Path ./TestResults -Filter coverage.cobertura.xml -Recurse | Select-Object -First 1
49+
if (-not $file) {
50+
Write-Output '{"event": "ci_failure", "error": "Coverage file not found"}'
51+
exit 1
52+
}
53+
[xml]$xml = Get-Content $file.FullName
54+
$rate = [double]$xml.coverage.'line-rate'
55+
if ($rate -lt 1.0) {
56+
Write-Output "{`"event`": `"ci_failure`", `"coverage_percent`": $($rate * 100), `"required`": 100}"
57+
exit 1
58+
}
59+
4560
- name: Upload coverage
4661
uses: actions/upload-artifact@v4
4762
if: always()

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ obj/
1111
.vs/
1212
*.suo
1313

14+
# Test run output (coverage, trx) — generated, not source
15+
**/TestResults/
16+
1417
# NuGet
1518
*.nupkg
1619
packages/

tests/Orchestrator.Tests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Import-Module (Join-Path $PSScriptRoot '..\src\GsdOrchestrator')
2+
3+
Describe 'GsdOrchestrator Core Tests' {
4+
# Retrieve all public functions from the module
5+
$functions = Get-Command -Module GsdOrchestrator -CommandType Function
6+
foreach ($fn in $functions) {
7+
It "Function $($fn.Name) should be invocable without throwing" {
8+
{ & $fn.Name } | Should -Not -Throw
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)