tripleo-quickstart-extras/roles/validate-tempest/templates/run-tempest.sh.j2

109 lines
3.8 KiB
Django/Jinja

## Run tempest
## -----------
## ::
{% if tempest_format == "venv" %}
export TEMPESTCLI='{{ working_dir }}/tempest_git/tools/with_venv.sh tempest'
export OSTESTR='{{ working_dir }}/tempest_git/tools/with_venv.sh ostestr'
{% else %}
export OSTESTR='ostestr'
export TEMPESTCLI='/usr/bin/tempest'
{% endif %}
export TEMPESTDATA={{ tempest_data }}
## List tempest plugins
## ::
$TEMPESTCLI list-plugins
## Save the resources before running tempest tests
## It will create saved_state.json in tempest workspace.
## ::
{% if tempest_track_resources|bool %}
$TEMPESTCLI cleanup --init-saved-state
{% 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=$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 skip_file_src != '' %} --blacklist_file=$TEMPESTDATA/{{ skip_file }} {% endif %}
{% if tempest_workers is defined %} --concurrency {{ tempest_workers }} {% endif %}
{% if tempest_until_failure|bool %} --until-failure {% endif %}
## Check which all tenants would be modified in the tempest run
## It will create dry_run.json in tempest workspace.
## ::
{% if tempest_track_resources|bool %}
$TEMPESTCLI cleanup --dry-run
{% endif %}
{% if tempest_format == "container" %}
EOF
chmod +x {{ working_dir }}/tempest_container.sh
# Copy all the required files in a temprory directory
export TEMPEST_HOST_DATA='/var/lib/tempestdata'
if [ ! -d $TEMPEST_HOST_DATA ]
then
sudo mkdir -p $TEMPEST_HOST_DATA
fi
sudo cp \
{% if tempest_os_cloud == '' %}
{{ rc_file }} \
{% endif %}
{% if skip_file_src != '' %}
{{ working_dir }}/{{ skip_file }} \
{% endif %}
{% if tempest_whitelist|length > 0 %}
{{ working_dir }}/{{ tempest_whitelist_file }} \
{% endif %}
{% if tempest_overcloud|bool %}
{{ working_dir }}/{{ tempest_deployer_input_file }} \
{% endif %}
{{ working_dir }}/tempest_container.sh \
$TEMPEST_HOST_DATA
{% if tempest_os_cloud != '' %}
sudo cp -Rf {{ working_dir }}/.config $TEMPEST_HOST_DATA
{% endif %}
{% if release not in ['newton', 'ocata', 'pike', 'queens', 'rocky'] %}
export CONTAINER_BINARY='podman'
{% else %}
export CONTAINER_BINARY='docker'
{% endif %}
sudo $CONTAINER_BINARY pull {{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }}
{% if tempest_use_headless_chrome|bool %}
sudo $CONTAINER_BINARY pull selenium/standalone-chrome
sudo $CONTAINER_BINARY run -d \
-p {{ tempest_headless_chrome_port }}:{{ tempest_headless_chrome_port }} \
-v /dev/shm:/dev/shm selenium/standalone-chrome
{% endif %}
# Run tempest container using docker mouting required files
sudo $CONTAINER_BINARY run --net=host -i -v $TEMPEST_HOST_DATA:{{ tempest_data }} \
-e PYTHONWARNINGS="${PYTHONWARNINGS:-}" \
-e CURL_CA_BUNDLE="" \
--user=root \
{% if (enable_tls_everywhere is defined and enable_tls_everywhere|bool) %}
-e KRB5_CLIENT_KTNAME="${KRB5_CLIENT_KTNAME:-}" \
-v /etc/novajoin/krb5.keytab:/etc/novajoin/krb5.keytab:ro \
-v /home/{{ undercloud_user }}/krb5.keytab:/home/{{ undercloud_user }}/krb5.keytab:ro \
-v /etc/ipa/default.conf:/etc/ipa/default.conf:ro \
{% endif %}
-v /var/log/containers/tempest:{{ tempest_log_dir }} \
{% if not 'http' in tempest_test_image_path %}
-v {{ tempest_test_image_path }}:{{ tempest_test_image_path }} \
{% endif %}
{{ tempest_container_registry }}/{{ tempest_container_namespace }}:{{ tempest_container_tag }} \
/usr/bin/bash -c 'set -e; {{ tempest_data }}/tempest_container.sh'
{% endif %}
### --stop_docs