Repository navigation
Storage Metrics phase 6: migrate to Pester 5 - #42
Merged
tjsullivan1 merged 1 commit intoOct 21, 2026
Merged
tjsullivan1 merged 1 commit into
tjsullivan1 merged 1 commit into
Conversation
Move fixture setup to BeforeAll, retain module-scoped offline mocks, and route UTC reads through an internal clock. Preserve all 190 original tests and add retry-date and polling-deadline coverage. Pin Pester 5.7.1 in CI and verification docs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bab1d34b-d8d8-4bd1-8a3a-5e44f606ee9d
There was a problem hiding this comment.
🟢 Approval recommended
The migration and clock substitutions preserve existing behavior, with no unresolved blocking findings; tests were not rerun during this review.
No open issues 🎉
What changed in this PR
Migrates StorageMetrics to Pester 5 after Phase 5’s module packaging, adding deterministic clock-based testing without changing the public API.
Changes:
- Migrates all six fixtures to Pester 5 assertions and runtime setup.
- Routes production UTC reads through private
Get-UtcNowand strengthens timing assertions. - Pins Pester 5.7.1 in CI and updates offline verification instructions.
| File | Description |
|---|---|
| PowerShell/StorageMetrics/tests/StorageMetrics.Module.Tests.ps1 | Migrates interface checks and verifies clock-helper privacy. |
| PowerShell/StorageMetrics/tests/Get-AzStorageWorkloadBaseline.Tests.ps1 | Migrates baseline tests with fixed dates. |
| PowerShell/StorageMetrics/tests/Get-AzStorageTransactionMetric.Tests.ps1 | Migrates transaction tests and adds HTTP-date retry coverage. |
| PowerShell/StorageMetrics/tests/Get-AzStorageRedundancyCost.Tests.ps1 | Migrates pricing tests and checks evidence timestamps. |
| PowerShell/StorageMetrics/tests/Get-AzStorageCostComparison.Tests.ps1 | Migrates billing tests and adds elapsed-deadline coverage. |
| PowerShell/StorageMetrics/tests/Get-AzStorageCapacity.Tests.ps1 | Migrates capacity tests and asserts exact sample ages. |
| PowerShell/StorageMetrics/StorageTransactionMetrics.md | Updates offline verification guidance. |
| PowerShell/StorageMetrics/Public/Get-AzStorageTransactionMetric.ps1 | Uses the private clock for validation and timestamps. |
| PowerShell/StorageMetrics/Public/Get-AzStorageRedundancyCost.ps1 | Uses the private clock for pricing timestamps. |
| PowerShell/StorageMetrics/Private/Invoke-StorageArmGet.ps1 | Uses the private clock for retry delays. |
| PowerShell/StorageMetrics/Private/Get-UtcNow.ps1 | Adds the mockable UTC clock helper. |
| PowerShell/StorageMetrics/Private/Get-StorageCapacityRecord.ps1 | Uses the private clock for sample ages. |
| PowerShell/StorageMetrics/Private/Get-LiveCostRows.ps1 | Uses the private clock for polling deadlines. |
| .github/workflows/storagemetrics-tests.yml | Pins Pester and enables CI failure reporting. |
Review effort: Balanced
tjsullivan1
merged commit Oct 21, 2026
45e0dfc
into
tjsullivan1-storage-metrics-phase-5
3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 6 only, stacked on #41 (
tjsullivan1-storage-metrics-phase-5, commit958caf2).BeforeAll, module-scoped mocks, parameterized assertions, andShould -Invokecall checks.Get-UtcNowand mock a fixed UTC instant. Cover exact capacity ages and evidence timestamps, HTTP-date retry delays, and elapsed report deadlines.-CIfor failing test/discovery exit status and NUnit output.The public commands, exports, null-versus-zero handling, caps/reconciliation, account buffering, saved Az contexts/explicit
-DefaultProfile, decimal handling, and signed-URL redaction are unchanged.Verification
-CI, 192 passed; zero failures, skipped tests, or discovery errors.git diff --check: clean. Direct system-clock access is confined toPrivate/Get-UtcNow.ps1.Standards
Reviewed independently against
.github/copilot-instructions.md, existing module patterns, and the code-smell baseline. The helper uses an approved verb, typed output, comment-based help, and the existing private-module layout. No new public API or runtime dependency. 0 remaining findings.Spec
Reviewed independently against the exact Phase 6 requirements. All six fixtures, CI, docs, and all nine production clock reads are migrated. Existing behavior names and coverage are preserved or increased. Changes to Phase 5 production code are limited to the required clock seam. 0 remaining findings.
Review totals: Standards 0; Spec 0. No outstanding issue on either axis.