You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It does not like the azure automation variables Get-AutomationVariable
It does not like the calling out of the container to fetch the
Storage account credential with or without the azure automation call: $storageAccountCred = Get-AutomationPSCredential
Describing File Existence Test
Write-Error: C:\Users\RPhadke\cds_tools\azure_automation\pm_runbook.ps1:147:1
Line |147|Invoke-PmScenario-scenario_id $scenario_id-storageAccountCred $stor …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unrecognized Guid format.
[-] Error occurred in Describe block 81ms
at Invoke-PmScenario, C:\Users\RPhadke\cds_tools\azure_automation\pm_runbook.ps1: line 142
FormatException: Unrecognized Guid format.
at Invoke-PmScenario, C:\Users\RPhadke\cds_tools\azure_automation\pm_runbook.ps1: line 142
at <ScriptBlock>, C:\Users\RPhadke\cds_tools\azure_automation\pm_runbook.ps1: line 147
at <ScriptBlock>, C:\Users\RPhadke\cds_tools\azure_automation\pm_runbook.Tests.ps1: line 10
at Invoke-Blocks, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\SetupTeardown.ps1: line 134
at Invoke-TestGroupSetupBlocks, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\SetupTeardown.ps1: line 113
Expected Behavior
Container should build - should not fail
Should not get Unrecognized GUID format error on automation variables
Steps To Reproduce
Powershell script
Param
(
[string]$scenario_id="102",# Default value for scenario_id
[PSCredential]$storageAccountCred=$null,# Default value for storageAccountCred
[switch]$DebugMode=$false# Switch parameter for debug mode
)
functionInvoke-Scenario {
param (
[string]$scenario_id,
[PSCredential]$storageAccountCred,
[switch]$DebugMode
)
try {
# Converting Azure Automation variable assets to script variables$start=Get-AutomationVariable-Name "start"$rootVal=Get-AutomationVariable-Name "rootVal"$credName=Get-AutomationVariable-Name "credName"$executable_path=Get-AutomationVariable-Name "executable_path"$drive=Get-AutomationVariable-Name "drive"# Map drive if unmappedif ($null-eq$storageAccountCred) {
$storageAccountCred=Get-AutomationPSCredential-Name $credName
}
}
catch {
# If an error is caught, log it and then re-throw itWrite-Error-Message $_.Exception.Message# Send-ProcessingErrorthrow$_.Exception
}
}
Invoke-Scenario-scenario_id $scenario_id-storageAccountCred $storageAccountCred-DebugMode $DebugMode
Testing Script
Describe "File Existence Test" {
BeforeAll {
# pm_runbook.ps1 - .Tests.ps1 + .ps1 = pm_runbook.ps1.$PSCommandPath.Replace('.Tests.ps1','.ps1')
}
It "should find pm_runbook.ps1 file" {
.$PSCommandPath.Replace('.Tests.ps1','.ps1')
Test-Path$filePath| Should -Be $true
}
}
Describe your environment
Pester version : 3.4.0 C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psm1
PowerShell version : 7.4.2
OS version : Microsoft Windows NT 10.0.22631.0
Possible Solution?
No response
The text was updated successfully, but these errors were encountered:
Hi. You're using Pester v3 which is no longer supported. Please upgrade to the latest version as required in the checklist at the beginning of the issue text, see link for help.
Still, there's nothing in the issue pointing to Pester being the root cause. Stacktrace doesn't match the provided code and error is likely related to something external. The testing script is also executing the script twice and testing an undefined path variable.
Closing as likely spam. If not, please update the issue with a valid sample and error and let me now in a comment.
Checklist
What is the issue?
Script is erroring on two root causes:
Get-AutomationVariable
Storage account credential with or without the azure automation call:
$storageAccountCred = Get-AutomationPSCredential
Expected Behavior
Steps To Reproduce
Powershell script
Testing Script
Describe your environment
Pester version : 3.4.0 C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psm1
PowerShell version : 7.4.2
OS version : Microsoft Windows NT 10.0.22631.0
Possible Solution?
No response
The text was updated successfully, but these errors were encountered: