How to skip pwsh component from sanity test

Hello Community!
I need some help to skip/exclude the ‘pwsh’ component from integration tests.
I was building ansible package and executing Unit, Sanity and Integration tests on ppc64le arch, but in Integration tests few tests requires pwsh (powershell) components, but it was not supported on ppc64le, so wont’ be able to install.
I tried to skip that component by using flag ANSIBLE_SKIP_PWSH_MODULES=1 but didn’t work. Also didn’t found anything related to skip that properly.
Could you please help me what to do in this situation?
Below are the error logs for your reference:

Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.2.1
    Not uninstalling pip at /usr/lib/python3.12/site-packages, outside environment /tmp/tmp.tgg653nqP2/ansible_collections/ns/col/sts/output/.tmp/delegation/python3.12-ssp
    Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-25.2
Running sanity test "action-plugin-docs"
Running sanity test "ansible-doc"
Running sanity test "changelog"
Running sanity test "compile" on Python 3.12
Running sanity test "empty-init"
Running sanity test "ignores"
Running sanity test "import" on Python 3.12
Running sanity test "line-endings"
Running sanity test "no-assert"
Running sanity test "no-get-exception"
Running sanity test "no-illegal-filenames"
Running sanity test "no-smart-quotes"
Running sanity test "pep8"
Running sanity test "pslint"
WARNING: Required program "pwsh" not found.
Running sanity test "pylint"
Running sanity test "replace-urlopen"
Running sanity test "runtime-metadata"
Running sanity test "shebang"
Running sanity test "shellcheck"
Running sanity test "symlinks"
Running sanity test "use-argspec-type-path"
Running sanity test "use-compat-six"
Running sanity test "validate-modules"
FATAL: Command "/root/.ansible/test/venv/sanity.validate-modules/3.12/8088ee77/bin/python /root/a/ansible/test/lib/ansible_test/_ul/controller/sanity/validate-modules/validate.py --format json --arg-spec --collection ansible_collections/ns/col --collection-veron 1.0.0 plugins/modules/hello.py plugins/modules/win_util_args.ps1 plugins/modules/win_util_args.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate.py", line 6, in <module>
    main()
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py", line 2692, in ma
    run()
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py", line 2652, in ru
    mv1.validate()
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py", line 2458, in vadate
    self._validate_ansible_module_call(docs)
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py", line 1372, in _vidate_ansible_module_call
    spec, kwargs = get_ps_argument_spec(self.path, self.collection)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/a/ansible/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py", line 104,n get_ps_argument_spec
    raise FileNotFoundError('Required program for PowerShell arg spec inspection "pwsh" not found.')
FileNotFoundError: Required program for PowerShell arg spec inspection "pwsh" not found.
FATAL: Command "/usr/bin/env ANSIBLE_TEST_CONTENT_ROOT=/tmp/tmp.tgg653nqP2/ansible_collections/ns/col PYTHONPATH=/tmp/ansible-testx7o81gn /tmp/tmp.tgg653nqP2/ansible_collections/ns/col/tests/output/.tmp/delegation/python3.12-ssp/bin/python /root/a/ansible/bin/sible-test sanity --containers '{}' --truncate 0 --color yes --host-path tests/output/.tmp/host-r3q2lej6 --metadata tests/output/.p/metadata-opcyba7g.json" returned exit status 1.
+ rm -rf /tmp/tmp.tgg653nqP2
NOTICE: To resume at this test target, use the option: --start-at ansible-test-docker
NOTICE: To resume after this test target, use the option: --start-at ansible-test-git
FATAL: Command "./runme.sh" returned exit status 1.
mv: cannot stat '.ps1_backup_temp/*.ps1': No such file or directory
Restored 1 .ps1 modules

@mattclay Do you know why ANSIBLE_SKIP_PWSH_MODULES isn’t working as expected, @prabhuk is trying to skip this as it’s not available on ppc64le

Do you know why ANSIBLE_SKIP_PWSH_MODULES isn’t working as expected

I’ve not heard or seen any reference to this environment variable or any like that. Is it documented anywhere?

No, it was not documented anywhere, I have used it while executing build script and tried to skip, but still pwsh components were executing.
Could you please provide more info how pwsh component invoke and how we can exclude?

@prabhuk I don’t see any reference to SKIP_PWSH_MODULES in the Ansible codebase, though maybe I’m looking in the wrong place.
Where did you find reference to it?

Yeah, as I mentioned earlier I was executing integration test and it was calling inside it, mentioned few reference which i found, it might not be exact ones, since I can see pwsh is calling from many places,

ansible/test/integration/targets/ansible-test-sanity-validate-modules/runme.sh at a751010beaeeeeda97fd688e609f6035e9698ad2 · ansible/ansible

What is the command you are trying? Is there any PowerShell modules in your source directory?

There is no ANSIBLE_SKIP_PWSH_MODULES environment variable or setting.

Not all integration tests will work on ppc64le. For those cases, you’ll need to skip those tests. Tests that rely on PowerShell are one example of this, but there are others.

Yeah, there are many PowerShell dependent modules in ansible, currently getting an error from - plugins/modules/win_util_args.ps1
I was executing an Integration test with command “./bin/ansible-test integration --python 3.12” which internally triggers sanity test “ansible-test sanity --test validate-modules

oh, ok, Can I know how if there are any other way apart from –exclude to skip those tests?
And by any chance list of tests which are not supported on ppc64le, it saves me a lot of time.

Using --exclude is the correct way to skip integration tests that would otherwise match the test criteria you specified. Keep in mind the argument is a regular expression, so you can specify multiple test targets at once, such as --exclude 'some_test|another_test'

We do not maintain a list of tests which are unsupported on specific architectures, since doing so is impractical.

1 Like

We don’t have ppc64le hardware, so we can’t tell you right away which tests would fail.

You can use aliases to disable test which does not work for ppc64le hardware. Please refer integration-aliases — Ansible Community Documentation for more details.

Thanks,

1 Like

Hello Team,

I have completed the integration tests after excluding the cases that fail on ppc64le due to unsupported dependencies. The following 13 test cases are currently being excluded because they are failing:

  1. --exclude ansible-test-cloud-galaxy
  2. --exclude ansible-galaxy-collection
  3. --exclude ansible-test-coverage
  4. --exclude ansible-test-docker
  5. --exclude connection_ssh
  6. --exclude fetch
  7. --exclude file
  8. --exclude keyword_inheritance
  9. --exclude lookup_password
  10. --exclude omit
  11. --exclude async
  12. --exclude callback_default
  13. --exclude remote_tmp

Could you please confirm if it is fine to exclude this many test cases for ppc64le while verifying the integration tests?

Could you please create a separate repo for logs for each failure so that we can take a look and let you know? Thanks,