]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: Start the ability to mark tests 7870/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 15 Jan 2021 01:29:14 +0000 (20:29 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 15 Jan 2021 01:29:14 +0000 (20:29 -0500)
Add the ability for our topotests to take advantage of pytest `mark`ing.
This effectively allows you to tell pytest to run against certain sets
of tests.  For a demonstration purpose I've added in marks for:
babel
eigrp
ldp
ospf
pim
rip

And setup tests to run against those tests that only test those protocols.

You can run against eigrp tests by running `pytest -k eigrp`
Other combinations are also available based upon simple boolean logic.
Just read the pytest.mark documentation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
tests/topotests/all-protocol-startup/test_all_protocol_startup.py
tests/topotests/bgp-evpn-mh/test_evpn_mh.py
tests/topotests/eigrp-topo1/test_eigrp_topo1.py
tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py
tests/topotests/ldp-topo1/test_ldp_topo1.py
tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py
tests/topotests/pim-basic/test_pim.py
tests/topotests/pytest.ini
tests/topotests/rip-topo1/test_rip_topo1.py
tests/topotests/ripng-topo1/test_ripng_topo1.py

index ab9358408e46dbb504585ad35161020f49cb5c35..41fa1b27327064eee812c2260c2c3c0eb3e5dcf3 100644 (file)
@@ -82,7 +82,8 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.ospf
+@pytest.mark.rip
 def setup_module(module):
     global topo, net
     global fatal_error
index 6a2468464976543fc6a3df6c52f78db0db46202c..4e37ab00a3e4ddfc9fbc56f15f28ad4660a0c924 100644 (file)
@@ -362,7 +362,7 @@ def config_hosts(tgen, hosts):
         host = tgen.gears[host_name]
         config_host(host_name, host)
 
-
+@pytest.mark.pim
 def setup_module(module):
     "Setup topology"
     tgen = Topogen(NetworkTopo, module.__name__)
index 3ce1472ac0ca03653c8721c44f11c42aedde0a4d..bf94d39a4b570a3ee195d2945746bd4c637dc2c3 100644 (file)
@@ -91,7 +91,7 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.eigrp
 def setup_module(module):
     "Setup topology"
     tgen = Topogen(NetworkTopo, module.__name__)
index 265124132fde5baeb909573a1fc083c031e65340..07623af063c5e808016095d08bbaf11044c3b001 100644 (file)
@@ -97,7 +97,7 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.pim
 def setup_module(module):
     "Setup topology"
     tgen = Topogen(NetworkTopo, module.__name__)
index 9822686dfc7c2b6f6877e3f0e5a1cbe12f2086ce..dfe65f010e5e2f8f8a88bd09226da561ffe4a342 100644 (file)
@@ -159,7 +159,7 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.ldp
 def setup_module(module):
     global topo, net
     global fatal_error
index ba94cd47d4b20c7638852c10bce27d66d89cde9b..d659acb470866421f8c762eaf79aec492f144646 100644 (file)
@@ -121,7 +121,8 @@ class TemplateTopo(Topo):
         switch.add_link(tgen.gears["r2"])
         switch.add_link(tgen.gears["r3"])
 
-
+@pytest.mark.ldp
+@pytest.mark.ospf
 def setup_module(mod):
     "Sets up the pytest environment"
     tgen = Topogen(TemplateTopo, mod.__name__)
index e8a9f72b483ca96e02781be6ebc5718f7f3cf923..74a7fbf16e113791b3b8765bb5125f1164453df9 100644 (file)
@@ -80,7 +80,7 @@ class PIMTopo(Topo):
         sw.add_link(tgen.gears["r1"])
         sw.add_link(tgen.gears["r3"])
 
-
+@pytest.mark.pim
 def setup_module(mod):
     "Sets up the pytest environment"
     tgen = Topogen(PIMTopo, mod.__name__)
index 6e8e74909230ce23366ba2253fc51e02f577a95c..fcbf853faca32e210abe388671ab01dca9a6f478 100644 (file)
@@ -1,6 +1,13 @@
 # Skip pytests example directory
 [pytest]
 norecursedirs = .git example-test example-topojson-test lib docker
+markers =
+       babel: Tests that run against BABEL
+       eigrp: Tests that run against EIGRPD
+       ldp: Tests that run against LDPD
+       ospf: Tests that run against OSPF( v2 and v3 )
+       pim: Tests that run against pim
+       rip: Tests that run against RIP, both v4 and v6
 
 [topogen]
 # Default configuration values
index fdafa50abadd215968f96d04f6b1a724312ad360..edad1ff65d0e7854ef1622f727048d592614f3c1 100644 (file)
@@ -104,7 +104,7 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.rip
 def setup_module(module):
     global topo, net
 
index 4702d33dae69c91425dabbd8788506c3fde46ce2..47b63e5b264b4469ebad8655769e235b0e1188d7 100644 (file)
@@ -104,7 +104,7 @@ class NetworkTopo(Topo):
 ##
 #####################################################
 
-
+@pytest.mark.rip
 def setup_module(module):
     global topo, net