AzureDevOpsExtension icon indicating copy to clipboard operation
AzureDevOpsExtension copied to clipboard

TestDrive cannot be used in Azure DevOps

Open emmanuelbenitez opened this issue 4 years ago • 4 comments

Where are you running it?

Azure DevOps Service (VSTS)

Version of Extension/Task

10.1.23

Expected behaviour and actual behaviour

Actual behaviour

When the tests are using the TestDrive, all test failed due to an error in the temp registry initialization

System.Exception: Was not able to create a Pester Registry key for TestRegistry 
System.Management.Automation.ValidationMetadataException: The " $_ | Test-Path -PathType Leaf " validation script for 
the argument with value "Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Pester" did not return a 
result of True. Determine why the validation script failed, and then try the command again.
   at System.Management.Automation.ValidateScriptAttribute.ValidateElement(Object element)
   at System.Management.Automation.ValidateEnumeratedArgumentsAttribute.Validate(Object arguments, EngineIntrinsics 
engineIntrinsics)
   at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, 
CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
At C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\Pester\5.0.2\Pester.psm1:7827 char:13
+             throw ([Exception]"Was not able to create a Pester Regist ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (System.Object[]:Object[]) [], RuntimeException
    + FullyQualifiedErrorId : System.Exception: Was not able to create a Pester Registry key for TestRegistry System.M 
   anagement.Automation.ValidationMetadataException: The " $_ | Test-Path -PathType Leaf " validation script for the   
  argument with value "Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Pester" did not return a resul   
 t of True. Determine why the validation script failed, and then try the command again.
   at System.Management.Automation.ValidateScriptAttribute.ValidateElement(Object element)
       at System.Management.Automation.ValidateEnumeratedArgumentsAttribute.Validate(Object arguments, EngineIntrinsic 
   s engineIntrinsics)
       at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledC 
   ommandParameter parameterMetadata, ParameterBindingFlags flags)
 at Get-TempRegistry, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\Pester\5.0.2\Pester.psm1: line 7827
at New-RandomTempRegistry, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\Pester\5.0.2\Pester.psm1: line 12890
at New-TestRegistry, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\Pester\5.0.2\Pester.psm1: line 12807
at <ScriptBlock>, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\Pester\5.0.2\Pester.psm1: line 12958

Expected behaviour

When the tests are using the TestDrive, all tests runs and the TestDrive can be used.

Steps to reproduce the problem

emmanuelbenitez avatar Jun 29 '20 07:06 emmanuelbenitez

This looks like an issue with Pester itself rather than with the Azure DevOps Extension. Probably worth raising the issue there instead as there's not much I can do about how Azure DevOps handles the registry.

ChrisLGardner avatar Jul 23 '20 09:07 ChrisLGardner

Thanks for your feedback but the tests works on a local computer. So, the issue is somewhere between the both components ;)

emmanuelbenitez avatar Jul 23 '20 10:07 emmanuelbenitez

It's certainly an Azure DevOps issue but not one that the extension can solve. It might be worth looking at raising an issue on one of the Azure DevOps repos instead as they might be able to help there.

ChrisLGardner avatar Jul 23 '20 10:07 ChrisLGardner

Is this problem specific to Azure only? Does the TestDrive work on other CI platforms. I have a lot of tests using TestDrive, but I havent hit this road block yet, I'm stuck behind another one at the moment (the [PesterConfiguration] type is not available for some reason, probably not using the lastest version (v5), but how to force the right version who knows)

plastikfan avatar Aug 10 '20 09:08 plastikfan