-
Notifications
You must be signed in to change notification settings - Fork 141
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
ADKDSKey: Add Integration Tests #526
ADKDSKey: Add Integration Tests #526
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #526 +/- ##
===================================
Coverage 98% 98%
===================================
Files 23 23
Lines 3133 3133
Branches 10 10
===================================
Hits 3089 3089
Misses 34 34
Partials 10 10 |
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 1 of 1 files at r2.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @X-Guardian)
CHANGELOG.md, line 8 at r2 (raw file):
- Added Integration testing ([issue #358](https://github.com/PowerShell/ActiveDirectoryDsc/issues/358)). - Changes to ADKDSKey - Added Integration testing
We could add that is resolve this issue #351
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.
This works, just one minor issue.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @X-Guardian)
Tests/Integration/MSFT_ADKDSKey.config.ps1, line 31 at r2 (raw file):
Configuration MSFT_ADKDSKey_CreateKDSRootKeyInPast_Config
I got this error, probably due to my regional settings (Swedish). Can we easily fix this EffectiveTime
property in the $ConfigurationData
to use the correct formatting regardless of locale?
Context When using configuration MSFT_ADKDSKey_CreateKDSRootKeyInPast_Config
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500.
VERBOSE: [DC01]: LCM: [ Start Set ]
VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode.
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' =
Win32_OperatingSystem'.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a
domain controller. (KDSK0020)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] The parameter of 'Ensure' for the KDS Root Key with the effective date of '01/01/1999 13:00:00' is incorrect. Expected
'Present', actual 'Absent'. (KDSK0016)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] KDS Root Key with the effective date of '01/01/1999 13:00:00' is NOT in the desired state. (KDSK0014)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADKDSKey]Integration_Test] in 2.3150 seconds.
VERBOSE: [DC01]: LCM: [ Start Set ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' =
Win32_OperatingSystem'.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a
domain controller. (KDSK0020)
WARNING: [DC01]: [[ADKDSKey]Integration_Test] Effective date is in the past and the 'AllowUnsafeEffectiveTime' is set to Enabled. Adding KDS Root Key with the effective
date of '01/01/1999 13:00:00', overriding 10 hour safety measure for domain controller replication. (KDSK0004)
VERBOSE: [DC01]: LCM: [ End Set ] [[ADKDSKey]Integration_Test] in 1.5630 seconds.
VERBOSE: [DC01]: LCM: [ End Resource ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: LCM: [ End Set ]
VERBOSE: [DC01]: LCM: [ End Set ] in 4.6440 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 5 seconds
[+] Should compile and apply the MOF without throwing 5.33s
VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500.
VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode.
VERBOSE: [DC01]: LCM: [ Start Get ]
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' =
Win32_OperatingSystem'.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a
domain controller. (KDSK0020)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Found KDS Root Key with the effective date of '01/01/1999 13:00:00'. (KDSK0010)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieved the root domain distinguished name of 'DC=contoso,DC=com'. (KDSK0021)
VERBOSE: [DC01]: LCM: [ End Get ] [[ADKDSKey]Integration_Test] in 1.4850 seconds.
VERBOSE: [DC01]: LCM: [ End Get ] in 2.1670 seconds.
[+] Should be able to call Get-DscConfiguration without throwing 2.82s
[-] Should have set the resource and all the parameters should match 286ms
Expected strings to be the same, but they were different.
String lengths are both 19.
Strings differ at index 0.
Expected: '01/01/1999 13:00:00'
But was: '1999-01-01 13:00:00'
75: $resourceCurrentState.EffectiveTime | Should -Be $ConfigurationData.AllNodes.EffectiveTime
at <ScriptBlock>, C:\source\ActiveDirectoryDsc\Tests\Integration\MSFT_ADKDSKey.Integration.Tests.ps1: line 75
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500.
VERBOSE: [DC01]: LCM: [ Start Test ]
VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode.
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' =
Win32_OperatingSystem'.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a
domain controller. (KDSK0020)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Found KDS Root Key with the effective date of '01/01/1999 13:00:00'. (KDSK0010)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieved the root domain distinguished name of 'DC=contoso,DC=com'. (KDSK0021)
VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] KDS Root Key with the effective date of '01/01/1999 13:00:00' is in the desired state. (KDSK0015)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADKDSKey]Integration_Test] True in 0.8440 seconds.
VERBOSE: [DC01]: LCM: [ End Resource ] [[ADKDSKey]Integration_Test]
VERBOSE: [DC01]: LCM: [ End Test ] Completed processing test operation. The operation returned True.
VERBOSE: [DC01]: LCM: [ End Test ] in 1.5780 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.622 seconds
[+] Should return $true when Test-DscConfiguration is run 2.73s
a962867
to
a4cc7af
Compare
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: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @johlju)
CHANGELOG.md, line 8 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We could add that is resolve this issue #351
Done.
Tests/Integration/MSFT_ADKDSKey.config.ps1, line 31 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Configuration MSFT_ADKDSKey_CreateKDSRootKeyInPast_Config
I got this error, probably due to my regional settings (Swedish). Can we easily fix this
EffectiveTime
property in the$ConfigurationData
to use the correct formatting regardless of locale?Context When using configuration MSFT_ADKDSKey_CreateKDSRootKeyInPast_Config VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500. VERBOSE: [DC01]: LCM: [ Start Set ] VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode. VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: LCM: [ Start Test ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_OperatingSystem'. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a domain controller. (KDSK0020) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] The parameter of 'Ensure' for the KDS Root Key with the effective date of '01/01/1999 13:00:00' is incorrect. Expected 'Present', actual 'Absent'. (KDSK0016) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] KDS Root Key with the effective date of '01/01/1999 13:00:00' is NOT in the desired state. (KDSK0014) VERBOSE: [DC01]: LCM: [ End Test ] [[ADKDSKey]Integration_Test] in 2.3150 seconds. VERBOSE: [DC01]: LCM: [ Start Set ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_OperatingSystem'. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a domain controller. (KDSK0020) WARNING: [DC01]: [[ADKDSKey]Integration_Test] Effective date is in the past and the 'AllowUnsafeEffectiveTime' is set to Enabled. Adding KDS Root Key with the effective date of '01/01/1999 13:00:00', overriding 10 hour safety measure for domain controller replication. (KDSK0004) VERBOSE: [DC01]: LCM: [ End Set ] [[ADKDSKey]Integration_Test] in 1.5630 seconds. VERBOSE: [DC01]: LCM: [ End Resource ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: LCM: [ End Set ] VERBOSE: [DC01]: LCM: [ End Set ] in 4.6440 seconds. VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 5 seconds [+] Should compile and apply the MOF without throwing 5.33s VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500. VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode. VERBOSE: [DC01]: LCM: [ Start Get ] VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_OperatingSystem'. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a domain controller. (KDSK0020) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Found KDS Root Key with the effective date of '01/01/1999 13:00:00'. (KDSK0010) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieved the root domain distinguished name of 'DC=contoso,DC=com'. (KDSK0021) VERBOSE: [DC01]: LCM: [ End Get ] [[ADKDSKey]Integration_Test] in 1.4850 seconds. VERBOSE: [DC01]: LCM: [ End Get ] in 2.1670 seconds. [+] Should be able to call Get-DscConfiguration without throwing 2.82s [-] Should have set the resource and all the parameters should match 286ms Expected strings to be the same, but they were different. String lengths are both 19. Strings differ at index 0. Expected: '01/01/1999 13:00:00' But was: '1999-01-01 13:00:00' 75: $resourceCurrentState.EffectiveTime | Should -Be $ConfigurationData.AllNodes.EffectiveTime at <ScriptBlock>, C:\source\ActiveDirectoryDsc\Tests\Integration\MSFT_ADKDSKey.Integration.Tests.ps1: line 75 VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-530133819-3181352061-503517500-500. VERBOSE: [DC01]: LCM: [ Start Test ] VERBOSE: [DC01]: [DSCEngine] Importing the module C:\source\ActiveDirectoryDsc\DscResources\MSFT_ADKDSKey\MSFT_ADKDSKey.psm1 in force mode. VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: LCM: [ Start Test ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Importing the module MSFT_ADKDSKey in force mode. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieving KDS Root Key with effective date of '01/01/1999 13:00:00'. (KDSK0001) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_OperatingSystem'. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Operation 'Enumerate CimInstances' complete. VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the user 'NT AUTHORITY\SYSTEM' has valid Domain Admin permissions. (KDSK0019) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Checking if the node 'DC01' is a Domain Controller. The node has a product type of '2'. If the product type is 2, then it is a domain controller. (KDSK0020) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Found KDS Root Key with the effective date of '01/01/1999 13:00:00'. (KDSK0010) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] Retrieved the root domain distinguished name of 'DC=contoso,DC=com'. (KDSK0021) VERBOSE: [DC01]: [[ADKDSKey]Integration_Test] KDS Root Key with the effective date of '01/01/1999 13:00:00' is in the desired state. (KDSK0015) VERBOSE: [DC01]: LCM: [ End Test ] [[ADKDSKey]Integration_Test] True in 0.8440 seconds. VERBOSE: [DC01]: LCM: [ End Resource ] [[ADKDSKey]Integration_Test] VERBOSE: [DC01]: LCM: [ End Test ] Completed processing test operation. The operation returned True. VERBOSE: [DC01]: LCM: [ End Test ] in 1.5780 seconds. VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 2.622 seconds [+] Should return $true when Test-DscConfiguration is run 2.73s
Ah, the delight of date-time processing! Try this updated version.
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.
Latest change worked perfectly! 😄
Reviewed 2 of 2 files at r3.
Reviewable status: complete! all files reviewed, all discussions resolved
@X-Guardian Awesome, one more issue squashed. 😃 |
- Changes to ADKDSKey - Added Integration testing (issue #351)
- Changes to ADKDSKey - Added Integration testing (issue dsccommunity#351)
Pull Request (PR) description
This PR adds integration tests for the
ADKDSKey
resource.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.
This change is