Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enabler] [conftest.py] Hot fix for testing the collection in Ansible 2.17.1 #1772

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

rexemin
Copy link
Collaborator

@rexemin rexemin commented Oct 29, 2024

SUMMARY

Fixes #1670.

ISSUE TYPE
  • Enabler Pull Request
COMPONENT NAME
  • tests/conftest.py
ADDITIONAL INFORMATION

Instead of passing the environment variables through the interpreter string, now we decorate the Ansible engine function that computes the environment string.

Some changes were needed to fix a couple of tests. Most changes were related to escaping shell commands and were failures even when running on dev with Ansible 2.16. Changes directly related to this PR are the ones made to tests for zos_copy and zos_fetch, as well as the users.py helper.

Changes to the config

This changes how the config should look like in Jenkins. When testing on Ansible >=2.17.1, we need to remove the PYTHONSTDINENCODING variable and change the value of _CEE_RUNOPTS to "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)" (notice how we will not use an extra pair of single quotes now).

The new config for Jenkins should be like this:

_BPXK_AUTOCVT: "ON"
_CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
_TAG_REDIR_ERR: txt
_TAG_REDIR_IN: txt
_TAG_REDIR_OUT: txt
LANG: C
ZOAU_HOME: "ZOAUDIR"
ZOAU: "ZOAUDIR/bin"
ZOAU_ROOT: "ZOAUDIR"
LIBPATH: "ZOAUDIR/lib:PYTHONDIR/lib:/lib:/usr/lib:."
ZOAUTIL_DIR: "ZOAUDIR"
PYTHONPATH: "ZOAUDIR/lib"
PYTHON_HOME: "PYTHONDIR"
PYTHON: "PYTHONDIR/bin"
PATH: "ZOAUDIR/bin:PYTHONDIR/bin:/bin:/usr/sbin:/var/bin:/usr/lpp/java/java180/J8.0_64/bin"

When running Ansible 2.16 or 2.15, the only change needed is to remove the pair of single quotes from _CEE_RUNOPTS, and thus the config should look like this:

_BPXK_AUTOCVT: "ON"
_CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
_TAG_REDIR_ERR: txt
_TAG_REDIR_IN: txt
_TAG_REDIR_OUT: txt
LANG: C
ZOAU_HOME: "ZOAUDIR"
ZOAU: "ZOAUDIR/bin"
ZOAU_ROOT: "ZOAUDIR"
LIBPATH: "ZOAUDIR/lib:PYTHONDIR/lib:/lib:/usr/lib:."
ZOAUTIL_DIR: "ZOAUDIR"
PYTHONPATH: "ZOAUDIR/lib"
PYTHON_HOME: "PYTHONDIR"
PYTHON: "PYTHONDIR/bin"
PATH: "ZOAUDIR/bin:PYTHONDIR/bin:/bin:/usr/sbin:/var/bin:/usr/lpp/java/java180/J8.0_64/bin"
PYTHONSTDINENCODING: "cp1047"

Running locally

To run locally, the same config should work, but in case you're getting garbage as output when using Ansible 2.16 or 2.15, try removing PYTHONSTDINENCODING and see if that fixes the issue.

@rexemin
Copy link
Collaborator Author

rexemin commented Oct 30, 2024

Screenshot 2024-10-30 at 11 58 25 Screenshot 2024-10-30 at 11 58 37 Screenshot 2024-10-30 at 11 58 49

Screenshot 2024-10-30 at 12 01 18
Screenshot 2024-10-30 at 12 01 08
Screenshot 2024-10-30 at 12 01 00

@rexemin
Copy link
Collaborator Author

rexemin commented Oct 31, 2024

Screenshot 2024-10-31 at 11 47 09
Screenshot 2024-10-31 at 11 47 18
Screenshot 2024-10-31 at 11 47 30


Screenshot 2024-10-31 at 12 22 00
Screenshot 2024-10-31 at 12 21 44
Screenshot 2024-10-31 at 12 21 28

@rexemin
Copy link
Collaborator Author

rexemin commented Oct 31, 2024

Screenshot 2024-10-31 at 16 33 22
Screenshot 2024-10-31 at 16 33 14
Screenshot 2024-10-31 at 16 33 34


Screenshot 2024-10-31 at 15 52 34
Screenshot 2024-10-31 at 15 52 10
Screenshot 2024-10-31 at 15 52 47

@rexemin
Copy link
Collaborator Author

rexemin commented Nov 2, 2024

Screenshot 2024-11-02 at 0 06 37
Screenshot 2024-11-02 at 0 07 01
Screenshot 2024-11-02 at 0 06 48

@fernandofloresg
Copy link
Collaborator

@rexemin I see this PR is ready for review but no reviewers were assigned. I'm reviewing this, just one question, I see the screenshots are tested with 2.17.1, is this not breaking testing functionality for 2.15 and 2.16 ?

@rexemin
Copy link
Collaborator Author

rexemin commented Nov 7, 2024

Thanks for reviewing, it should still be on draft mode, that's a mistake on my part. I've been testing the changes for 2.16, but I still need to make sure it works fine with 2.15 too

@rexemin rexemin marked this pull request as ready for review November 21, 2024 00:17
@rexemin
Copy link
Collaborator Author

rexemin commented Nov 21, 2024

The whole test suite passed on 2.16.7. Still testing on 2.15 to make sure nothing breaks.

Copy link
Collaborator

@AndreMarcel99 AndreMarcel99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your change also cover a lot of warning we had on pytest, great

@rexemin
Copy link
Collaborator Author

rexemin commented Nov 22, 2024

The test suite was successful on Ansible 2.15.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enabler] [Pipeline] Immediate fix for test suite not able to run in ansible-core 2.17.1 or later
4 participants