test: add powershell module detection and execution tests#8373
test: add powershell module detection and execution tests#8373rubenfiszel merged 1 commit intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @rubenfiszel's task in 2m 40s —— View job Review of PR #8373: test: add powershell module detection and execution tests
Overall this is a solid test PR that adds good coverage for the PowerShell module loading fixes in #8370 and #8371. The tests are well-structured, clearly named, and cover the important edge cases. A few observations: Feedback1. Regression assertion in The assertion checking that assert!(
!after_marker.contains("Write-Output"),
"catch block should not output literal 'Write-Output' text, got: {result_str}"
);This is a minor nit — the current code is correct, just slightly less readable than it could be. 2. Missing test for module not in
#[tokio::test]
async fn test_check_module_not_in_dirs() {
let dirs = HashMap::new();
let (installed, versions) = check_module_installed(&dirs, "NonExistent", None).await.unwrap();
assert!(!installed);
assert!(versions.is_empty());
}3. Unit tests are clean and well-organized — The regex tests cover the important patterns (basic, indented, quoted, 4. 5. Integration tests add good e2e coverage — Testing param blocks with How to verify through the appThese are backend unit and integration tests, so they cannot be verified through the app UI. To verify: check out the branch and run |
Deploying windmill with
|
| Latest commit: |
b46dbeb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4b659009.windmill.pages.dev |
| Branch Preview URL: | https://test-powershell-module-loadi.windmill.pages.dev |
Summary
Adds test coverage for the PowerShell module loading fixes from #8370 and #8371.
18 unit tests in
pwsh_executor.rscovering:RE_POWERSHELL_IMPORTSregex: basic, indented (spaces/tabs), quoted names,-Nameflag,-RequiredVersion, commented-out importsget_module_versions(): empty dir, empty version subdir, valid versioned module, flat module with/without files, multiple versionscheck_module_installed(): empty dir returns false, valid module returns true, wrong version returns false2 new e2e integration tests in
tests/worker.rs:test_powershell_param_block_with_attributes: param block with[Parameter]attributes and typed paramstest_powershell_error_caught: verifies catch block outputs "An error occurred:" and the error message without leaking literal "Write-Output" textTest plan
cargo test -p windmill-worker pwsh_executor::tests— 18/18 passedcargo test --test worker test_powershell— 3/3 passed (including existingtest_powershell_job)🤖 Generated with Claude Code