Merge "Add podman support to validate-tempest role"
This commit is contained in:
commit
632ac5c308
@ -46,6 +46,7 @@ Role Variables
|
|||||||
* `tempest_container_namespace`: <string> The name of tempest container image to use (default: centos-binary-tempest)
|
* `tempest_container_namespace`: <string> The name of tempest container image to use (default: centos-binary-tempest)
|
||||||
* `tempest_container_tag`: <string> The tag of the tempest container image to use (default: current-tripleo)
|
* `tempest_container_tag`: <string> The tag of the tempest container image to use (default: current-tripleo)
|
||||||
* `tempest_dir`: <string> The path to tempest workspace directory (default: /home/stack/tempest)
|
* `tempest_dir`: <string> The path to tempest workspace directory (default: /home/stack/tempest)
|
||||||
|
* `tempest_data`: <string> The path to keep tempest related files used for running tempest (default: /home/stack)
|
||||||
* `test_black_regex`: <list> A set of tempest tests to skip (default: [])
|
* `test_black_regex`: <list> A set of tempest tests to skip (default: [])
|
||||||
* `tempest_version_dict`: <dict> A dict with release name as key and tempest tag version for that release as value
|
* `tempest_version_dict`: <dict> A dict with release name as key and tempest tag version for that release as value
|
||||||
* `tempest_version`: <string> The tempest version to use for running tempest
|
* `tempest_version`: <string> The tempest version to use for running tempest
|
||||||
|
@ -36,7 +36,18 @@ tempest_container_tag: >-
|
|||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ docker_image_tag }}
|
{{ docker_image_tag }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
tempest_dir: "{{ working_dir }}/tempest"
|
tempest_dir: >-
|
||||||
|
{% if tempest_format in ['container'] -%}
|
||||||
|
/var/lib/tempest/tempest
|
||||||
|
{%- else -%}
|
||||||
|
{{ working_dir }}/tempest
|
||||||
|
{%- endif %}
|
||||||
|
tempest_data: >-
|
||||||
|
{% if tempest_format in ['container'] -%}
|
||||||
|
/var/lib/tempest
|
||||||
|
{%- else -%}
|
||||||
|
{{ working_dir }}
|
||||||
|
{%- endif %}
|
||||||
tempest_whitelist_file_src: "whitelist_file.j2"
|
tempest_whitelist_file_src: "whitelist_file.j2"
|
||||||
tempest_whitelist_file: "whitelist_file.conf"
|
tempest_whitelist_file: "whitelist_file.conf"
|
||||||
tempest_whitelist: []
|
tempest_whitelist: []
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
rc_file: "{{ working_dir }}/{% if tempest_undercloud %}stackrc{% else %}overcloudrc{% endif %}"
|
rc_file: "{{ working_dir }}/{% if tempest_undercloud %}stackrc{% else %}overcloudrc{% endif %}"
|
||||||
|
|
||||||
|
- name: Set rc file to be sourced to run tempest with in container
|
||||||
|
set_fact:
|
||||||
|
rc_file_container: "{{ tempest_data }}/{% if tempest_undercloud %}stackrc{% else %}overcloudrc{% endif %}"
|
||||||
|
when: tempest_format == 'container'
|
||||||
|
|
||||||
- name: Create overcloud tempest setup script
|
- name: Create overcloud tempest setup script
|
||||||
template:
|
template:
|
||||||
src: tempest-setup.j2
|
src: tempest-setup.j2
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Set tempest init command
|
- name: Set tempest init command
|
||||||
set_fact:
|
set_fact:
|
||||||
tempest_init: "{% if release == 'newton' %}/usr/share/openstack-tempest-*/tools/configure-tempest-directory{% else %}tempest init {{ tempest_dir }}{% endif %}"
|
tempest_init: "tempest init {{ tempest_dir }}"
|
||||||
|
|
||||||
- name: Set tempestconf call
|
- name: Set tempestconf call
|
||||||
set_fact:
|
set_fact:
|
||||||
tempestconf: "{% if release == 'newton' %}{{ working_dir }}/tools/config_tempest.py{% else %}/usr/bin/discover-tempest-config{% endif %}"
|
tempestconf: "/usr/bin/discover-tempest-config"
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
# to create tempest directory.
|
# to create tempest directory.
|
||||||
# We are doing this as sudo because tempest in containers create the files as
|
# We are doing this as sudo because tempest in containers create the files as
|
||||||
# root.
|
# root.
|
||||||
|
{% if tempest_format in ["venv", "packages"] %}
|
||||||
sudo rm -rf {{ working_dir }}/.tempest
|
sudo rm -rf {{ working_dir }}/.tempest
|
||||||
sudo rm -rf {{ tempest_dir }}
|
sudo rm -rf {{ tempest_dir }}
|
||||||
# Remove tempest_data directory created before running tempest container
|
{% endif %}
|
||||||
sudo rm -rf {{ working_dir }}/tempest_data
|
|
||||||
|
|
||||||
|
|
||||||
# Cloud Credentials
|
# Cloud Credentials
|
||||||
@ -75,12 +75,17 @@ set -e
|
|||||||
|
|
||||||
rpm -qa | grep tempest
|
rpm -qa | grep tempest
|
||||||
|
|
||||||
|
# Remove the existing tempest workspace
|
||||||
|
if [ -d {{ tempest_dir }}/etc ]; then
|
||||||
|
tempest workspace remove --name {{ tempest_dir | basename }} --rmdir
|
||||||
|
fi
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
## Create Tempest Workspace
|
## Create Tempest Workspace
|
||||||
## ------------------------
|
## ------------------------
|
||||||
## ::
|
## ::
|
||||||
|
|
||||||
|
|
||||||
# Create Tempest directory
|
# Create Tempest directory
|
||||||
|
|
||||||
mkdir {{ tempest_dir }}
|
mkdir {{ tempest_dir }}
|
||||||
@ -95,7 +100,9 @@ popd
|
|||||||
## ::
|
## ::
|
||||||
export TEMPESTCONF="{{ tempestconf }}"
|
export TEMPESTCONF="{{ tempestconf }}"
|
||||||
|
|
||||||
{% if tempest_os_cloud == '' %}
|
{% if tempest_format == 'container' %}
|
||||||
|
source {{ rc_file_container }}
|
||||||
|
{% elif tempest_os_cloud == '' %}
|
||||||
source {{ rc_file }}
|
source {{ rc_file }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -129,7 +136,7 @@ export OS_AUTH_URL="$OS_AUTH_URL/v2.0"
|
|||||||
cd {{ tempest_dir }}
|
cd {{ tempest_dir }}
|
||||||
$TEMPESTCONF --out etc/tempest.conf \
|
$TEMPESTCONF --out etc/tempest.conf \
|
||||||
{% if tempest_overcloud|bool %}
|
{% if tempest_overcloud|bool %}
|
||||||
--deployer-input {{ working_dir }}/{{ tempest_deployer_input_file }} \
|
--deployer-input {{ tempest_dir }}/{{ tempest_deployer_input_file }} \
|
||||||
--network-id $public_net_id \
|
--network-id $public_net_id \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if tempest_os_cloud != '' %}
|
{% if tempest_os_cloud != '' %}
|
||||||
|
@ -10,6 +10,7 @@ export OSTESTR='{{ working_dir }}/tempest_git/tools/with_venv.sh ostestr'
|
|||||||
export OSTESTR='ostestr'
|
export OSTESTR='ostestr'
|
||||||
export TEMPESTCLI='/usr/bin/tempest'
|
export TEMPESTCLI='/usr/bin/tempest'
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
export TEMPESTDATA={{ tempest_data }}
|
||||||
|
|
||||||
## List tempest plugins
|
## List tempest plugins
|
||||||
|
|
||||||
@ -26,9 +27,9 @@ $TEMPESTCLI cleanup --init-saved-state
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if release in ["newton", "ocata", "pike"] %} $OSTESTR {% else %} $TEMPESTCLI run {% endif %}{% if test_white_regex != '' %} --regex '({{ test_white_regex }})' {% endif %}
|
{% if release in ["newton", "ocata", "pike"] %} $OSTESTR {% else %} $TEMPESTCLI run {% endif %}{% if test_white_regex != '' %} --regex '({{ test_white_regex }})' {% endif %}
|
||||||
{% if tempest_whitelist|length > 0 %} --whitelist_file={{ working_dir }}/{{ tempest_whitelist_file }} {% endif %}
|
{% if tempest_whitelist|length > 0 %} --whitelist_file=$TEMPESTDATA/{{ tempest_whitelist_file }} {% endif %}
|
||||||
{% if release not in ["newton", "ocata", "pike"] %} {% if test_black_regex|length > 0 %} --black-regex='{{ test_black_regex|join('|') }}'{% endif %} {% endif %}
|
{% if release not in ["newton", "ocata", "pike"] %} {% if test_black_regex|length > 0 %} --black-regex='{{ test_black_regex|join('|') }}'{% endif %} {% endif %}
|
||||||
{% if skip_file_src != '' %} --blacklist_file={{ working_dir }}/{{ skip_file }} {% endif %}
|
{% if skip_file_src != '' %} --blacklist_file=$TEMPESTDATA/{{ skip_file }} {% endif %}
|
||||||
{% if tempest_workers is defined %} --concurrency {{ tempest_workers }} {% endif %}
|
{% if tempest_workers is defined %} --concurrency {{ tempest_workers }} {% endif %}
|
||||||
{% if tempest_until_failure|bool %} --until-failure {% endif %}
|
{% if tempest_until_failure|bool %} --until-failure {% endif %}
|
||||||
|
|
||||||
@ -44,9 +45,14 @@ $TEMPESTCLI cleanup --dry-run
|
|||||||
EOF
|
EOF
|
||||||
chmod +x {{ working_dir }}/tempest_container.sh
|
chmod +x {{ working_dir }}/tempest_container.sh
|
||||||
# Copy all the required files in a temprory directory
|
# Copy all the required files in a temprory directory
|
||||||
mkdir {{ working_dir }}/tempest_data
|
export TEMPEST_HOST_DATA='/var/lib/tempestdata'
|
||||||
|
|
||||||
cp $RCFILE \
|
if [ ! -d $TEMPEST_HOST_DATA ]
|
||||||
|
then
|
||||||
|
mkdir -p $TEMPEST_HOST_DATA
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo cp $RCFILE \
|
||||||
{% if skip_file_src != '' %}
|
{% if skip_file_src != '' %}
|
||||||
{{ working_dir }}/{{ skip_file }} \
|
{{ working_dir }}/{{ skip_file }} \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -57,46 +63,33 @@ cp $RCFILE \
|
|||||||
{{ working_dir }}/{{ tempest_deployer_input_file }} \
|
{{ working_dir }}/{{ tempest_deployer_input_file }} \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ working_dir }}/tempest_container.sh \
|
{{ working_dir }}/tempest_container.sh \
|
||||||
{{ working_dir }}/tempest_data
|
$TEMPEST_HOST_DATA
|
||||||
|
|
||||||
# TODO(chkumar246): https://review.openstack.org/#/c/583940/ added tempest user to
|
{% if undercloud_container_cli is defined %}
|
||||||
# tempest container, The file getting mounted from host to tempest container have
|
export CONTAINER_BINARY={{ undercloud_container_cli }}
|
||||||
# different permission as tempest user does not own those folders which will give
|
{% else %}
|
||||||
# permission denied So first check whether tempest user is there or not if present
|
export CONTAINER_BINARY='docker'
|
||||||
# run the docker command to change the dir permission and if not found the usual
|
|
||||||
# command, Once new container image is available after promotion, we will the add
|
|
||||||
# the volume in THT itself and fix other stuffs. Also pull docker image locally
|
|
||||||
# as docker inspect needs the image to exist.
|
|
||||||
sudo docker pull {{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }}
|
|
||||||
if [ x$(sudo docker inspect --format "{{ '{{' }} .Config.User {{ '}}' }}" {{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }}) == 'xtempest' ]; then
|
|
||||||
sudo docker run --net=host -u root -v {{ working_dir }}/tempest_data:{{ working_dir }} \
|
|
||||||
{% if not 'http' in tempest_test_image_path %}
|
|
||||||
-v {{ tempest_test_image_path }}:{{ tempest_test_image_path }} \
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }} \
|
|
||||||
chown -R tempest:tempest \
|
sudo $CONTAINER_BINARY pull {{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }}
|
||||||
{% if not 'http' in tempest_test_image_path %}
|
|
||||||
{{ tempest_test_image_path }} \
|
|
||||||
{% endif %}
|
|
||||||
{{ working_dir }}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run tempest container using docker mouting required files
|
# Run tempest container using docker mouting required files
|
||||||
sudo docker run --net=host -i -v {{ working_dir }}/tempest_data/:{{ working_dir }} \
|
sudo $CONTAINER_BINARY run --net=host -i -v $TEMPEST_HOST_DATA:{{ tempest_data }} \
|
||||||
-e PYTHONWARNINGS="${PYTHONWARNINGS:-}" \
|
-e PYTHONWARNINGS="${PYTHONWARNINGS:-}" \
|
||||||
-e CURL_CA_BUNDLE="" \
|
-e CURL_CA_BUNDLE="" \
|
||||||
|
--user=root \
|
||||||
-v /var/log/containers/tempest:{{ tempest_log_dir }} \
|
-v /var/log/containers/tempest:{{ tempest_log_dir }} \
|
||||||
{% if not 'http' in tempest_test_image_path %}
|
{% if not 'http' in tempest_test_image_path %}
|
||||||
-v {{ tempest_test_image_path }}:{{ tempest_test_image_path }} \
|
-v {{ tempest_test_image_path }}:{{ tempest_test_image_path }} \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }} \
|
{{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }} \
|
||||||
/usr/bin/bash -c 'set -e; {{ working_dir }}/tempest_container.sh'
|
/usr/bin/bash -c 'set -e; {{ tempest_data }}/tempest_container.sh'
|
||||||
|
|
||||||
# Change permission of tempest workspace directory
|
# Change permission of tempest workspace directory
|
||||||
sudo chmod -R 777 {{ working_dir }}/tempest_data
|
sudo chmod -R 777 $TEMPEST_HOST_DATA
|
||||||
|
|
||||||
# Copy tempest related data to tempest folder so that stackviz can use it
|
# Copy tempest related data to tempest folder so that stackviz can use it
|
||||||
cp -R {{ working_dir }}/tempest_data/tempest {{ working_dir }}
|
cp -R $TEMPEST_HOST_DATA/tempest {{ working_dir }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
### --stop_docs
|
### --stop_docs
|
||||||
|
Loading…
Reference in New Issue
Block a user