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

170 lines
5.1 KiB
Django/Jinja

### --start_docs
## Configure tempest
## -----------------
## * Clean up from any previous tempest run
## ::
# On doing tempest init workspace, it will create workspace directory
# as well as .workspace directory to store workspace information
# We need to delete .workspace directory otherwise tempest init failed
# to create tempest directory.
# We are doing this as sudo because tempest in containers create the files as
# root.
sudo rm -rf {{ working_dir }}/.tempest
sudo rm -rf {{ tempest_dir }}
sudo rm -rf {{ working_dir }}/python-tempestconf
# Source rc file
source {{ rc_file }}
## Create Tempest resources
## ------------------------
## * For overcloud
{% if tempest_overcloud|bool %}
## * Clean up network if it exists from previous run
## ::
{% include 'cleanup-network.sh.j2' %}
{% endif %}
## * Ensure creator and Member role is present
## * Member role is needed for Heat tests.
## * creator role is needed for Barbican for running volume encryption tests.
## ::
openstack role show Member > /dev/null || openstack role create Member
openstack role show creator > /dev/null || openstack role create creator
# Create Tempest directory
mkdir {{ tempest_dir }}
## Install openstack-tempest
## -------------------------
## * Using git
## ::
{% if tempest_format == "venv" %}
# Create .venv in tempest_git directory with --system-site-packages to access tempest plugins
virtualenv --system-site-packages {{ working_dir }}/tempest_git/.venv
{{ working_dir }}/tempest_git/tools/with_venv.sh pip install -U pip
{{ working_dir }}/tempest_git/tools/with_venv.sh pip install -U setuptools
{{ working_dir }}/tempest_git/tools/with_venv.sh pip install {{ working_dir }}/tempest_git junitxml
# Install python-tempestconf
{% if release != 'newton'%}
{{ working_dir }}/tempest_git/tools/with_venv.sh pip install {{ working_dir }}/python-tempestconf
{% endif %}
{% endif %}
{% if tempest_format == "container" %}
export RCFILE="{{ rc_file }}"
cat <<'EOF' >> {{ working_dir }}/tempest_container.sh
# Set the exit status for the command
set -e
# Get the list of tempest/-plugins rpms installed within a tempest container
# It will be useful for debugging and making sure at what commit
# tempest/tempest plugins rpms are installed in the same.
rpm -qa | grep tempest
{% endif %}
## Create Tempest Workspace
## ------------------------
## ::
# Create Tempest workspace
pushd {{ tempest_dir }}
{{ tempest_init }}
popd
## Generate tempest configuration using python-tempestconf
## -------------------------------------------------------
## ::
export TEMPESTCONF="{{ tempestconf }}"
# Source rc file for tempestconf generation
source {{ rc_file }}
{% if tempest_overcloud|bool %}
# Get public net id
{% if release == 'newton' %}
public_net_id=$(neutron net-show {{ public_net_name }} -f value -c id)
{% else %}
public_net_id=$(openstack network show {{ public_net_name }} -f value -c id)
{% endif %}
{% endif %}
{% if not tempest_overcloud|bool %}
{% if release not in ['newton', 'ocata'] %}
# OS_AUTH_URL does not contains identity api version in stackrc from
# Pike onwards.
export OS_AUTH_URL="$OS_AUTH_URL/v$OS_IDENTITY_API_VERSION"
{% elif release == 'pike' %}
# Use Identity version v2.0 for pike
export OS_AUTH_URL="$OS_AUTH_URL/v2.0"
{% endif %}
{% endif %}
# Generate Tempest Config file using python-tempestconf
# Notice aodh_plugin will be set to False if telemetry service is disabled
# TODO(arxcruz) In the future the
# compute_feature_enabled.attach_encrypted_volume should be handled by
# python-tempestconf tool
cd {{ tempest_dir }}
$TEMPESTCONF --out etc/tempest.conf \
{% if tempest_overcloud|bool %}
--deployer-input ~/{{ tempest_deployer_input_file }} \
--network-id $public_net_id \
{% endif %}
--image {{ tempest_test_image_path }} \
--debug \
{% if tempest_conf_removal and tempest_overcloud|bool %}
{% for key, value in tempest_conf_removal.iteritems() %}
--remove {{ key }}={{ value }} \
{% endfor %}
{% endif %}
--create \
{% if tempest_format == 'container' %}
DEFAULT.log_dir {{ tempest_log_dir }} \
DEFAULT.log_file {{ tempest_log_file }} \
{% endif %}
{% if release in ['newton', 'ocata', 'pike'] %}
identity.uri $OS_AUTH_URL \
identity.admin_password $OS_PASSWORD \
identity.admin_username $OS_USERNAME \
compute.allow_tenant_isolation true \
scenario.img_file {{ tempest_test_image_name }} \
{% else %}
auth.use_dynamic_credentials true \
auth.tempest_roles Member \
network-feature-enabled.port_security true \
{% endif %}
compute-feature-enabled.attach_encrypted_volume False \
network.tenant_network_cidr {{ tenant_network_cidr }} \
compute.build_timeout 500 \
volume-feature-enabled.api_v1 False \
validation.image_ssh_user cirros \
validation.ssh_user cirros \
network.build_timeout 500 \
volume.build_timeout 500 \
{% if 'disable-telemetry.yaml' in telemetry_args|default('') %}
service_available.aodh_plugin False \
{% endif %}
{% if tempest_extra_config %}
{% for key, value in tempest_extra_config.iteritems() %}
{{ key }} {{ value }} \
{% endfor %}
{% endif %}
compute-feature-enabled.console_output true \
orchestration.stack_owner_role Member
### --stop_docs