Fix and re-enable function tox job

Change-Id: Ie6735bbc9a974af1ac44c9777a1d63e513f36469
This commit is contained in:
Andrey Kurilin 2023-08-20 16:36:19 +02:00
parent 5827d34499
commit 9ff67887bf
5 changed files with 55 additions and 17 deletions

View File

@ -8,7 +8,7 @@
- rally-tox-py38 - rally-tox-py38
- rally-tox-py39 - rally-tox-py39
- rally-tox-py310 - rally-tox-py310
#- rally-dsvm-tox-functional - rally-dsvm-tox-functional
- rally-openstack-docker-build - rally-openstack-docker-build
#- rally-task-basic-with-existing-users #- rally-task-basic-with-existing-users
- rally-task-simple-job - rally-task-simple-job
@ -90,7 +90,7 @@
- rally-tox-py38 - rally-tox-py38
- rally-tox-py39 - rally-tox-py39
- rally-tox-py310 - rally-tox-py310
#- rally-dsvm-tox-functional - rally-dsvm-tox-functional
- rally-openstack-docker-build - rally-openstack-docker-build
#- rally-task-basic-with-existing-users #- rally-task-basic-with-existing-users
- rally-task-simple-job - rally-task-simple-job

View File

@ -1,10 +0,0 @@
- name: Run tox command
become: True
become_user: stack
shell:
executable: /bin/sh
cmd: |
set -e
cd /opt/stack/rally-openstack
export REQUESTS_CA_BUNDLE=/opt/stack/data/ca-bundle.pem
tox -e {{ tox_env }}

View File

@ -10,6 +10,43 @@
# this task will not be launched, but we need to specify something real to # this task will not be launched, but we need to specify something real to
# pass a check at 'prepare-for-rally-task' role. # pass a check at 'prepare-for-rally-task' role.
rally_task: "rally-jobs/simple-job.yaml" rally_task: "rally-jobs/simple-job.yaml"
roles: pip_install: "/opt/stack/rally-openstack/.tox/{{ tox_env }}/bin/pip install"
- prepare-for-rally-task tasks:
- tox-run - name: "Trigger prepare tasks of rally-task-at-devstack zuul job"
import_role:
name: prepare-for-rally-task
- block:
- name: "Precreate a virtualenv for tox {{ tox_env }}"
command: tox -e {{ tox_env }} --notest
args:
chdir: /opt/stack/rally-openstack
- name: Check rally db connection
command: rally db show
register: rally_db_connection
# DevStack enables a special tool for MySQL performance counting. Since
# it is enabled globally, rally.conf includes it as well.
# tox -e functional utils reuse the same config file and fails
# if there is no this tool inside the venv
- name: Inject dbcounter plugin if needed
command: "{{ pip_install }} /opt/stack/devstack/tools/dbcounter"
when: "'plugin=dbcounter' in rally_db_connection.stdout"
- name: Install python lib for interacting with MySQL
command: "{{ pip_install }} PyMySQL>=0.7.6"
when: "'pymysql' in rally_db_connection.stdout"
- name: Run tox command
shell: |
set -e
export REQUESTS_CA_BUNDLE=/opt/stack/data/ca-bundle.pem
tox -e {{ tox_env }}
args:
chdir: /opt/stack/rally-openstack
become: True
become_user: stack

View File

@ -76,7 +76,12 @@ class Rally(object):
"env", "show", "--only-spec"], "env", "show", "--only-spec"],
stdout=f) stdout=f)
with open(self.ENV_FILE) as f: with open(self.ENV_FILE) as f:
self.env_spec = json.loads(f.read()) data = f.read()
try:
self.env_spec = json.loads(data)
except ValueError:
print(f"JSON file that failed to load: {data}")
raise
print(self.env_spec) print(self.env_spec)
# NOTE(sskripnick): we should change home dir to avoid races # NOTE(sskripnick): we should change home dir to avoid races
@ -133,7 +138,11 @@ class Rally(object):
write_report=False) write_report=False)
def __del__(self): def __del__(self):
shutil.rmtree(self.tmp_dir) # Rally object may fail before initialization of tmp_dir attribute
try:
shutil.rmtree(self.tmp_dir)
except AttributeError:
pass
def _safe_make_dirs(self, dirs): def _safe_make_dirs(self, dirs):
try: try:

View File

@ -35,6 +35,8 @@ passenv =
HOME HOME
[testenv:pep8] [testenv:pep8]
deps = -r{toxinidir}/test-requirements.txt
skip_install = true
commands = flake8 commands = flake8
distribute = false distribute = false