Closed johlju closed 3 years ago
@SphenicPaul do you know that is going on here? 🤔
I have a branch here that enable the integration tests https://github.com/dsccommunity/AzureDevOpsDsc/tree/f/enable-integration-tests. Will merge into main once the integration tests does not fail.
@johlju - There are a few resources that do not have any Azure DevOps API support for updating the resource in particular ways (e.g. updating a Project resource from using Git
to Tfvc
as the SourceControlType
) however, the properties are still needed for initial creation of the resource so still need to be properties on the resource (but these wouldn't likely change post-creation).
The error/exception is thrown if the specific operation is invalid - e.g. The 'AzDevOpsProject', DSC Resource does not support changes for/to the 'SourceControlType' property.
shown in DSC output you highlighted.
I'm not clear why it's not being trapped/caught at present, but I was pondering (during development) about making use of New-InvalidOperationException
(from DscResource.Common
) and the localization items/strings in a similar way to the SqlServerDsc
module uses these ... this would provide consistency across modules and might output this slightly differently.
I'll try and take a look at this although it might be later in the week or next weekend - I need to trace through the code execution path again as there are a few base and inherited classes and functions. I'm not initially sure why the Get-DscConfiguration
would run through the GetDscRequiredAction()
function in the AzDevOpsDscResourceBase
, base class that throws the exception that's failing to be caught. ... why it's not being caught is another question I'd hope to answer first.
Using New-InvalidOperationException
souldrottningen be great, those functions are meant to be used for resources in several modules. It should catch an error if the resource throws an error. In this case maybe there is a cmdlet that needs -ErrorAction ’Stop’
for it to throw an exception (default might be Continue
).
@johlju - I got to the bottom of this and should be resolved with PR #20.
I've run the integration tests in my own area/organization and these have run through without the same non-terminating error as before. Not sure if you want to merge this into main
and confirm that it now runs/looks OK. I'll add another issue for use of the localization strings (which ties into #19 a little also).
It's probably worth focusing on #9 next (getting integration build into the pipeline) as these PRs will become a little convoluted/difficult switching the build config in and out when contributing.
When running the integration tests some tests fail with non-terminating error make Pester think the test passed thus not failing the pipeline.
https://dev.azure.com/dsccommunity/AzureDevOpsDsc/_build/results?buildId=3711&view=logs&j=893fd6d3-ee14-5383-e15d-24a2acc7f145&t=417fa350-1299-5d83-5f55-4c06f3da5c2a