-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SystemLocale Resource - Fixes #50 #288
Conversation
Starting review. I see if I have time to finish, if not I will finish tomorrow. |
Oh it become far less to review now after a correct rebase 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 10 files at r1, 4 of 4 files at r2.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @PlagueHO)
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 3 at r1 (raw file):
Windows System Locale
Nitpick. Not sure, but should it be written 'Windows system locale'? Lower-case 's' and 'l'? 🤔 Upper-case suggest it is a name... is it?
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 5 at r1 (raw file):
Setting Windows System Locale updated.
Should is say 'Updated Windows System Locale'? Should it also say what it updated it too?
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 6 at r1 (raw file):
RestartRequiredMessage
Couldn't this verbose message be part of SystemLocaleUpdatedMessage
message? Concatenate those two? 🤔
Tests/Integration/MSFT_SystemLocale.Integration.Tests.ps1, line 48 at r1 (raw file):
Start-DscConfiguration `
Blank line before this one.
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 30 at r1 (raw file):
$localizedData = InModuleScope $script:DSCResourceName { $LocalizedData }
Maybe we should use InModuleScope for all tests?
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 33 at r1 (raw file):
Quoted 11 lines of code…
Describe 'Schema' { it 'IsSingleInstance should be mandatory with one value.' { $systemLocaleResource = Get-DscResource -Name SystemLocale $systemLocaleResource.Properties.Where{ $_.Name -eq 'IsSingleInstance' }.IsMandatory | Should -BeTrue $systemLocaleResource.Properties.Where{ $_.Name -eq 'IsSingleInstance' }.Values | Should -Be 'Yes' } }
Already tested with the test framework?
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 64 at r1 (raw file):
$systemLocale.SystemLocale = $testSystemLocale
Missing Should -Be
Codecov Report
@@ Coverage Diff @@
## dev #288 +/- ##
====================================
+ Coverage 88% 88% +<1%
====================================
Files 14 15 +1
Lines 1480 1520 +40
====================================
+ Hits 1304 1344 +40
Misses 176 176 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to go now. Thanks @johlju.
Reviewable status: 6 of 11 files reviewed, 7 unresolved discussions (waiting on @johlju)
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 3 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Windows System Locale
Nitpick. Not sure, but should it be written 'Windows system locale'? Lower-case 's' and 'l'? 🤔 Upper-case suggest it is a name... is it?
Done.
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 5 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Setting Windows System Locale updated.
Should is say 'Updated Windows System Locale'? Should it also say what it updated it too?
Done. And also updated it to include the actual system locale set.
DSCResources/MSFT_SystemLocale/en-US/MSFT_SystemLocale.strings.psd1, line 6 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
RestartRequiredMessage
Couldn't this verbose message be part of
SystemLocaleUpdatedMessage
message? Concatenate those two? 🤔
Done.
Tests/Integration/MSFT_SystemLocale.Integration.Tests.ps1, line 48 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Start-DscConfiguration `
Blank line before this one.
Done.
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 30 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$localizedData = InModuleScope $script:DSCResourceName { $LocalizedData }
Maybe we should use InModuleScope for all tests?
Done. There was a brief period where the PowerShell team were trying to get all testing out of the module scope. Ended up just being super painful. This must be a remnant of that.
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 33 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Describe 'Schema' { it 'IsSingleInstance should be mandatory with one value.' { $systemLocaleResource = Get-DscResource -Name SystemLocale $systemLocaleResource.Properties.Where{ $_.Name -eq 'IsSingleInstance' }.IsMandatory | Should -BeTrue $systemLocaleResource.Properties.Where{ $_.Name -eq 'IsSingleInstance' }.Values | Should -Be 'Yes' } }
Already tested with the test framework?
Yep. Not worth testing like this anyway.
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 64 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$systemLocale.SystemLocale = $testSystemLocale
Missing
Should -Be
Done.
Something really odd is going on here @johlju, @SSvilen: The Hash table checks are telling me there is hash table style violations, but I can't see any: https://ci.appveyor.com/project/PowerShell/computermanagementdsc/builds/28707989?fullLog=true All the tests pass locally. I've not noticed this before. Can either of you see anything wrong with the Hash tables that would cause this check to fail on AppVeyor but pass locally? I'm also seeing this in NetworkingDsc: https://ci.appveyor.com/project/PlagueHO/networkingdsc?fullLog=true#L1286 Are you seeing this on any of yours @johlju? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The back tick...I've assumed that a hashtable ends with \s*} (as regex).Should we consider the back tick as an edge case?
Reviewable status: 6 of 11 files reviewed, 7 unresolved discussions (waiting on @johlju)
@PlagueHO Using the preview extensions - nothing detected. Got back to official one - style violation was immediately shown and removing back tick resolves it. Side effect is also that the formatting does not work properly. VS Code insists on formatting the code like that: $convertToCimCredential = New-CimInstance `
-ClassName MSFT_Credential `
-Property @{
Username = [System.String] $Credential.UserName
Password = [System.String] $null
} `
-Namespace root/microsoft/windows/desiredstateconfiguration `
-ClientOnly
Should I do a quick fix about it? |
@SSvilen - the backtick issue would only explain a few of the violations (not many). Not sure what is causing the other ones. I don't think the back tick is a bad practice, unless it is not required. In this case if we didn't use it, the line would be very long. Admittedly, it would probably be better to create a parameter splat though. @johlju - what do you think? Allow the backtick? |
@SSvilen - It doesn't look like the .GitAttributes is going to fix the issue either. I suspect there is an issue with the regex and CR vs CRLF that will need to be addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm talking nonsense... The back tick is not in the extent at all.. The problem is indeed new line - the build agent of appveyor runs Server 2012 R2 and I believe that is may be causing this:
I manually cloned the repo on the appveyor box - still getting only LF.
I'll try to adjust the check today..
Reviewable status: 6 of 12 files reviewed, 7 unresolved discussions (waiting on @johlju)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the things funnier, the DSCResource test repo on appveyor box is formatted with CRLF:
Reviewable status: 6 of 12 files reviewed, 7 unresolved discussions (waiting on @johlju)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r5, 2 of 2 files at r6.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @PlagueHO)
CHANGELOG.md, line 26 at r6 (raw file):
- RemoveDesktopAdmin: - Correct Context messages in integration tests by adding 'When'.
Should this change be here, and not in the unreleased section? Also, maybe the resource name is misspelled? :)
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 32 at r6 (raw file):
-ModuleName 'MSFT_SystemLocale'
Since we are in module scope this parameter is not necessary? 🤔 Throughout if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is already there. :)
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @PlagueHO)
@johlju - should be good to go now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @PlagueHO)
CHANGELOG.md, line 26 at r6 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
- RemoveDesktopAdmin: - Correct Context messages in integration tests by adding 'When'.
Should this change be here, and not in the unreleased section? Also, maybe the resource name is misspelled? :)
This still looks off... 🤔
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 32 at r6 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
-ModuleName 'MSFT_SystemLocale'
Since we are in module scope this parameter is not necessary? 🤔 Throughout if so.
This should still not be necessary? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @johlju - should be good to go!
Reviewable status: 0 of 19 files reviewed, 2 unresolved discussions (waiting on @johlju)
CHANGELOG.md, line 26 at r6 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
This still looks off... 🤔
Good catch - sorry, missed this one. Fixed.
Tests/Unit/MSFT_SystemLocale.Tests.ps1, line 32 at r6 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
This should still not be necessary? 🤔
Missed this. Fixed.
Hi @johlju - I've squash rebased this to clean up the commits and resolve conflicts. So hopefully good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r7.
Reviewable status: complete! all files reviewed, all discussions resolved
Pull Request (PR) description
This PR migrates SystemLocale from SystemLocaleDsc.
This Pull Request (PR) fixes the following issues
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
@johlju - would you mind reviewing this one?
This change is