GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Improve test coverage for CDXML cmdlet infrastructure by JamesWTruher · Pull Request #4537 · PowerShell/PowerShell Conversation
Collaborator
address issue #4159 Create custom cim classes (via MOF) and cdxml cmdlets against the new cim class
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsIncludes MOF files to create and delete class and instances which are used by the tests updated create mof file to support associations as well as complex objects updated delete mof file to remove all classes added an enum to cdxml (not yet used) updated psd1 to export new cmdlets for set and new
James Truher (JamesWTruher)
requested review from
Aditya Patwardhan (adityapatwardhan) and
Dan Travison (dantraMSFT)
Aditya Patwardhan (adityapatwardhan)
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM with minor comments
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use ForEach-Object instead of %
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
| field2 = 0 | ||
| } | ||
| New-CimTest @instanceArgs | ||
| $result = Get-CimInstance -namespace root/default -class PSCore_Test1 | ?{$_.id -eq "telephone"} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use Where-Object instead of ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| $result.field2 | should be 33 | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Extra line.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390832" | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Remove extra lines.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| AliasesToExport = @() | ||
| CmdletsToExport = @() | ||
| FunctionsToExport = @( 'Get-CimTest', 'Remove-CimTest', 'New-CimTest', 'Set-CimTest' ) | ||
| HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390832" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? This probably points to something else.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
probably not - removed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Describe "Cdxml cmdlets are supported" -Tag CI,RequireAdminOnWindows { | ||
| BeforeAll { | ||
| $skipNotWindows = ! $IsWindows | ||
| if ( $skipNotWindows ) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why not use a direct $IsWindows test versus a variable?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I thought it was clearer here -skip (I've seen other tests do exactly the opposite of what was wanted)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| $result = MofComp.exe $deleteMof | ||
| if ( $LASTEXITCODE -ne 0 ) { | ||
| $script:ItSkipOrPending = @{ Pending = $true } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this an outright failure? It appears to be masking a bug.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I thought about this, and while it might be a bug in the mof file or a problem with mofcomp, marking a test as pending doesn't get us off the hook - all pending tests must be resolved before we ship (and I do track our pending tests). However, I didn't want to invalidate the build because I couldn't even get to the actual test. I thought it was better to mark the test as pending rather than fail.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| $job = Get-CimTest -id 3 | Remove-CimTest -asjob | ||
| $result = $null | ||
| $i = 0 | ||
| # wait up to 10 seconds, then the test will fail |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why isn't Wait-Job -Timeout sufficient?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ahem, yes, that's much better
-fixed-
Sorry, something went wrong.
There was an error while loading. Please reload this page.
If there is a problem with mofcomp execution, the tests will fail rather than being marked as pending (feedback from DanTra) use cmdlet names rather than aliases for foreach-object and where-object Script analyzer report is clean Also remove unneeded empty lines and helpinfouri from psd1 file
|
Dan Travison (@dantraMSFT), I believe this is ok now |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Dan Travison (@dantraMSFT) Can you please take another look at this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Create custom CIM classes (via MOF) and CDXML cmdlets against the new CIM class Create tests for CRUD operations for CDXML cmdlets Coverage for Microsoft.PowerShell.Cmdletization namespace is nearly 50%
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.