From a64a01133c4158dec9333113c29f5572eac16abb Mon Sep 17 00:00:00 2001 From: sureshmarikkannu <115574144+sureshmarikkannu@users.noreply.github.com> Date: Sat, 9 Mar 2024 06:06:48 +0530 Subject: [PATCH] Resolved unit tests failures for test_bess.py and placement_constraint.py (#49) Signed-off-by: Marikkannu, Suresh Co-authored-by: gab-arrobo --- ...ement_constraint.txt => placement_constraint.py} | 13 +++++++++++-- pybess/{test_bess.txt => test_bess.py} | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) rename bessctl/module_tests/{placement_constraint.txt => placement_constraint.py} (86%) rename pybess/{test_bess.txt => test_bess.py} (97%) diff --git a/bessctl/module_tests/placement_constraint.txt b/bessctl/module_tests/placement_constraint.py similarity index 86% rename from bessctl/module_tests/placement_constraint.txt rename to bessctl/module_tests/placement_constraint.py index 553fa60073..e1da6f1443 100644 --- a/bessctl/module_tests/placement_constraint.txt +++ b/bessctl/module_tests/placement_constraint.py @@ -81,12 +81,21 @@ def test_nat_queue(self): self.assertFalse(bess.check_constraints()) def test_nat_negative(self): - nat_config = [{'ext_addr': '192.168.1.1'}] src0 = Source() src1 = Source() bess.add_worker(0, 0) bess.add_worker(1, 1) - nat = NAT(ext_addrs=nat_config) + + # This test verifies the scheduling constraint of a module when we + # schedule more workers than the maximum allowed workers for it. + # As part of the commit a742ee6e356d27175dd09af85e970a037aa14a59 + # the max_allowed_workers_ was increased to 2 from 1 and it causes + # this test to fail. In order to resolve this issue using the + # StaticNAT() module to validate this constraint. Later need to + # understand the reason for increasing max_allowed_workers_ for + # NAT module + + nat = StaticNAT() src0 -> 0: nat: 1 -> Sink() src1 -> 1: nat: 0 -> Sink() src0.attach_task(wid=0) diff --git a/pybess/test_bess.txt b/pybess/test_bess.py similarity index 97% rename from pybess/test_bess.txt rename to pybess/test_bess.py index 33f6e5b4ac..3bdcce31f8 100644 --- a/pybess/test_bess.txt +++ b/pybess/test_bess.py @@ -38,10 +38,10 @@ from . import bess from .builtin_pb import bess_msg_pb2 as bess_msg -from .builtin_pb import service_pb2 +from .builtin_pb import service_pb2_grpc -class DummyServiceImpl(service_pb2.BESSControlServicer): +class DummyServiceImpl(service_pb2_grpc.BESSControlServicer): def __init__(self): pass @@ -72,7 +72,7 @@ class TestBESS(unittest.TestCase): @classmethod def setUpClass(cls): server = grpc.server(futures.ThreadPoolExecutor(max_workers=2)) - service_pb2.add_BESSControlServicer_to_server( + service_pb2_grpc.add_BESSControlServicer_to_server( DummyServiceImpl(), server) server.add_insecure_port('[::]:%d' % cls.PORT)