]> git.proxmox.com Git - mirror_frr.git/blame - doc/developer/topotests-markers.rst
Merge pull request #12384 from opensourcerouting/feature/snmp_bgp4V2PeerErrorsTable
[mirror_frr.git] / doc / developer / topotests-markers.rst
CommitLineData
0f84d138
DS
1.. _topotests-markers:
2
3Markers
4--------
5
6To allow for automated selective testing on large scale continuous integration
7systems, all tests must be marked with at least one of the following markers:
8
9* babeld
10* bfdd
11* bgpd
12* eigrpd
13* isisd
14* ldpd
15* nhrpd
16* ospf6d
17* ospfd
18* pathd
19* pbrd
20* pimd
21* ripd
22* ripngd
23* sharpd
24* staticd
25* vrrpd
26
27The markers corespond to the daemon subdirectories in FRR's source code and have
28to be added to tests on a module level depending on which daemons are used
29during the test.
30
31The goal is to have continuous integration systems scan code submissions, detect
32changes to files in a daemons subdirectory and select only tests using that
33daemon to run to shorten developers waiting times for test results and save test
34infrastructure resources.
35
36Newly written modules and code changes on tests, which do not contain any or
37incorrect markers will be rejected by reviewers.
38
39
40Registering markers
41^^^^^^^^^^^^^^^^^^^
42The Registration of new markers takes place in the file
c8bcb7bd 43``tests/topotests/pytest.ini``:
0f84d138
DS
44
45.. code:: python3
46
47 # tests/topotests/pytest.ini
48 [pytest]
49 ...
50 markers =
51 babeld: Tests that run against BABELD
52 bfdd: Tests that run against BFDD
53 ...
54 vrrpd: Tests that run against VRRPD
55
56
57Adding markers to tests
58^^^^^^^^^^^^^^^^^^^^^^^
59Markers are added to a test by placing a global variable in the test module.
60
61Adding a single marker:
62
63.. code:: python3
64
65 import pytest
0f84d138
DS
66 ...
67
c8bcb7bd 68 # add after imports, before defining classes or functions:
0f84d138
DS
69 pytestmark = pytest.mark.bfdd
70
71 ...
72
73 def test_using_bfdd():
74
75
76Adding multiple markers:
77
78.. code:: python3
79
80 import pytest
0f84d138
DS
81 ...
82
c8bcb7bd 83 # add after imports, before defining classes or functions:
0f84d138
DS
84 pytestmark = [
85 pytest.mark.bgpd,
86 pytest.mark.ospfd,
87 pytest.mark.ospf6d
88 ]
89
90 ...
91
92 def test_using_bgpd_ospfd_ospf6d():
93
94
ccdf4a5e 95Selecting marked modules for testing
0f84d138
DS
96^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97Selecting by a single marker:
98
99.. code:: bash
100
101 pytest -v -m isisd
102
103Selecting by multiple markers:
104
105.. code:: bash
106
107 pytest -v -m "isisd or ldpd or nhrpd"
108
109
110Further Information
111^^^^^^^^^^^^^^^^^^^
112The `online pytest documentation <https://docs.pytest.org/en/stable/example/markers.html>`_
113provides further information and usage examples for pytest markers.
114