Skip to content

Commit e912437

Browse files
committed
Add docs page for running Tempest
1 parent b189927 commit e912437

File tree

2 files changed

+294
-0
lines changed

2 files changed

+294
-0
lines changed

doc/source/operations/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ This guide is for operators of the StackHPC Kayobe configuration project.
1313
rocky-linux-9
1414
ubuntu-jammy
1515
secret-rotation
16+
tempest

doc/source/operations/tempest.rst

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
======================================
2+
Running Tempest with Kayobe Automation
3+
======================================
4+
5+
Overview
6+
========
7+
8+
This document describes how to configure and run `Tempest
9+
<https://docs.openstack.org/tempest/latest/>`_ using `kayobe-automation
10+
<https://github.com/stackhpc/kayobe-automation>`_ from the ``.automation``
11+
submodule included with ``stackhpc-kayobe-config``.
12+
13+
The following guide will assume all commands are run from your
14+
``kayobe-config`` root and the environment has been configured to run Kayobe
15+
commands unless stated otherwise.
16+
17+
Building a Kayobe container
18+
===========================
19+
``kayobe-automation`` runs in a container on the Ansible control host. This
20+
means that Docker must be installed on the Ansible control host if it is not
21+
already.
22+
23+
.. warning::
24+
25+
Docker can cause networking issues when it is installed. By default it will
26+
create a bridge and change ``iptables`` rules. These can be
27+
disabled by setting the following in ``/etc/docker/daemon.json``:
28+
29+
.. code-block:: json
30+
31+
{
32+
"bridge": "none",
33+
"iptables": false
34+
}
35+
36+
To install Docker on Ubuntu:
37+
38+
.. code-block:: bash
39+
40+
# Add Docker's official GPG key:
41+
sudo apt-get update
42+
sudo apt-get install ca-certificates curl
43+
sudo install -m 0755 -d /etc/apt/keyrings
44+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
45+
sudo chmod a+r /etc/apt/keyrings/docker.asc
46+
47+
# Add the repository to Apt sources:
48+
echo \
49+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
50+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
51+
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
52+
sudo apt-get update
53+
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
54+
55+
Installing Docker on CentOS/Rocky:
56+
57+
.. code-block:: bash
58+
59+
sudo yum install -y yum-utils
60+
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
61+
62+
Ensure Docker is running:
63+
64+
.. code-block:: bash
65+
66+
sudo systemctl start docker
67+
68+
The Docker ``buildx`` plugin must be installed. If you are using an existing
69+
installation of docker, you may need to install it with:
70+
71+
.. code-block:: bash
72+
73+
sudo dnf/apt install docker-buildx-plugin
74+
sudo docker buildx install
75+
# or if that fails:
76+
sudo docker plugin install buildx
77+
78+
Build a Kayobe automation image:
79+
80+
.. code-block:: bash
81+
82+
git submodule init
83+
git submodule update
84+
# If running on Ubuntu, the fact cache can confuse Kayobe in the CentOS-based container
85+
mv etc/kayobe/facts{,-old}
86+
sudo DOCKER_BUILDKIT=1 docker build --file .automation/docker/kayobe/Dockerfile --tag kayobe:latest .
87+
88+
Configuration
89+
=============
90+
91+
Kayobe automation configuration files are stored in the ``.automation.conf/``
92+
directory. It contains:
93+
94+
- A script used to export environment variables for meta configuration of
95+
Tempest - ``.automation.conf/config.sh``.
96+
- Tempest configuration override files, stored in ``.automation.conf/tempest/``
97+
and conventionally named ``tempest.overrides.conf`` or
98+
``tempest-<environment>.overrides.conf``.
99+
- Tempest load lists, stored in ``.automation.conf/tempest/load-lists``.
100+
- Tempest skip lists, stored in ``.automation.conf/tempest/skip-lists``.
101+
102+
config.sh
103+
---------
104+
105+
``config.sh`` is a mandatory shell script, primarily used to export environment
106+
variables for the meta configuration of Tempest.
107+
108+
See:
109+
https://github.com/stackhpc/docker-rally/blob/master/bin/rally-verify-wrapper.sh
110+
for a full list of tempest parameters that can be overridden.
111+
112+
The most common variables to override are:
113+
114+
- ``TEMPEST_CONCURRENCY`` - The maximum number of tests to run in parallel at
115+
one time. Higher values are faster but increase the risk of timeouts. 1-2 is
116+
safest in CI/Tenks/Multinode/AIO etc. 8-32 is typical in production. Default
117+
value is 2.
118+
- ``KAYOBE_AUTOMATION_TEMPEST_LOADLIST``: the filename of a load list in the
119+
``load-lists`` directory. Default value is ``default`` (symlink to refstack).
120+
- ``KAYOBE_AUTOMATION_TEMPEST_SKIPLIST``: the filename of a load list in the
121+
``skip-lists`` directory. Default value is unset.
122+
- ``TEMPEST_OPENRC``: The **contents** of an ``openrc.sh`` file, to be used by
123+
Tempest to create resources on the cloud. Default is to read in the contents
124+
of ``etc/kolla/public-openrc.sh``.
125+
126+
tempest.overrides.conf
127+
----------------------
128+
129+
Tempest uses a configuration file to define which tests are run and how to run
130+
them. A full sample configuration file can be found `here
131+
<https://docs.openstack.org/tempest/latest/sampleconf.html>`_. Sensible
132+
defaults exist for all values and in most situations, a blank
133+
``*overrides.conf`` file will successfully run many tests. It will however also
134+
skip many tests which may otherwise be appropriate to run.
135+
136+
Below is an example file including many of the most common overrides. It makes
137+
many assumptions about the environment, so make sure you understand all the
138+
options before applying them.
139+
140+
.. NOTE(upgrade): Microversions change for each release
141+
142+
.. code-block:: ini
143+
144+
[openstack]
145+
# Use a StackHPC-built image without a default password.
146+
img_url=https://github.com/stackhpc/cirros/releases/download/20231206/cirros-d231206-x86_64-disk.img
147+
148+
[auth]
149+
# Expect unlimited quotas for CPU cores and RAM
150+
compute_quotas = cores:-1,ram:-1
151+
152+
[compute]
153+
# Required for migration testing
154+
min_compute_nodes = 2
155+
# Required to test some API features
156+
min_microversion = 2.1
157+
max_microversion = 2.90
158+
# Flavors for creating test servers and server resize. The ``alt`` flavor should be larger.
159+
flavor_ref = <flavor UUID>
160+
flavor_ref_alt = <different flavor UUID>
161+
volume_multiattach = true
162+
163+
[compute-feature-enabled]
164+
# Required for migration testing
165+
resize = true
166+
live_migration = true
167+
block_migration_for_live_migration = false
168+
volume_backed_live_migration = true
169+
170+
[placement]
171+
min_microversion = "1.0"
172+
max_microversion = "1.39"
173+
174+
[volume]
175+
storage_protocol = ceph
176+
# Required to test some API features
177+
min_microversion = 3.0
178+
max_microversion = 3.68
179+
180+
Tempest configuration override files are stored in
181+
``.automation.conf/tempest/``. The default file used is
182+
``tempest.overrides.conf`` or ``tempest-<environment>.overrides.conf``
183+
depending on whether a Kayobe environment is enabled. This can be changed by
184+
setting ``KAYOBE_AUTOMATION_TEMPEST_CONF_OVERRIDES`` to a different file path.
185+
An ``overrides.conf`` file must be supplied, even if it is blank.
186+
187+
Load Lists
188+
----------
189+
190+
Load lists are a newline-separated list of tests to run. They are stored in
191+
``.automation.conf/tempest/load-lists/``. The directory contains three objects
192+
by default:
193+
194+
- ``tempest-full`` - A complete list of all possible tests.
195+
- ``platform.2022.11-test-list.txt`` - A reduced list of tests to match the
196+
`Refstack <https://docs.opendev.org/openinfra/refstack/latest/>`_ standard.
197+
- ``default`` - A symlink to ``platform.2022.11-test-list.txt``.
198+
199+
Test lists can be selected by changing ``KAYOBE_AUTOMATION_TEMPEST_SKIPLIST``
200+
in ``config.sh``. The default value is ``default``, which symlinks to
201+
``platform.2022.11-test-list.txt``.
202+
203+
A common use case is to use the ``failed-tests`` list output from a previous
204+
tempest run as a load list, to retry the failed tests after making changes.
205+
206+
Skip Lists
207+
----------
208+
209+
Skip lists are a newline-separated list of tests to Skip. They are stored in
210+
``.automation.conf/tempest/skip-lists/``. Each line consists of a pattern to
211+
match against test names, and a string explaining why the test is being
212+
skipped e.g.
213+
214+
.. code-block::
215+
216+
tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_subnet_details.*: "Cirros image doesn't have /var/run/udhcpc.eth0.pid"
217+
218+
There is no requirement for a skip list, and none is selected by default. A
219+
skip list can be selected by setting ``KAYOBE_AUTOMATION_TEMPEST_SKIPLIST`` in
220+
``config.sh``.
221+
222+
Tempest runner
223+
--------------
224+
225+
While the Kayobe automation container is always deployed to the ansible control
226+
host, the Tempest container is deployed to the host in the ``tempest_runner``
227+
group, which can be any host in the Kayobe inventory. The group should only
228+
ever contain one host. The seed is usually used as the tempest runner however
229+
it is also common to use the Ansible control host or an infrastructure VM. The
230+
main requirement of the host is that it can reach the OpenStack API.
231+
232+
Running Tempest
233+
===============
234+
235+
Kayobe automation will need to SSH to the tempest runner (even if they are on
236+
the same host), so requires an SSH key exported as
237+
``KAYOBE_AUTOMATION_SSH_PRIVATE_KEY`` e.g.
238+
239+
.. code-block:: bash
240+
241+
export KAYOBE_AUTOMATION_SSH_PRIVATE_KEY=$(cat ~/.ssh/id_rsa)
242+
243+
Tempest outputs will be sent to the ``tempest-artifacts/`` directory. Create
244+
one if it does not exist.
245+
246+
.. code-block:: bash
247+
248+
mkdir tempest-artifacts
249+
250+
The contents of ``tempest-artifacts`` will be overwritten. Ensure any previous
251+
test results have been copied away.
252+
253+
The Tempest playbook is invoked through the Kayobe container using this
254+
command from the base of the ``kayobe-config`` directory:
255+
256+
.. code-block:: bash
257+
258+
sudo -E docker run -it --rm --network host -v $(pwd):/stack/kayobe-automation-env/src/kayobe-config -v $(pwd)/tempest-artifacts:/stack/tempest-artifacts -e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY kayobe:latest /stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/tempest.sh -e ansible_user=stack
259+
260+
By default, ``no_log`` is set to stop credentials from leaking. This can be
261+
disabled by adding ``-e rally_no_sensitive_log=false`` to the end.
262+
263+
Progress can be watched by following the logs of the tempest container on the
264+
``tempest_runner`` host.
265+
266+
.. code-block:: bash
267+
268+
ssh <tempest-runner>
269+
sudo docker logs -f tempest
270+
271+
Outputs
272+
-------
273+
274+
Tempest outputs will be sent to the ``tempest-artifacts/`` directory. It
275+
contain the following artifacts:
276+
277+
- ``docker.log`` - The logs from the ``tempest`` docker container
278+
- ``failed-tests`` - A simple list of tests that failed
279+
- ``rally-junit.xml`` - An XML file listing all tests in the test list and
280+
their status (skipped/succeeded/failed). Usually not useful.
281+
- ``rally-verify-report.html`` - An HTML page with all test results including
282+
an error trace for failed tests. It is often best to ``scp`` this file back
283+
to your local machine to view it. This is the most user-friendly way to view
284+
the test results, however can be awkward to host.
285+
- ``rally-verify-report.json`` - A JSON blob with all test results including an
286+
error trace for failed tests. It contains all the same data as the HTML
287+
report but without the formatting.
288+
- ``stderr.log`` - The stderr log. Usually not useful.
289+
- ``stdout.log`` - The stdout log. Usually not useful.
290+
- ``tempest-load-list`` - The load list that Tempest was invoked with.
291+
- ``tempest.log`` - Detailed logs from Tempest. Contains more data than the
292+
``verify`` reports, but can be difficult to parse. Useful for tracing specific
293+
errors.

0 commit comments

Comments
 (0)