Repository navigation
test(logs): build the event table before the test that reads it - #80
Merged
Merged
Conversation
The test "resolves a message two patterns fit to the earlier one in the table" read $script:IslAgentLogEvents from module scope before it called Get-IslAgentLogEvent, which builds the table on its first call. The test file imports the module with -Force, so whenever the shuffled order ran this test first in the file the table was $null and the test failed with "You cannot call a method on a null-valued expression". It did so in a full run under shuffle seed 1788100338. The test now makes one call first, as the neighbouring test of the compiled table already does. Closes #78
fadwen
commented
Nov 22, 2026
fadwen
left a comment
Owner
Author
There was a problem hiding this comment.
Verdict: approve. Verified in a Linux sandbox with pwsh 7.6.0 and Pester 6.2.0.
This was referenced Nov 23, 2026
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
One test of
Get-IslAgentLogEventpassed only when another test had run before it in the same file, so it failed whenever the shuffled order of the CI run put it first. The test now builds the event table before it reads it. Closes #78.Changes
Tests/Unit/Private/Get-IslAgentLogEvent.Tests.ps1: "resolves a message two patterns fit to the earlier one in the table" callsGet-IslAgentLogEventonce before it reads$script:IslAgentLogEventsfrom module scope. The function builds that table on its first call, and the neighbouring test of the compiled table already makes the same call for the same reason.CHANGELOG.md: an entry under Fixed.Verification
Run on Windows 11 26H2 with PowerShell 7.6.10 and Windows PowerShell 5.1.26100.
Filter.FullName = '*resolves a message two patterns fit*': failed before the change withYou cannot call a method on a null-valued expression, and passes after it, on both PowerShell versions.Notes
fix/release-script-standards.Get-IntuneAgentLogcallsGet-IslAgentLogEvent -Message ''before it reads the table.$script:RuleOrder, which the root module sets when it is imported.