diff options
| author | Kuldeep Kashyap <kashyapk@vmware.com> | 2022-10-11 05:27:50 +0530 | 
|---|---|---|
| committer | Kuldeep Kashyap <kashyapk@vmware.com> | 2022-10-11 06:07:48 +0530 | 
| commit | d63c7094e438ee8133433c22281b20e776281669 (patch) | |
| tree | 24c3811eb533757e2d58762bcda2f973937d9d42 /tests/topotests/bgp_gr_functionality_topo1 | |
| parent | afd4d90111125e35a6023a2ca27512396a57a33a (diff) | |
tests: Updated assert message for better debugging
Updating topojson script's assert messages,
which will help in better debugging, when
test will fail.
Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
Diffstat (limited to 'tests/topotests/bgp_gr_functionality_topo1')
4 files changed, 68 insertions, 72 deletions
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py index f155325502..deca4bcfd7 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py @@ -160,7 +160,7 @@ def setup_module(mod):      # Required linux kernel version for this suite to run.      result = required_linux_kernel_version("4.16")      if result is not True: -        pytest.skip("Kernel requirements are not met") +        pytest.skip("Kernel requirements are not met, kernel version should be >=4.16")      testsuite_run_time = time.asctime(time.localtime(time.time()))      logger.info("Testsuite start time: {}".format(testsuite_run_time)) @@ -1033,11 +1033,9 @@ def test_BGP_GR_TC_4_p0(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))          # Verifying RIB routes          result = verify_rib( @@ -1045,9 +1043,9 @@ def test_BGP_GR_TC_4_p0(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))      logger.info("[Phase 5] : R2 is about to come up now  ")      start_router_daemons(tgen, "r2", ["bgpd"]) @@ -1506,10 +1504,10 @@ def test_BGP_GR_TC_6_1_2_p1(request):          result = verify_r_bit(              tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} : Failed \n " "r2: R-bit is set to True\n Error: {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: R-bit should not be set to True in r2\n" +            "Found: {}".format(tc_name, result)          )      logger.info("Restart BGPd on R2 ") @@ -1528,10 +1526,10 @@ def test_BGP_GR_TC_6_1_2_p1(request):          result = verify_r_bit(              tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} : Failed \n " "r2: R-bit is set to True\n Error: {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: R-bit should not be set to True in r2\n" +            "Found: {}".format(tc_name, result)          )      write_test_footer(tc_name) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py index dda3bd4b30..a92fde2d0d 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py @@ -160,7 +160,7 @@ def setup_module(mod):      # Required linux kernel version for this suite to run.      result = required_linux_kernel_version("4.16")      if result is not True: -        pytest.skip("Kernel requirements are not met") +        pytest.skip("Kernel requirements are not met, kernel version should be >=4.16")      testsuite_run_time = time.asctime(time.localtime(time.time()))      logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py index e4b533b295..b0166033df 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py @@ -160,7 +160,7 @@ def setup_module(mod):      # Required linux kernel version for this suite to run.      result = required_linux_kernel_version("4.16")      if result is not True: -        pytest.skip("Kernel requirements are not met") +        pytest.skip("Kernel requirements are not met, kernel version should be >=4.16")      testsuite_run_time = time.asctime(time.localtime(time.time()))      logger.info("Testsuite start time: {}".format(testsuite_run_time)) @@ -829,11 +829,9 @@ def test_BGP_GR_TC_20_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))          # Verifying RIB routes          result = verify_rib( @@ -841,9 +839,9 @@ def test_BGP_GR_TC_20_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))      logger.info("[Phase 5] : R2 is about to come up now  ") @@ -1117,7 +1115,8 @@ def test_BGP_GR_TC_31_1_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )      logger.info("[Phase 4] : R1 is about to come up now  ") @@ -1599,11 +1598,9 @@ def test_BGP_GR_TC_9_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))          # Verifying RIB routes          protocol = "bgp" @@ -1612,9 +1609,9 @@ def test_BGP_GR_TC_9_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))      logger.info("[Phase 5] : R2 is about to come up now  ")      start_router_daemons(tgen, "r2", ["bgpd"]) @@ -1643,10 +1640,10 @@ def test_BGP_GR_TC_9_p1(request):          result = verify_f_bit(              tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} : Failed \n " "r1: F-bit is set to True\n Error: {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: F-bit should not be set to True in r1\n" +            "Found: {}".format(tc_name, result)          )      write_test_footer(tc_name) @@ -1781,11 +1778,9 @@ def test_BGP_GR_TC_17_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))          # Verifying RIB routes          protocol = "bgp" @@ -1794,9 +1789,9 @@ def test_BGP_GR_TC_17_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          ) -        logger.info(" Expected behavior: {}".format(result))      logger.info("[Phase 5] : R2 is about to come up now  ")      start_router_daemons(tgen, "r2", ["bgpd"]) @@ -1817,10 +1812,10 @@ def test_BGP_GR_TC_17_p1(request):          result = verify_r_bit(              tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} : Failed \n " "r1: R-bit is set to True\n Error: {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: R-bit should not be set to True in r1\n" +            "Found: {}".format(tc_name, result)          )          # Verifying BGP RIB routes @@ -2026,10 +2021,10 @@ def test_BGP_GR_TC_43_p1(request):          result = verify_rib(              tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )          dut = "r2" @@ -2043,18 +2038,18 @@ def test_BGP_GR_TC_43_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r2: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) +          protocol = "bgp"          result = verify_rib(              tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )      step( @@ -2353,17 +2348,17 @@ def test_BGP_GR_TC_44_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) +          result = verify_rib(              tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False          ) -        assert ( -            result is not True -        ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( -            tc_name, result +        assert result is not True, ( +            "Testcase {} : Failed \n " +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )      step("Bring up BGPd on R2 and remove GR related config from R1 in global level") diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py index 835ef41de1..f408ff4854 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py @@ -160,7 +160,7 @@ def setup_module(mod):      # Required linux kernel version for this suite to run.      result = required_linux_kernel_version("4.16")      if result is not True: -        pytest.skip("Kernel requirements are not met") +        pytest.skip("Kernel requirements are not met, kernel version should be >=4.16")      testsuite_run_time = time.asctime(time.localtime(time.time()))      logger.info("Testsuite start time: {}".format(testsuite_run_time)) @@ -1157,7 +1157,8 @@ def test_BGP_GR_TC_48_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )          dut = "r2" @@ -1171,16 +1172,17 @@ def test_BGP_GR_TC_48_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r2: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) +          result = verify_rib(              tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r2: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )      step("Bring up BGP on R1 and remove Peer-level GR config from R1") @@ -1542,16 +1544,17 @@ def BGP_GR_TC_52_p1(request):          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in BGP RIB\n Error: {}".format( -                tc_name, result -            ) +            "Expected: Routes should not be present in {} BGP RIB \n " +            "Found: {}".format(tc_name, dut, result)          ) +          result = verify_rib(              tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False          )          assert result is not True, (              "Testcase {} : Failed \n " -            "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result) +            "Expected: Routes should not be present in {} FIB \n " +            "Found: {}".format(tc_name, dut, result)          )      step("Bring up BGP on R2 and remove Peer-level GR config from R1")  | 
