vpp/test/test_util.py
Andrew Yourtchenko c8eae8d28a 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>
2021-02-08 15:32:04 +00:00

37 lines
933 B
Python
Executable File

#!/usr/bin/env python3
"""Test framework utility functions tests"""
import unittest
from framework import VppTestRunner
from vpp_papi import mac_pton, mac_ntop
class TestUtil (unittest.TestCase):
""" Test framework utility tests """
@classmethod
def is_tagged_run_solo(cls):
""" if the test case class is timing-sensitive - return true """
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):
""" MAC to binary and back """
mac = 'aa:bb:cc:dd:ee:ff'
b = mac_pton(mac)
mac2 = mac_ntop(b)
self.assertEqual(type(mac), type(mac2))
self.assertEqual(mac2, mac)
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)