Closed DOliana closed 4 years ago
I've just published 9.1.16 that should have a fix in it for this. Can you let me know if you are still seeing this issue?
Thanks for the quick response! Please allow for some time since we are facing issues with out build system. If you like you can close this issue and I will come back if the issue is still there after we fix our systems.
Hello, we are getting errors as well during the package discovery phase. We just want to use the shipped version of Pester 4.10.1 Azure DevOps Server Version Dev17.M153.3
##[section]Starting: Pester Test Runner
==============================================================================
Task : Pester Test Runner
Description : Run Pester tests by either installing the latest version of Pester at run time (if possible) or using the version shipped with the task (4.10.1)
Version : 9.2.0
Author : Pester
Help : Version: #{Build.BuildNumber}#. [More Information](https://github.com/pester/AzureDevOpsExtension)
==============================================================================
Using executable 'powershell.exe'
powershell.exe E:\Agents\04\_work\_tasks\Pester_cca5462b-887d-4617-bf3f-dcf0d3c622e9\9.2.0\Pester.ps1 -scriptFolder @{Path='E:\Agents\04\_work\638\s/azuresql.template.tests.ps1'; Parameters=@{ResourceGroupName='***'; ServicePrincipalPassword='***'; SubscriptionId=***'; ApplicationId='***'; TenantId='***'; TemplatePath='E:\Agents\04\_work\638\s/'}} -resultsFile E:\Agents\04\_work\638\s/azuresql.template.tests.XML -run32Bit False
scriptFolder System.Collections.Hashtable
resultsFile E:\Agents\04\_work\638\s/azuresql.template.tests.XML
run32Bit False
additionalModulePath
tag
ExcludeTag
CodeCoverageOutputFile
CodeCoverageFolder
ScriptBlock
WARNING: MSG:UnableToDownload
«https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your
internet connection.
WARNING: Unable to resolve package source
'https://www.powershellgallery.com/api/v2'.
##[error]PackageManagement\Find-Package : No match was found for the specified search
criteria and module name 'Pester'. Try Get-PSRepository to see all available
##[error]PackageManagement\Find-Package : No match was found for the specified search
criteria and module name 'Pester'. Try Get-PSRepository to see all available
##[error]registered module repositories.
At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:8873 char:9
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPacka
ge:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.Pac
kageManagement.Cmdlets.FindPackage
##[error]registered module repositories.
At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:8873 char:9
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPacka
ge:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.Pac
kageManagement.Cmdlets.FindPackage
Running in AMD64 PowerShell
Running Pester using the script parameter [
Name Value
---- -----
Path E:\Agents\04\_work\638\s/azuresql.template.te...
Parameters {ServicePrincipalPassword, ApplicationId, Res...
] output sent to [E:\Agents\04\_work\638\s/azuresql.template.tests.XML]
Pester v4.10.1
Executing all tests in 'E:\Agents\04\_work\638\s/azuresql.template.tests.ps1'
Executing script E:\Agents\04\_work\638\s/azuresql.template.tests.ps1
Describing Template validation
[+] template passes validation check
2.68s
Tests completed in 5.3s
Tests Passed: 1,
Failed: 0,
Skipped: 0,
Pending: 0,
Inconclusive: 0
Pester Script finished
##[section]Finishing: Pester Test Runner
As you can see, we have 1 test and it passes, but the task fails with errors
Looks like the try/catch around those calls isn't handling everything. I'll see what I can do about fixing that at the weekend, or if you want to put in a PR to fix it then I can probably review that sooner.
As a temporary workaround, I have set "Continue on error" option on the Pester task, and set "Fail if there are test failures" option on the Publish Test Results task. This allows it to get through the rest of the pipeline (unless there are legitimate test failures), but the overall build status is "Successful with issues".
I'll take a look at the code and see if I may be able to put a PR in for a fix.
Where are you running it?
Version of Extension/Task
9.1.10
Expected behaviour and actual behaviour
Pester task runs without throwing errors even when it is not able to check for updates or find Pester installed locally - in my understanding it should use the builtin executable. Actual behaviour: The tests are run, but errors are thrown, which causes the task to fail even if all tests were successsful. Logs:
Steps to reproduce the problem
Have it run without throwing errors.