Closed lowlydba closed 5 years ago
Hmm, I definitely have this working at a client with a custom check folder and am not seeing this behaviour. First gut feeling late at night is the filename parameter.
Also, the PowerBi takes results from multiple files and combines them into one PowerBI Report. What is the requirement for one XML file ?
Yeah, so with the filename specified it is overwriting that same file once it moves on to a second check folder.
I could run Invoke-DbcCheck one time for each of the test sets, each with a separate file name param, and load those into PowerBI, but that seems unnecessary when the majority of that can be done via one command like above.
OK I can reproduce
I think you are right, the best way is to add append to Update-DbcPowerBi command
` if ($PSCmdlet.ShouldProcess($FilePath, 'Passing results')) { if($Append){ $InputObject.TestResult | ConvertTo-Json -Depth 3 | Out-File -FilePath $FilePath -Append Write-PSFMessage -Level Output -Message "Appended results to $FilePath" } else{ $InputObject.TestResult | ConvertTo-Json -Depth 3 | Out-File -FilePath $FilePath Write-PSFMessage -Level Output -Message "Wrote results to $FilePath" }
}`
I am happy for you to add this John if you want to ??
Coded into next release
Thank you! Sorry I missed your reply from a few days back. 😨
Question
When running tests using the default repo and a user-defined repo that pipes out to generate a JSON file, the last repo's results will overwrite the previous repo checks' runs since they internally run as separate pester calls.
For example:
With checks in two repos will overwrite the packaged dbachecks file results with the user specified repo results file. Is this is the intended behavior? It could be coded around manually, but I'd most likely end up rolling my own
DbdPowerBiDataSource
to do it. My presumption was that this should be able to aggregate multiple repo check results into a single file.My lazy workaround for now is keeping my custom tests in the
checks
folder of the module itself.A quick solution might be to use an
-Append
parameter for the Update-Dbc function to allow for appending results. I'm happy to work on it