Skip to content

Commit 427e1f6

Browse files
committed
add windows powershell tests to unit tests pipeline
1 parent 4e7f9e8 commit 427e1f6

2 files changed

Lines changed: 3 additions & 49 deletions

File tree

.github/workflows/run_unit_tests.yml

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -77,51 +77,4 @@ jobs:
7777
shell: pwsh
7878
run: |
7979
cd ${{ github.workspace }}
80-
81-
# Set up environment
82-
$testRoot = Join-Path $PWD.Path "test/unit-tests"
83-
$env:PSModulePath = "$testRoot;" + $env:PSModulePath
84-
85-
# Import test framework
86-
$frameworkPath = Join-Path $testRoot "test_framework.ps1"
87-
. $frameworkPath
88-
89-
# Import all test functions
90-
$functionsPath = Join-Path $testRoot "test_functions"
91-
Get-ChildItem $functionsPath -Filter "*.ps1" | ForEach-Object {
92-
Write-Host "Importing function: $($_.FullName)"
93-
. $_.FullName
94-
}
95-
96-
# Get list of available test functions
97-
$availableFunctions = (Get-ChildItem $functionsPath -Filter "*.ps1").BaseName
98-
Write-Host "Available test functions: $($availableFunctions -join ', ')"
99-
100-
# Find corresponding test files that have matching functions
101-
$testCasesPath = Join-Path $testRoot "test_cases"
102-
$validTestFiles = Get-ChildItem $testCasesPath -Filter "*.ps1" | Where-Object {
103-
$testName = $_.BaseName -replace "^Test-"
104-
$testName -in $availableFunctions -or
105-
$availableFunctions -contains "Get-$testName" -or
106-
$availableFunctions -contains "Is-$testName"
107-
}
108-
Write-Host "Valid test files to run: $($validTestFiles.BaseName -join ', ')"
109-
110-
# Configure Pester
111-
$config = New-PesterConfiguration
112-
$config.Run.Path = $validTestFiles.FullName
113-
$config.Output.Verbosity = "Detailed"
114-
$config.Run.PassThru = $true
115-
$config.TestResult.Enabled = $true
116-
$config.TestResult.OutputFormat = "NUnitXml"
117-
$config.TestResult.OutputPath = "test-results.xml"
118-
# Run all test files in test_cases directory
119-
$result = Invoke-Pester -Configuration $config
120-
121-
# Handle test results
122-
if ($result.Failed.Count -gt 0) {
123-
Write-Host "Tests failed: $($result.Failed.Count) of $($result.Total) tests failed"
124-
exit 1
125-
} else {
126-
Write-Host "All tests passed: $($result.Passed.Count) tests"
127-
}
80+
./test/unit-tests/test_main.ps1

test/unit-tests/test_main.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ $testFiles = @(
2222
"Test-IsSupportedCloudEnvironment.ps1",
2323
"Test-GetLogAnalyticsWorkspaceDomain.ps1",
2424
"Test-GetMcsEndpoint.ps1",
25-
"Test-GetMcsGlobalEndpoint.ps1"
25+
"Test-GetMcsGlobalEndpoint.ps1",
26+
"Test-IsCanaryRegion.ps1"
2627
)
2728

2829
foreach ($testFile in $testFiles) {

0 commit comments

Comments
 (0)