kytos-ng / kytos-end-to-end-tests

Kytos End-to-End Tests
0 stars 10 forks source link

`TestE2EPathfinder::test_10_undesired_link_and_max_path` had a rerun #269

Open viniarck opened 7 months ago

viniarck commented 7 months ago

On today's nightly e2e exec this e2e test had a rerun, it needs to be analyzed and see if either time sleep or any other synchornization is needed before the asserts:

tests/test_e2e_80_pathfinder.py: 37 warnings
  /usr/lib/python3/dist-packages/mininet/node.py:1122: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    StrictVersion( '1.10' ) )
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
------------------------------- start/stop times -------------------------------
rerun: 0
tests/test_e2e_80_pathfinder.py::TestE2EPathfinder::test_10_undesired_link_and_max_path[undesired_link1-8-2-expected_paths1]: 2023-11-18,07:24:37.337629 - 2023-11-18,07:24:37.894321
self = <tests.test_e2e_80_pathfinder.TestE2EPathfinder object at 0x7f99b0e5e5b0>
undesired_link = ['74bbc9527a0e309a86c95744042bcf9e3beb52955c942cac5fc735b1cf986f7f']
expected_cost = 8, max_paths = 2
expected_paths = ['00:00:00:00:00:00:00:01:3', '00:00:00:00:00:00:00:01', '00:00:00:00:00:00:00:01:2', '00:00:00:00:00:00:00:02:2', '00:00:00:00:00:00:00:02', '00:00:00:00:00:00:00:02:4', ...]
    @pytest.mark.parametrize(
        "undesired_link, expected_cost, max_paths, expected_paths",
        [
            ([], 1, 1, ["00:00:00:00:00:00:00:01:3", "00:00:00:00:00:00:00:06:3"]),
            (
                ["74bbc9527a0e309a86c95744042bcf9e3beb52955c942cac5fc735b1cf986f7f"],
                8,
                2,
                [
                    "00:00:00:00:00:00:00:01:3",
                    "00:00:00:00:00:00:00:01",
                    "00:00:00:00:00:00:00:01:2",
                    "00:00:00:00:00:00:00:02:2",
                    "00:00:00:00:00:00:00:02",
                    "00:00:00:00:00:00:00:02:4",
                    "00:00:00:00:00:00:00:06:4",
                    "00:00:00:00:00:00:00:06",
                    "00:00:00:00:00:00:00:06:3",
                ],
            ),
        ],
    )
    def test_10_undesired_link_and_max_path(
        self, undesired_link, expected_cost, max_paths, expected_paths
    ):
        """Tests fastest path from switch 1 to 6 then blocks it"""
        api_url = KYTOS_API + "/pathfinder/v3/"
        post_body = {
            "source": self.source,
            "destination": self.destination,
            "undesired_links": undesired_link,
            "spf_attribute": "hop",
            "spf_max_paths": max_paths,
            "parameter": "hop",
        }

        response = requests.post(api_url, json=post_body)
        assert response.status_code == 200, response.text
        data = response.json()
>       assert (
            data["paths"][0]["cost"] == expected_cost
        ), f"Shortest path expected {expected_cost}: {data}"
E       AssertionError: Shortest path expected 8: {'paths': [{'hops': ['00:00:00:00:00:00:00:01:3', '00:00:00:00:00:00:00:06:3'], 'cost': 1}, {'hops': ['00:00:00:00:00:00:00:01:3', '00:00:00:00:00:00:00:01', '00:00:00:00:00:00:00:01:2', '00:00:00:00:00:00:00:02:2', '00:00:00:00:00:00:00:02', '00:00:00:00:00:00:00:02:4', '00:00:00:00:00:00:00:06:4', '00:00:00:00:00:00:00:06', '00:00:00:00:00:00:00:06:3'], 'cost': 8}]}
E       assert 1 == 8
tests/test_e2e_80_pathfinder.py:122: AssertionError
=========================== rerun test summary info ============================
RERUN tests/test_e2e_80_pathfinder.py::TestE2EPathfinder::test_10_undesired_link_and_max_path[undesired_link1-8-2-expected_paths1]
= 230 passed, 6 skipped, 9 xfailed, 7 xpassed, 1109 warnings, 1 rerun in 12093.08s (3:21:33) =

@HeriLFIU, could you help out with this one? If you could investigate and run locally a few times exploring it and finding a solutoin that'd be great. Thanks.