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

patch st2-run-pack-tests to work with python3 #4956

Open
wants to merge 4 commits into
base: master
from

Conversation

@guzzijones
Copy link
Contributor

@guzzijones guzzijones commented May 20, 2020

allows st2-run-pack-tests to work with python3 on systems that have python3 installed as a separate binary.

I probably need to find and or create an integration test for this.

@pull-request-size pull-request-size bot added size/S size/M and removed size/S labels May 20, 2020
@guzzijones
Copy link
Contributor Author

@guzzijones guzzijones commented May 20, 2020

I see 2 places where this script is called:
https://github.com/StackStorm/st2/blob/b54262709f02b17acb716ed12efc651c71e1405d/Makefile
https://github.com/StackStorm/st2/blob/2b7c4005243fc268497b6780333241e9fc712f82/tox.ini

Adding a test of the -3 will require a git clone of the repo and setting the ST2_REPO_PATH and then running .

@armab armab added the enhancement label May 23, 2020
@armab
Copy link
Member

@armab armab commented May 23, 2020

@nzlosh Can you please help evaluating UX functionality/changes in this PR and review it?

@nzlosh
Copy link
Contributor

@nzlosh nzlosh commented May 24, 2020

Can I have some more context about the problem this PR is addressing? On Ubuntu 18.04 the st2-run-pack-tests detects and uses python3.6 to test the pack without any problem. Running the script with -3 returns must set ST2_REPO_PATH variable

@guzzijones
Copy link
Contributor Author

@guzzijones guzzijones commented May 25, 2020

@guzzijones
Copy link
Contributor Author

@guzzijones guzzijones commented May 25, 2020

@armab
Copy link
Member

@armab armab commented May 25, 2020

Here is the complete py2 vs py3 native OS support matrix:

Python 3:

  • EL8
  • Ubuntu Bionic

Python 2:

  • EL6 (will be deprecated in st2 v3.3)
  • EL7
  • Ubuntu Xenial
@armab
Copy link
Member

@armab armab commented May 30, 2020

@nzlosh did @guzzijones answer your question?
Any further PR review/feedback based on that context?

Copy link
Contributor

@nzlosh nzlosh left a comment

Overall, adding support for Python3 looks good to me. There are a few points I've raised, such as allowing the users to choose the version of python used for the pack tests and some more explicit error messages.

@@ -78,10 +80,11 @@ function usage() {
echo " and virtualenv, if any, for subsequent test runs." >&2
echo " -t : Run tests with timing enabled" >&2
echo " -v : Verbose mode (log debug messages to stdout)." >&2
echo " -3 : use python3" >&2

This comment has been minimized.

@nzlosh

nzlosh May 30, 2020
Contributor

Use a flag that takes an argument rather than hard coding 3 (hint: use $OPTARG to get the version).

3 doesn't give any meaning to the purpose of the flag, using P would be better so there is an association with P for Python. It would be useful to be able to specify a version rather than just the major version. E.g. accept 3.6, 3.7, 3.8 to give pack developers the flexibility to test against a specific minor version.

Remember to document the flag in the Usage: $0 section of the output too.

@@ -104,6 +107,14 @@ while getopts ":p:f:xjvct" o; do
t)
ENABLE_TIMING=true
;;
3)
PYTHON_3=true
if [ -z "$ST2_REPO_PATH" ]; then

This comment has been minimized.

@nzlosh

nzlosh May 30, 2020
Contributor

Why does the python 3 flag short circuit the ST2_REPO_PATH logic which handles the case of its absence later in the script?

This comment has been minimized.

@guzzijones

guzzijones May 30, 2020
Author Contributor

This is the most important part. This script will look for st2 libs in \opt\stsckstorm if i dont set this. On centos7 those are python 2.7. Maybe what we do here is check the system python version vs. The version passed in this flag. If they doffer then force this env var to be set.

3)
PYTHON_3=true
if [ -z "$ST2_REPO_PATH" ]; then
echo "must set ST2_REPO_PATH variable"

This comment has been minimized.

@nzlosh

nzlosh May 30, 2020
Contributor

A clearer error message explaining what the ST2_REPO_PATH variable is used for will help people set the correct value. e.g. Environment variable ST2_REPO_PATH must be set to your st2 installation or st2 git repository for pack tests to function correctly.

@guzzijones
Copy link
Contributor Author

@guzzijones guzzijones commented Jun 1, 2020

Just a heads up:
If this gets milestone I will spend some time on it. Currently I am working on other PRs.

@armab
Copy link
Member

@armab armab commented Jun 1, 2020

@guzzijones Yes, we'll be good to accept this enhancement into st2 core, once it's polished.

Thanks @nzlosh for helping with the review to get it closer for the broader use.

@armab
Copy link
Member

@armab armab commented Aug 13, 2020

@guzzijones any update on driving this PR to completion?

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.