AzureDevOpsDsc: Fixing non-terminating, integration test errors within AzureDevOpsProject resource#20
Conversation
…psProject' integration tests.
…sDscResourceBase' class. Also used 'New-InvalidOperationException' when exceptions thrown.
…od when throwing exceptions.
johlju
left a comment
There was a problem hiding this comment.
Great work! 🙂 Tiny comments.
Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @SphenicPaul)
source/Classes/003.AzDevOpsDscResourceBase.ps1, line 151 at r1 (raw file):
break
We don't need this here since it never gets that far?
source/Classes/003.AzDevOpsDscResourceBase.ps1, line 198 at r1 (raw file):
return [RequiredAction]::Error
We don't need this here since it never gets that far?
… from `AzDevOpsDscResourceBase` class.
…in 'AzDevOpsProject', integration tests.
…s 'False' (and not 'False' or $null)
SphenicPaul
left a comment
There was a problem hiding this comment.
I've updated a couple of other items I'd noticed - I'd missed specifying the ErrorAction parameter on one of the test assertions and I've updated a couple of others to ensure 'False' is returned rather than 'False' or $null.
I've rerun these locally against my own, test, AzureDevOps instance and all these pass - Hopefully should be good go go now.
Reviewable status: 3 of 5 files reviewed, 2 unresolved discussions (waiting on @johlju)
source/Classes/003.AzDevOpsDscResourceBase.ps1, line 151 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
breakWe don't need this here since it never gets that far?
Done.
source/Classes/003.AzDevOpsDscResourceBase.ps1, line 198 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
return [RequiredAction]::ErrorWe don't need this here since it never gets that far?
Done.
…e class to, instead, make use of function to obtain resource name from the inheriting, class/resource.
johlju
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @SphenicPaul)
tests/Integration/DSCClassResources/AzDevOpsProject.Integration.Tests.ps1, line 205 at r1 (raw file):
Test-DscConfiguration -Verbose -ErrorAction Stop | Should -BeIn @('False',$null)
This should never be able to be anything other than 'True' or 'False', otherwise something else is wrong. Let's add an issue to track this. I can fix that.
|
Ignore the comment above. I reviewed an older revision. |
|
@SphenicPaul Awesome work on this. I will push the changes to the temp branch, and see if we can enable the integration tests. |
Pull Request (PR) description
Updated the integration tests to remove non-terminating errors in
AzDevOpsProject, resource tests whenTest-DscConfigurationis called:-ErrorAction Stopto theTest-DscConfigurationfunction calls (within the tests) and updated exceptions thrown to make use ofNew-InvalidOperationException.Test()function withinAzDevOpsDscResourceBaseclass so it always returns a$trueor$false(and doesn't throw any exception).Additionally, updated 'CONTRIBUTING.md' to add additional environment variable to PowerShell script to enable local execution of integration tests and added link to creating PAT within Azure DevOps.
This Pull Request (PR) fixes the following issues
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
This change is