summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2023-01-11 08:05:50 +1000
committerMatt Clay <matt@mystile.com>2023-01-11 10:13:27 -0800
commit2e541a5450b5da0190bc86a7b46075c2be8b68c7 (patch)
tree7ba92acaf5459b362c8e401f3f4d36f884106901 /test/lib
parent7e7908a3e1091c38ea1e98ab3a6d64bf58430736 (diff)
downloadansible-2e541a5450b5da0190bc86a7b46075c2be8b68c7.tar.gz
ansible-test - fix ps argspec check inside cmdlet (#79699)
* ansible-test - fix ps argspec check inside cmdlet * Added error condition test * Fix sanity problem (cherry picked from commit ee33be9484b2240aa7b6b3bfdb30b452b6048e85)
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/ps_argspec.ps114
1 files changed, 11 insertions, 3 deletions
diff --git a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/ps_argspec.ps1 b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/ps_argspec.ps1
index 23610e3ebc..4183b2bec4 100644
--- a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/ps_argspec.ps1
+++ b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/ps_argspec.ps1
@@ -101,13 +101,21 @@ Add-CSharpType -References @(Get-Content -LiteralPath $manifest.ansible_basic -R
$powershell.AddScript($module_code) > $null
$powershell.Invoke() > $null
+$arg_spec = $powershell.Runspace.SessionStateProxy.GetVariable('ansibleTestArgSpec')
+
+if (-not $arg_spec) {
+ $err = $powershell.Streams.Error
+ if ($err) {
+ $err
+ }
+ else {
+ "Unknown error trying to get PowerShell arg spec"
+ }
-if ($powershell.HadErrors) {
- $powershell.Streams.Error
exit 1
}
-$arg_spec = $powershell.Runspace.SessionStateProxy.GetVariable('ansibleTestArgSpec')
+
Resolve-CircularReference -Hash $arg_spec
ConvertTo-Json -InputObject $arg_spec -Compress -Depth 99