]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/developer_guide/testing_integration_tests/tests-integration-testing-teuthology-intro.rst
import ceph quincy 17.2.6
[ceph.git] / ceph / doc / dev / developer_guide / testing_integration_tests / tests-integration-testing-teuthology-intro.rst
CommitLineData
20effc67 1.. _tests-integration-testing-teuthology-intro:
f67539c2 2
20effc67
TL
3Testing - Integration Tests - Introduction
4==========================================
9f95a23c 5
20effc67
TL
6Ceph has two types of tests: :ref:`make check <make-check>` tests and
7integration tests. When a test requires multiple machines, root access, or lasts
8for a long time (for example, to simulate a realistic Ceph workload), it is
9deemed to be an integration test. Integration tests are organized into "suites",
10which are defined in the `ceph/qa sub-directory`_ and run with the
11``teuthology-suite`` command.
9f95a23c
TL
12
13The ``teuthology-suite`` command is part of the `teuthology framework`_.
14In the sections that follow we attempt to provide a detailed introduction
15to that framework from the perspective of a beginning Ceph developer.
16
17Teuthology consumes packages
18----------------------------
19
20It may take some time to understand the significance of this fact, but it
21is `very` significant. It means that automated tests can be conducted on
22multiple platforms using the same packages (RPM, DEB) that can be
23installed on any machine running those platforms.
24
25Teuthology has a `list of platforms that it supports
20effc67
TL
26<https://github.com/ceph/ceph/tree/master/qa/distros/supported>`_ (as of
27September 2020 the list consisted of "RHEL/CentOS 8" and "Ubuntu 18.04"). It
28expects to be provided pre-built Ceph packages for these platforms. Teuthology
29deploys these platforms on machines (bare-metal or cloud-provisioned), installs
30the packages on them, and deploys Ceph clusters on them - all as called for by
31the test.
9f95a23c
TL
32
33The Nightlies
34-------------
35
36A number of integration tests are run on a regular basis in the `Sepia
37lab`_ against the official Ceph repositories (on the ``master`` development
38branch and the stable branches). Traditionally, these tests are called "the
39nightlies" because the Ceph core developers used to live and work in
40the same time zone and from their perspective the tests were run overnight.
41
20effc67
TL
42The results of nightly test runs are published at http://pulpito.ceph.com/
43under the user ``teuthology``. The developer nick appears in URL of the the
44test results and in the first column of the Pulpito dashboard. The results are
45also reported on the `ceph-qa mailing list <https://ceph.com/irc/>`_.
9f95a23c
TL
46
47Testing Priority
48----------------
49
20effc67
TL
50In brief: in the ``teuthology-suite`` command option ``-p <N>``, set the value of ``<N>`` to a number lower than 1000. An explanation of why follows.
51
52The ``teuthology-suite`` command includes an option ``-p <N>``. This option specifies the priority of the jobs submitted to the queue. The lower the value of ``N``, the higher the priority.
53
54The default value of ``N`` is ``1000``. This is the same priority value given to the nightly tests (the nightlies). Often, the volume of testing done during the nightly tests is so great that the full number of nightly tests do not get run during the time allotted for their run.
55
56Set the value of ``N`` lower than ``1000``, or your tests will not have priority over the nightly tests. This means that they might never run.
57
58Select your job's priority (the value of ``N``) in accordance with the following guidelines:
59
60.. list-table::
61 :widths: 30 30
62 :header-rows: 1
63
64 * - Priority
65 - Explanation
66 * - **N < 10**
67 - Use this if the sky is falling and some group of tests must be run ASAP.
68 * - **10 <= N < 50**
69 - Use this if your tests are urgent and blocking other important
70 development.
71 * - **50 <= N < 75**
72 - Use this if you are testing a particular feature/fix and running fewer
73 than about 25 jobs. This range is also used for urgent release testing.
74 * - **75 <= N < 100**
75 - Tech Leads regularly schedule integration tests with this priority to
76 verify pull requests against master.
77 * - **100 <= N < 150**
78 - This priority is used for QE validation of point releases.
79 * - **150 <= N < 200**
80 - Use this priority for 100 jobs or fewer that test a particular feature
81 or fix. Results are available in about 24 hours.
82 * - **200 <= N < 1000**
83 - Use this priority for large test runs. Results are available in about a
84 week.
85
86To see how many jobs the ``teuthology-suite`` command will trigger, use the
87``--dry-run`` flag. If you are happy with the number of jobs returned by the
88dry run, issue the ``teuthology-suite`` command again without ``--dry-run`` and
89with ``-p`` and an appropriate number as an argument.
90
91To skip the priority check, use ``--force-priority``. Be considerate of the needs of other developers to run tests, and use ``--force-priority`` only in emergencies.
9f95a23c 92
20effc67
TL
93Suites Inventory
94----------------
9f95a23c 95
20effc67
TL
96The ``suites`` directory of the `ceph/qa sub-directory`_ contains all the
97integration tests for all the Ceph components.
9f95a23c 98
20effc67 99.. list-table:: **Suites**
9f95a23c 100
20effc67
TL
101 * - **Component**
102 - **Function**
9f95a23c 103
20effc67
TL
104 * - `ceph-deploy <https://github.com/ceph/ceph/tree/master/qa/suites/ceph-deploy>`_
105 - install a Ceph cluster with ``ceph-deploy`` (`ceph-deploy man page`_)
f67539c2 106
20effc67
TL
107 * - `dummy <https://github.com/ceph/ceph/tree/master/qa/suites/dummy>`_
108 - get a machine, do nothing and return success (commonly used to verify
109 that the integration testing infrastructure works as expected)
9f95a23c 110
20effc67
TL
111 * - `fs <https://github.com/ceph/ceph/tree/master/qa/suites/fs>`_
112 - test CephFS mounted using kernel and FUSE clients, also with multiple MDSs.
9f95a23c 113
20effc67
TL
114 * - `krbd <https://github.com/ceph/ceph/tree/master/qa/suites/krbd>`_
115 - test the RBD kernel module
9f95a23c 116
20effc67
TL
117 * - `powercycle <https://github.com/ceph/ceph/tree/master/qa/suites/powercycle>`_
118 - verify the Ceph cluster behaves when machines are powered off and on
119 again
9f95a23c 120
20effc67
TL
121 * - `rados <https://github.com/ceph/ceph/tree/master/qa/suites/rados>`_
122 - run Ceph clusters including OSDs and MONs, under various conditions of
123 stress
9f95a23c 124
20effc67
TL
125 * - `rbd <https://github.com/ceph/ceph/tree/master/qa/suites/rbd>`_
126 - run RBD tests using actual Ceph clusters, with and without qemu
9f95a23c 127
20effc67
TL
128 * - `rgw <https://github.com/ceph/ceph/tree/master/qa/suites/rgw>`_
129 - run RGW tests using actual Ceph clusters
9f95a23c 130
20effc67
TL
131 * - `smoke <https://github.com/ceph/ceph/tree/master/qa/suites/smoke>`_
132 - run tests that exercise the Ceph API with an actual Ceph cluster
9f95a23c 133
20effc67
TL
134 * - `teuthology <https://github.com/ceph/ceph/tree/master/qa/suites/teuthology>`_
135 - verify that teuthology can run integration tests, with and without OpenStack
9f95a23c 136
20effc67 137 * - `upgrade <https://github.com/ceph/ceph/tree/master/qa/suites/upgrade>`_
39ae355f 138 - for various versions of Ceph, verify that upgrades can happen without disrupting an ongoing workload (`Upgrade Testing`_)
9f95a23c 139
20effc67
TL
140teuthology-describe
141-------------------
9f95a23c 142
20effc67
TL
143``teuthology-describe`` was added to the `teuthology framework`_ to facilitate
144documentation and better understanding of integration tests.
9f95a23c 145
20effc67
TL
146Tests can be documented by embedding ``meta:`` annotations in the yaml files
147used to define the tests. The results can be seen in the `teuthology-desribe
148usecases`_
9f95a23c 149
20effc67
TL
150Since this is a new feature, many yaml files have yet to be annotated.
151Developers are encouraged to improve the coverage and the quality of the
152documentation.
9f95a23c 153
20effc67
TL
154How to run integration tests
155----------------------------
9f95a23c 156
20effc67
TL
157Typically, the `Sepia lab`_ is used to run integration tests. But as a new Ceph
158developer, you will probably not have access to the `Sepia lab`_. You might
159however be able to run some integration tests in an environment separate from
160the `Sepia lab`_ . Ask members from the relevant team how to do this.
9f95a23c 161
20effc67
TL
162One way to run your own integration tests is to set up a teuthology cluster on
163bare metal. Setting up a teuthology cluster on bare metal is a complex task.
164Here are `some notes
165<https://docs.ceph.com/projects/teuthology/en/latest/LAB_SETUP.html>`_ to get
166you started if you decide that you are interested in undertaking the complex
167task of setting up a teuthology cluster on bare metal.
9f95a23c 168
20effc67
TL
169Running integration tests on your code contributions and publishing the results
170allows reviewers to verify that changes to the code base do not cause
171regressions, and allows reviewers to analyze test failures when they occur.
9f95a23c
TL
172
173Every teuthology cluster, whether bare-metal or cloud-provisioned, has a
174so-called "teuthology machine" from which tests suites are triggered using the
175``teuthology-suite`` command.
176
177A detailed and up-to-date description of each `teuthology-suite`_ option is
20effc67 178available by running the following command on the teuthology machine:
f67539c2
TL
179
180.. prompt:: bash $
9f95a23c 181
f67539c2 182 teuthology-suite --help
9f95a23c 183
20effc67 184.. _teuthology-suite: https://docs.ceph.com/projects/teuthology/en/latest/commands/teuthology-suite.html
9f95a23c
TL
185
186How integration tests are defined
187---------------------------------
188
189Integration tests are defined by yaml files found in the ``suites``
190subdirectory of the `ceph/qa sub-directory`_ and implemented by python
191code found in the ``tasks`` subdirectory. Some tests ("standalone tests")
192are defined in a single yaml file, while other tests are defined by a
193directory tree containing yaml files that are combined, at runtime, into a
194larger yaml file.
195
20effc67
TL
196
197.. _reading-standalone-test:
198
9f95a23c
TL
199Reading a standalone test
200-------------------------
201
202Let us first examine a standalone test, or "singleton".
203
204Here is a commented example using the integration test
205`rados/singleton/all/admin-socket.yaml
206<https://github.com/ceph/ceph/blob/master/qa/suites/rados/singleton/all/admin-socket.yaml>`_
f67539c2
TL
207
208.. code-block:: yaml
9f95a23c
TL
209
210 roles:
211 - - mon.a
212 - osd.0
213 - osd.1
214 tasks:
215 - install:
216 - ceph:
217 - admin_socket:
218 osd.0:
219 version:
220 git_version:
221 help:
222 config show:
223 config set filestore_dump_file /tmp/foo:
224 perf dump:
225 perf schema:
226
227The ``roles`` array determines the composition of the cluster (how
228many MONs, OSDs, etc.) on which this test is designed to run, as well
229as how these roles will be distributed over the machines in the
230testing cluster. In this case, there is only one element in the
231top-level array: therefore, only one machine is allocated to the
232test. The nested array declares that this machine shall run a MON with
233id ``a`` (that is the ``mon.a`` in the list of roles) and two OSDs
234(``osd.0`` and ``osd.1``).
235
236The body of the test is in the ``tasks`` array: each element is
237evaluated in order, causing the corresponding python file found in the
238``tasks`` subdirectory of the `teuthology repository`_ or
239`ceph/qa sub-directory`_ to be run. "Running" in this case means calling
240the ``task()`` function defined in that file.
241
242In this case, the `install
243<https://github.com/ceph/teuthology/blob/master/teuthology/task/install/__init__.py>`_
244task comes first. It installs the Ceph packages on each machine (as
245defined by the ``roles`` array). A full description of the ``install``
246task is `found in the python file
247<https://github.com/ceph/teuthology/blob/master/teuthology/task/install/__init__.py>`_
248(search for "def task").
249
250The ``ceph`` task, which is documented `here
251<https://github.com/ceph/ceph/blob/master/qa/tasks/ceph.py>`__ (again,
252search for "def task"), starts OSDs and MONs (and possibly MDSs as well)
253as required by the ``roles`` array. In this example, it will start one MON
254(``mon.a``) and two OSDs (``osd.0`` and ``osd.1``), all on the same
255machine. Control moves to the next task when the Ceph cluster reaches
256``HEALTH_OK`` state.
257
258The next task is ``admin_socket`` (`source code
259<https://github.com/ceph/ceph/blob/master/qa/tasks/admin_socket.py>`_).
260The parameter of the ``admin_socket`` task (and any other task) is a
261structure which is interpreted as documented in the task. In this example
262the parameter is a set of commands to be sent to the admin socket of
263``osd.0``. The task verifies that each of them returns on success (i.e.
264exit code zero).
265
f67539c2
TL
266This test can be run with
267
268.. prompt:: bash $
9f95a23c 269
f67539c2 270 teuthology-suite --machine-type smithi --suite rados/singleton/all/admin-socket.yaml fs/ext4.yaml
9f95a23c
TL
271
272Test descriptions
273-----------------
274
275Each test has a "test description", which is similar to a directory path,
276but not the same. In the case of a standalone test, like the one in
277`Reading a standalone test`_, the test description is identical to the
278relative path (starting from the ``suites/`` directory of the
279`ceph/qa sub-directory`_) of the yaml file defining the test.
280
281Much more commonly, tests are defined not by a single yaml file, but by a
282`directory tree of yaml files`. At runtime, the tree is walked and all yaml
283files (facets) are combined into larger yaml "programs" that define the
284tests. A full listing of the yaml defining the test is included at the
285beginning of every test log.
286
287In these cases, the description of each test consists of the
288subdirectory under `suites/
289<https://github.com/ceph/ceph/tree/master/qa/suites>`_ containing the
290yaml facets, followed by an expression in curly braces (``{}``) consisting of
291a list of yaml facets in order of concatenation. For instance the
292test description::
293
294 ceph-deploy/basic/{distros/centos_7.0.yaml tasks/ceph-deploy.yaml}
295
296signifies the concatenation of two files:
297
298* ceph-deploy/basic/distros/centos_7.0.yaml
299* ceph-deploy/basic/tasks/ceph-deploy.yaml
300
301How tests are built from directories
302------------------------------------
303
304As noted in the previous section, most tests are not defined in a single
305yaml file, but rather as a `combination` of files collected from a
306directory tree within the ``suites/`` subdirectory of the `ceph/qa sub-directory`_.
307
308The set of all tests defined by a given subdirectory of ``suites/`` is
309called an "integration test suite", or a "teuthology suite".
310
311Combination of yaml facets is controlled by special files (``%`` and
312``+``) that are placed within the directory tree and can be thought of as
313operators. The ``%`` file is the "convolution" operator and ``+``
314signifies concatenation.
315
316Convolution operator
317^^^^^^^^^^^^^^^^^^^^
318
319The convolution operator, implemented as an empty file called ``%``, tells
320teuthology to construct a test matrix from yaml facets found in
321subdirectories below the directory containing the operator.
322
323For example, the `ceph-deploy suite
f67539c2 324<https://github.com/ceph/ceph/tree/master/qa/suites/ceph-deploy/>`_ is
9f95a23c 325defined by the ``suites/ceph-deploy/`` tree, which consists of the files and
f67539c2 326subdirectories in the following structure
9f95a23c 327
f67539c2
TL
328.. code-block:: none
329
330 qa/suites/ceph-deploy
331 ├── %
332 ├── distros
333 │   ├── centos_latest.yaml
334 │   └── ubuntu_latest.yaml
335 └── tasks
336 ├── ceph-admin-commands.yaml
337 └── rbd_import_export.yaml
9f95a23c
TL
338
339This is interpreted as a 2x1 matrix consisting of two tests:
340
3411. ceph-deploy/basic/{distros/centos_7.0.yaml tasks/ceph-deploy.yaml}
3422. ceph-deploy/basic/{distros/ubuntu_16.04.yaml tasks/ceph-deploy.yaml}
343
344i.e. the concatenation of centos_7.0.yaml and ceph-deploy.yaml and
345the concatenation of ubuntu_16.04.yaml and ceph-deploy.yaml, respectively.
346In human terms, this means that the task found in ``ceph-deploy.yaml`` is
347intended to run on both CentOS 7.0 and Ubuntu 16.04.
348
349Without the file percent, the ``ceph-deploy`` tree would be interpreted as
350three standalone tests:
351
352* ceph-deploy/basic/distros/centos_7.0.yaml
353* ceph-deploy/basic/distros/ubuntu_16.04.yaml
354* ceph-deploy/basic/tasks/ceph-deploy.yaml
355
356(which would of course be wrong in this case).
357
358Referring to the `ceph/qa sub-directory`_, you will notice that the
359``centos_7.0.yaml`` and ``ubuntu_16.04.yaml`` files in the
360``suites/ceph-deploy/basic/distros/`` directory are implemented as symlinks.
361By using symlinks instead of copying, a single file can appear in multiple
362suites. This eases the maintenance of the test framework as a whole.
363
364All the tests generated from the ``suites/ceph-deploy/`` directory tree
f67539c2
TL
365(also known as the "ceph-deploy suite") can be run with
366
367.. prompt:: bash $
9f95a23c 368
f67539c2 369 teuthology-suite --machine-type smithi --suite ceph-deploy
9f95a23c
TL
370
371An individual test from the `ceph-deploy suite`_ can be run by adding the
f67539c2 372``--filter`` option
9f95a23c 373
f67539c2
TL
374.. prompt:: bash $
375
376 teuthology-suite \
377 --machine-type smithi \
9f95a23c
TL
378 --suite ceph-deploy/basic \
379 --filter 'ceph-deploy/basic/{distros/ubuntu_16.04.yaml tasks/ceph-deploy.yaml}'
380
381.. note:: To run a standalone test like the one in `Reading a standalone
382 test`_, ``--suite`` alone is sufficient. If you want to run a single
383 test from a suite that is defined as a directory tree, ``--suite`` must
384 be combined with ``--filter``. This is because the ``--suite`` option
385 understands POSIX relative paths only.
386
387Concatenation operator
388^^^^^^^^^^^^^^^^^^^^^^
389
390For even greater flexibility in sharing yaml files between suites, the
391special file plus (``+``) can be used to concatenate files within a
392directory. For instance, consider the `suites/rbd/thrash
393<https://github.com/ceph/ceph/tree/master/qa/suites/rbd/thrash>`_
f67539c2
TL
394tree
395
396.. code-block:: none
397
398 qa/suites/rbd/thrash
399 ├── %
400 ├── clusters
401 │   ├── +
402 │   ├── fixed-2.yaml
403 │   └── openstack.yaml
404 └── workloads
405 ├── rbd_api_tests_copy_on_read.yaml
406 ├── rbd_api_tests.yaml
407 └── rbd_fsx_rate_limit.yaml
9f95a23c
TL
408
409This creates two tests:
410
411* rbd/thrash/{clusters/fixed-2.yaml clusters/openstack.yaml workloads/rbd_api_tests_copy_on_read.yaml}
412* rbd/thrash/{clusters/fixed-2.yaml clusters/openstack.yaml workloads/rbd_api_tests.yaml}
413
414Because the ``clusters/`` subdirectory contains the special file plus
415(``+``), all the other files in that subdirectory (``fixed-2.yaml`` and
416``openstack.yaml`` in this case) are concatenated together
417and treated as a single file. Without the special file plus, they would
418have been convolved with the files from the workloads directory to create
419a 2x2 matrix:
420
421* rbd/thrash/{clusters/openstack.yaml workloads/rbd_api_tests_copy_on_read.yaml}
422* rbd/thrash/{clusters/openstack.yaml workloads/rbd_api_tests.yaml}
423* rbd/thrash/{clusters/fixed-2.yaml workloads/rbd_api_tests_copy_on_read.yaml}
424* rbd/thrash/{clusters/fixed-2.yaml workloads/rbd_api_tests.yaml}
425
426The ``clusters/fixed-2.yaml`` file is shared among many suites to
f67539c2
TL
427define the following ``roles``
428
429.. code-block:: yaml
9f95a23c
TL
430
431 roles:
432 - [mon.a, mon.c, osd.0, osd.1, osd.2, client.0]
433 - [mon.b, osd.3, osd.4, osd.5, client.1]
434
435The ``rbd/thrash`` suite as defined above, consisting of two tests,
f67539c2
TL
436can be run with
437
438.. prompt:: bash $
9f95a23c 439
f67539c2 440 teuthology-suite --machine-type smithi --suite rbd/thrash
9f95a23c
TL
441
442A single test from the rbd/thrash suite can be run by adding the
f67539c2 443``--filter`` option
9f95a23c 444
f67539c2
TL
445.. prompt:: bash $
446
447 teuthology-suite \
448 --machine-type smithi \
9f95a23c
TL
449 --suite rbd/thrash \
450 --filter 'rbd/thrash/{clusters/fixed-2.yaml clusters/openstack.yaml workloads/rbd_api_tests_copy_on_read.yaml}'
451
39ae355f
TL
452.. _upgrade-testing:
453
454Upgrade Testing
455^^^^^^^^^^^^^^^
456
457Using the upgrade suite we are able to verify that upgrades from earlier releases can complete
458successfully without disrupting any ongoing workload.
459Each Release branch upgrade directory includes 2-x upgrade testing.
460Meaning, we are able to test the upgrade from 2 preceding releases to the current one.
461The upgrade sequence is done in `parallel <https://github.com/ceph/teuthology/blob/main/teuthology/task/parallel.py>`_
462with other given workloads.
463
464For instance, the upgrade test directory from the Quincy release branch is as follows:
465
466.. code-block:: none
467
468 .
469 ├── octopus-x
470 └── pacific-x
471
472It is possible to test upgrades from Octopus (2-x) or from Pacific (1-x) to Quincy (x).
473A simple upgrade test consists the following order:
474
475.. code-block:: none
476
477 ├── 0-start.yaml
478 ├── 1-tasks.yaml
479 ├── upgrade-sequence.yaml
480 └── workload
481
482After starting the cluster with the older release we begin running the given ``workload``
483and the ``upgrade-sequnce`` in parallel.
484
485.. code-block:: yaml
486
487 - print: "**** done start parallel"
488 - parallel:
489 - workload
490 - upgrade-sequence
491 - print: "**** done end parallel"
492
493While the ``workload`` directory consists regular yaml files just as in any other suite,
494the ``upgrade-sequnce`` is resposible for running the upgrade and awaitng its completion:
495
496.. code-block:: yaml
497
498 - print: "**** done start upgrade, wait"
499 ...
500 mon.a:
501 - ceph orch upgrade start --image quay.ceph.io/ceph-ci/ceph:$sha1
502 - while ceph orch upgrade status | jq '.in_progress' | grep true ; do ceph orch ps ; ceph versions ; sleep 30 ; done\
503 ...
504 - print: "**** done end upgrade, wait..."
505
506
507It is also possible to upgrade in stages while running workloads in between those:
508
509.. code-block:: none
510
511 ├── %
512 ├── 0-cluster
513 ├── 1-ceph-install
514 ├── 2-partial-upgrade
515 ├── 3-thrash
516 ├── 4-workload
517 ├── 5-finish-upgrade.yaml
518 ├── 6-quincy.yaml
519 └── 8-final-workload
520
521After starting a cluster we upgrade only 2/3 of the cluster (``2-partial-upgrade``).
522The next stage is running thrash tests and given workload tests. Later on, continuing to upgrade the
523rest of the cluster (``5-finish-upgrade.yaml``).
524The last stage is requiring the updated release (``ceph require-osd-release quincy``,
525``ceph osd set-require-min-compat-client quincy``) and running the ``final-workload``.
526
527Position Independent Linking
528----------------------------
529
530Under the ``qa/suites`` directory are ``.qa`` symbolic links in every
531directory. Each link is recursive by always linking to ``../.qa/``. The final
532terminating link is in the ``qa/`` directory itself as ``qa/.qa -> .``. This
533layout of symbolic links allows a suite to be easily copied or moved without
534breaking a number of symbolic links. For example::
535
536 qa/suites/fs/upgrade/nofs/centos_latest.yaml -> .qa/distros/supported/centos_latest.yaml
537
538If we copy the ``nofs`` suite somewhere else, add a parent directory above
539``nofs``, or move the ``centos_latest.yaml`` fragment into a sub-directory, the
540link will not break. Compare to::
541
542 qa/suites/fs/upgrade/nofs/centos_latest.yaml -> ../../../../distros/supported/centos_latest.yaml
543
544If the link is moved, it is very likely it will break because the number of
545parent directories to reach the ``distros`` directory may change.
546
547When adding new directories or suites, it is recommended to also remember
548adding ``.qa`` symbolic links. A trivial find command may do this for you:
549
550.. prompt:: bash $
551
552 find qa/suites/ -type d -execdir ln -sfT ../.qa/ {}/.qa \;
553
554
9f95a23c
TL
555Filtering tests by their description
556------------------------------------
557
558When a few jobs fail and need to be run again, the ``--filter`` option
559can be used to select tests with a matching description. For instance, if the
560``rados`` suite fails the `all/peer.yaml <https://github.com/ceph/ceph/blob/master/qa/suites/rados/singleton/all/peer.yaml>`_ test, the following will only
f67539c2
TL
561run the tests that contain this file
562
563.. prompt:: bash $
9f95a23c 564
f67539c2 565 teuthology-suite --machine-type smithi --suite rados --filter all/peer.yaml
9f95a23c
TL
566
567The ``--filter-out`` option does the opposite (it matches tests that do `not`
568contain a given string), and can be combined with the ``--filter`` option.
569
570Both ``--filter`` and ``--filter-out`` take a comma-separated list of strings
571(which means the comma character is implicitly forbidden in filenames found in
f67539c2 572the `ceph/qa sub-directory`_). For instance
9f95a23c 573
f67539c2
TL
574.. prompt:: bash $
575
576 teuthology-suite --machine-type smithi --suite rados --filter all/peer.yaml,all/rest-api.yaml
9f95a23c
TL
577
578will run tests that contain either
579`all/peer.yaml <https://github.com/ceph/ceph/blob/master/qa/suites/rados/singleton/all/peer.yaml>`_
580or
581`all/rest-api.yaml <https://github.com/ceph/ceph/blob/master/qa/suites/rados/singleton/all/rest-api.yaml>`_
582
583Each string is looked up anywhere in the test description and has to
584be an exact match: they are not regular expressions.
585
586Reducing the number of tests
587----------------------------
588
589The ``rados`` suite generates tens or even hundreds of thousands of tests out
590of a few hundred files. This happens because teuthology constructs test
591matrices from subdirectories wherever it encounters a file named ``%``. For
592instance, all tests in the `rados/basic suite
593<https://github.com/ceph/ceph/tree/master/qa/suites/rados/basic>`_ run with
594different messenger types: ``simple``, ``async`` and ``random``, because they
595are combined (via the special file ``%``) with the `msgr directory
596<https://github.com/ceph/ceph/tree/master/qa/suites/rados/basic/msgr>`_
597
598All integration tests are required to be run before a Ceph release is
599published. When merely verifying whether a contribution can be merged without
600risking a trivial regression, it is enough to run a subset. The ``--subset``
601option can be used to reduce the number of tests that are triggered. For
f67539c2
TL
602instance
603
604.. prompt:: bash $
9f95a23c 605
f67539c2 606 teuthology-suite --machine-type smithi --suite rados --subset 0/4000
9f95a23c
TL
607
608will run as few tests as possible. The tradeoff in this case is that
609not all combinations of test variations will together,
610but no matter how small a ratio is provided in the ``--subset``,
611teuthology will still ensure that all files in the suite are in at
612least one test. Understanding the actual logic that drives this
613requires reading the teuthology source code.
614
615The ``--limit`` option only runs the first ``N`` tests in the suite:
616this is rarely useful, however, because there is no way to control which
617test will be first.
618
619.. _ceph/qa sub-directory: https://github.com/ceph/ceph/tree/master/qa
9f95a23c
TL
620.. _Sepia Lab: https://wiki.sepia.ceph.com/doku.php
621.. _teuthology repository: https://github.com/ceph/teuthology
622.. _teuthology framework: https://github.com/ceph/teuthology
20effc67
TL
623.. _teuthology-desribe usecases: https://gist.github.com/jdurgin/09711d5923b583f60afc
624.. _ceph-deploy man page: ../../../../man/8/ceph-deploy