Skip to content

Fix Write-Host/ConvertTo-Json pipeline bug, add Get-NFSDatastoreNConnectValue function and test coverage#405

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-comments-review-390
Draft

Fix Write-Host/ConvertTo-Json pipeline bug, add Get-NFSDatastoreNConnectValue function and test coverage#405
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-comments-review-390

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 30, 2026

Addresses review feedback from PR #390: fixes a broken Write-Host pipeline pattern, adds the Get-NFSDatastoreNConnectValue AVS Run Command function, and introduces comprehensive Pester test coverage.

The changes in this PR are as follows:

  • Bug fixWrite-Host $NamedOutputs | ConvertTo-Json never emitted JSON because Write-Host doesn't write to the pipeline. Fixed to Write-Host ($NamedOutputs | ConvertTo-Json -Depth 10).
  • New function Get-NFSDatastoreNConnectValue in Microsoft.AVS.NFS.psm1 — queries NFS nConnect (TCP connection count) for a given datastore across all connected hosts in a cluster; skips disconnected/maintenance hosts with a warning; sets $global:NamedOutputs keyed by host name.
  • Module exportGet-NFSDatastoreNConnectValue added to FunctionsToExport in Microsoft.AVS.NFS.psd1.
  • Tests (tests/Microsoft.AVS.NFS.Tests.ps1) — 26 Pester tests covering: module load/export verification, parameter validation, cluster/datastore/type/host error paths, disconnected-host handling, happy path (connected hosts populate NamedOutputs, disconnected hosts skipped, Get-EsxCli called exactly twice), and AVSAttribute assertions (timeout, UpdatesSDDC, AutomationOnly) for all three exported functions.

I have read the contributor guidelines and have completed the following:

  • Formatted the code using VSCode default formatter for PowerShell.
  • Tested the code end-to-end against an SDDC.
  • Documented the functions using standard PowerShell markup and applied AVSAttribute to newly exported functions.

…t fix, export in psd1, add tests with AVSAttribute and happy path coverage
Copilot AI changed the title [WIP] Fix code according to review comments Fix Write-Host/ConvertTo-Json pipeline bug, add Get-NFSDatastoreNConnectValue function and test coverage May 30, 2026
Copilot AI requested a review from Malika133 May 30, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants