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

Treatment of results from separate check repo locations #600

Open
LowlyDBA opened this Issue Feb 13, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@LowlyDBA
Copy link
Contributor

LowlyDBA commented Feb 13, 2019

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:

Invoke-DbcCheck -SqlInstance $Servers -Check $checks -PassThru -OutputFormat NUnitXml | Update-DbcPowerBiDataSource -Path $destPath -FileName $FileName

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

@SQLDBAWithABeard

This comment has been minimized.

Copy link
Collaborator

SQLDBAWithABeard commented Feb 13, 2019

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 ?

@LowlyDBA

This comment has been minimized.

Copy link
Contributor Author

LowlyDBA commented Feb 13, 2019

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.

@SQLDBAWithABeard

This comment has been minimized.

Copy link
Collaborator

SQLDBAWithABeard commented Feb 14, 2019

OK I can reproduce

image

@SQLDBAWithABeard

This comment has been minimized.

Copy link
Collaborator

SQLDBAWithABeard commented Feb 14, 2019

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"
}

            }`

image

@SQLDBAWithABeard

This comment has been minimized.

Copy link
Collaborator

SQLDBAWithABeard commented Feb 14, 2019

I am happy for you to add this John if you want to ??

@SQLDBAWithABeard

This comment has been minimized.

Copy link
Collaborator

SQLDBAWithABeard commented Feb 18, 2019

Coded into next release

@LowlyDBA

This comment has been minimized.

Copy link
Contributor Author

LowlyDBA commented Feb 19, 2019

Thank you! Sorry I missed your reply from a few days back. 😨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.