tests: allow for externally supplied VPP workers config for tests
Allow to supply the external VPP worker config for tests which do not specify the workers config explicitly, and use the tags infra to flag those that need attention in this configuration. This commit shows one example use of such a tag, there will be a separate commit with the rest of the places needing it, since that change is rather mechanical. Thus, the assumption is that the test should by default be agnostic of the VPP configuration, unless it explicitly specifies so. Type: test Change-Id: I3c0077e4e22a75cb9561fb98d3b783b93486b2be Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
This commit is contained in:
@ -11,6 +11,7 @@ from scapy.layers.inet import IP, TCP, UDP, ICMP
|
|||||||
from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest
|
from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest
|
||||||
from scapy.layers.inet6 import IPv6ExtHdrFragment
|
from scapy.layers.inet6 import IPv6ExtHdrFragment
|
||||||
from framework import VppTestCase, VppTestRunner
|
from framework import VppTestCase, VppTestRunner
|
||||||
|
from framework import tag_fixme_vpp_workers
|
||||||
from util import Host, ppp
|
from util import Host, ppp
|
||||||
from ipaddress import IPv4Network, IPv6Network
|
from ipaddress import IPv4Network, IPv6Network
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ from vpp_acl import AclRule, VppAcl, VppAclInterface, VppEtypeWhitelist
|
|||||||
from vpp_ip import INVALID_INDEX
|
from vpp_ip import INVALID_INDEX
|
||||||
|
|
||||||
|
|
||||||
|
@tag_fixme_vpp_workers
|
||||||
class TestACLplugin(VppTestCase):
|
class TestACLplugin(VppTestCase):
|
||||||
""" ACL plugin Test Case """
|
""" ACL plugin Test Case """
|
||||||
|
|
||||||
|
@ -257,7 +257,11 @@ class KeepAliveReporter(object):
|
|||||||
|
|
||||||
|
|
||||||
class TestCaseTag(Enum):
|
class TestCaseTag(Enum):
|
||||||
|
# marks the suites that must run at the end
|
||||||
|
# using only a single test runner
|
||||||
RUN_SOLO = 1
|
RUN_SOLO = 1
|
||||||
|
# marks the suites broken on VPP multi-worker
|
||||||
|
FIXME_VPP_WORKERS = 2
|
||||||
|
|
||||||
|
|
||||||
def create_tag_decorator(e):
|
def create_tag_decorator(e):
|
||||||
@ -269,7 +273,9 @@ def create_tag_decorator(e):
|
|||||||
return cls
|
return cls
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
tag_run_solo = create_tag_decorator(TestCaseTag.RUN_SOLO)
|
tag_run_solo = create_tag_decorator(TestCaseTag.RUN_SOLO)
|
||||||
|
tag_fixme_vpp_workers = create_tag_decorator(TestCaseTag.FIXME_VPP_WORKERS)
|
||||||
|
|
||||||
|
|
||||||
class VppTestCase(unittest.TestCase):
|
class VppTestCase(unittest.TestCase):
|
||||||
@ -398,7 +404,10 @@ class VppTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
cpu_core_number = cls.get_least_used_cpu()
|
cpu_core_number = cls.get_least_used_cpu()
|
||||||
if not hasattr(cls, "worker_config"):
|
if not hasattr(cls, "worker_config"):
|
||||||
cls.worker_config = ""
|
cls.worker_config = os.getenv("VPP_WORKER_CONFIG", "")
|
||||||
|
if cls.worker_config != "":
|
||||||
|
if cls.has_tag(TestCaseTag.FIXME_VPP_WORKERS):
|
||||||
|
cls.worker_config = ""
|
||||||
|
|
||||||
default_variant = os.getenv("VARIANT")
|
default_variant = os.getenv("VARIANT")
|
||||||
if default_variant is not None:
|
if default_variant is not None:
|
||||||
@ -1435,6 +1444,13 @@ class VppTestResult(unittest.TestResult):
|
|||||||
c = YELLOW
|
c = YELLOW
|
||||||
test_title_colored = colorize("SOLO RUN: " + test_title, c)
|
test_title_colored = colorize("SOLO RUN: " + test_title, c)
|
||||||
|
|
||||||
|
# This block may overwrite the colorized title above,
|
||||||
|
# but we want this to stand out and be fixed
|
||||||
|
if test.has_tag(TestCaseTag.FIXME_VPP_WORKERS):
|
||||||
|
c = RED
|
||||||
|
w = "FIXME with VPP workers: "
|
||||||
|
test_title_colored = colorize(w + test_title, c)
|
||||||
|
|
||||||
if not hasattr(test.__class__, '_header_printed'):
|
if not hasattr(test.__class__, '_header_printed'):
|
||||||
print(double_line_delim)
|
print(double_line_delim)
|
||||||
print(test_title_colored)
|
print(test_title_colored)
|
||||||
|
@ -14,6 +14,15 @@ class TestUtil (unittest.TestCase):
|
|||||||
""" if the test case class is timing-sensitive - return true """
|
""" if the test case class is timing-sensitive - return true """
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def has_tag(cls, tag):
|
||||||
|
""" if the test case has a given tag - return true """
|
||||||
|
try:
|
||||||
|
return tag in cls.test_tags
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
|
||||||
def test_mac_to_binary(self):
|
def test_mac_to_binary(self):
|
||||||
""" MAC to binary and back """
|
""" MAC to binary and back """
|
||||||
mac = 'aa:bb:cc:dd:ee:ff'
|
mac = 'aa:bb:cc:dd:ee:ff'
|
||||||
|
Reference in New Issue
Block a user