Skip to content

Commit 686baa1

Browse files
committed
Enhance performance of DSC resource integration tests by adding early source change check and update README with detailed flow diagram
1 parent 0d04093 commit 686baa1

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.build/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ resources and classes, then checks if any relevant files have been modified.
1818

1919
The script performs an optimized analysis by checking for changes in this order:
2020

21-
1. **Early Source Check**: First checks if any files under `source/` have changed
21+
1. **Early Source Check**: First checks if any files under the configured
22+
source path (`-SourcePath`, default `source/`) have changed
2223
- If no source changes, skips integration tests immediately
2324
1. **DSC Resources**: Files under `source/DSCResources/`
2425
1. **Classes**: Files under `source/Classes/`
@@ -42,7 +43,7 @@ flowchart TD
4243
GetChanges --> HasChanges{Any Changed<br/>Files?}
4344
HasChanges -->|No| RunTrue[Return TRUE<br/>Run integration tests]
4445
45-
HasChanges -->|Yes| CheckSource{Any Changes<br/>Under source/?}
46+
HasChanges -->|Yes| CheckSource{Any Changes<br/>Under SourcePath?}
4647
CheckSource -->|No| Skip[Return FALSE<br/>Skip integration tests]
4748
4849
CheckSource -->|Yes| Discover[Discover Public Commands<br/>Used by DSC Resources]

.build/Test-ShouldRunDscResourceIntegrationTests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ function Test-ShouldRunDscResourceIntegrationTests
460460
Write-Host ""
461461

462462
# Early optimization: Check if any changes are under the source folder
463-
$changedSourceFiles = $changedFiles | Where-Object -FilterScript { $_ -match '^source/' }
463+
$sourcePrefix = '^' + [regex]::Escape((($SourcePath -replace '\\','/') -replace '/+$','')) + '/'
464+
$changedSourceFiles = $changedFiles | Where-Object -FilterScript { $_ -match $sourcePrefix }
464465
if (-not $changedSourceFiles)
465466
{
466467
Write-Host "No changes detected under the source folder. DSC resource integration tests can be skipped."

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8080
all changes.
8181
- Bump actions/checkout task to v5.
8282
- `.build/Test-ShouldRunDscResourceIntegrationTests.ps1`
83-
- Improved performance by adding early optimization to check for changes
84-
under source folder before expensive analysis.
83+
- Improved performance by adding an early optimization to check for changes
84+
under the source folder before expensive analysis.
8585
- Moved public command discovery to only run when source changes are detected.
8686
- `.build/README.md`
8787
- Added flow diagram showing decision process for DSC resource integration tests.

0 commit comments

Comments
 (0)