Skip to content
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

AzureDevOpsDsc: Fixing non-terminating, integration test errors within AzureDevOpsProject resource #20

Conversation

SphenicPaul
Copy link
Contributor

@SphenicPaul SphenicPaul commented Jan 25, 2021

Pull Request (PR) description

Updated the integration tests to remove non-terminating errors in AzDevOpsProject, resource tests when Test-DscConfiguration is called:

  • Added -ErrorAction Stop to the Test-DscConfiguration function calls (within the tests) and updated exceptions thrown to make use of New-InvalidOperationException.
  • Wrapped possibly exceptions to ensure Test() function within AzDevOpsDscResourceBase class so it always returns a $true or $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

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation updated in the resource's README.md.
  • Resource parameter descriptions updated in schema.mof.
  • Comment-based help updated, including parameter descriptions.
  • Localization strings updated.
  • Examples updated.
  • Unit tests updated. See DSC Community Testing Guidelines.
  • Integration tests updated (where possible). See DSC Community Testing Guidelines.
  • Code changes adheres to DSC Community Style Guidelines.

This change is Reviewable

@SphenicPaul SphenicPaul marked this pull request as ready for review January 25, 2021 19:44
@johlju johlju self-requested a review January 25, 2021 20:22
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@johlju johlju added the waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. label Jan 25, 2021
Copy link
Contributor Author

@SphenicPaul SphenicPaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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…
break

We 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]::Error

We 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.
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: 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.

@johlju johlju merged commit dee4e97 into dsccommunity:main Jan 26, 2021
@johlju
Copy link
Member

johlju commented Jan 26, 2021

Ignore the comment above. I reviewed an older revision.

@johlju
Copy link
Member

johlju commented Jan 26, 2021

@SphenicPaul Awesome work on this. I will push the changes to the temp branch, and see if we can enable the integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AzDevOpsProject: Integration tests fail with non-terminating error
2 participants