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

All functions should return values for Pester integration #12

Closed
krjhitch opened this issue Mar 4, 2017 · 3 comments
Closed

All functions should return values for Pester integration #12

krjhitch opened this issue Mar 4, 2017 · 3 comments

Comments

@krjhitch
Copy link
Contributor

krjhitch commented Mar 4, 2017

No description provided.

@krjhitch
Copy link
Contributor Author

krjhitch commented Mar 5, 2017

Pester as a framework seems to be limited to a) not handling non-function/cmdlet code, and not handling anything called in the runspaces

@krjhitch krjhitch closed this as completed Mar 5, 2017
@rkyttle
Copy link
Member

rkyttle commented Mar 5, 2017

How come I was able to get things to work just using write-host?

@krjhitch
Copy link
Contributor Author

krjhitch commented Mar 5, 2017

I didn't find any issue with starting/testing the main function, but to test the logic - things like 'if I pass in 2 CIM objects, I want Test-DSCConfiguration to be called twice' I can't test, since those runspaces are hidden from the pipeline (and therefore pester). Additionally, since I can't mock Test-DSCConfiguration I re-direct it to run synthetically (and test for success/failure scenarios).

The big key is going to be the integration testing, which hopefully we can test in appveyor, or if not, we work on a script that looks similar to the following:

Set-Location $env:temp
Import-Module -Path .\DSCEA.psm1
SampleConfig.ps1 (generate localhost.mof)
Start-DSCEAScan -ComputerName 'localhost'
Start-DSCEAScan -ComputerName 'localhost','expectedServer1'
Get-DSCEAReport -Overall
Get-DSCEAReport -Compliance
$results = (Import-XMLCLI).TestForNoExceptionsSomehow()

As long as we write everything to a temp directory and/or clean up with each run, that'll be useful, but I'm not sure how much good pester itself is going to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants