kytos-ng / sdntrace

Napp that traces OpenFlow paths in the dataplane
https://kytos-ng.github.io/api/sdntrace.html
GNU Lesser General Public License v3.0
0 stars 6 forks source link

chore: unit test regression #61

Closed viniarck closed 10 months ago

viniarck commented 10 months ago

Related to https://github.com/kytos-ng/of_core/issues/128

================================================================================== test session starts ===================================================================================
platform linux -- Python 3.9.18, pytest-7.2.1, pluggy-1.4.0
rootdir: /home/viniarck/repos/sdntrace, configfile: pytest.ini
plugins: cov-4.0.0, anyio-3.6.2, asyncio-0.20.3
asyncio: mode=auto
collected 125 items                                                                                                                                                                      

tests/unit/backends/test_of_parser.py .....                                                                                                                                        [  4%]
tests/unit/backends/test_openflow13.py ....                                                                                                                                        [  7%]
tests/unit/shared/test_colors.py ...                                                                                                                                               [  9%]
tests/unit/tracing/test_trace_entries.py .................................................................................                                                         [ 74%]
tests/unit/tracing/test_trace_manager.py ................                                                                                                                          [ 87%]
tests/unit/tracing/test_trace_pkt.py F.....                                                                                                                                        [ 92%]
tests/unit/tracing/test_tracer.py ..........                                                                                                                                       [100%]

======================================================================================== FAILURES ========================================================================================
________________________________________________________________________ TestTracePkt.test_generate_trace_pkt_tcp ________________________________________________________________________

self = <sdntrace.tests.unit.tracing.test_trace_pkt.TestTracePkt object at 0x7f6433edec10>

    def test_generate_trace_pkt_tcp(self):
        """Test trace manager new trace creation."""
        eth = {"dl_vlan": 100}
        dpid = {"dpid": "00:00:00:00:00:00:00:01", "in_port": 1}
        switch = {"switch": dpid, "eth": eth}
        entries = {"trace": switch}

        trace_entries = TraceEntries()
        trace_entries.load_entries(entries)
        r_id = 999

        # Coloring REST response
        color = {"color_value": "ee:ee:ee:ee:ee:01"}

        # new_trace does not check duplicated request.
        in_port, pkt = trace_pkt.generate_trace_pkt(trace_entries, color, r_id)

        assert entries["trace"]["switch"]["in_port"] == in_port
>       assert (
            pkt == b"\xca\xfe\xca\xfe\xca\xfe\xee\xee\xee\xee\xee"
            b"\x01\x81\x00\x00d\x08\x00E\x00\x00p\x00\x00"
            b"\x00\x00\xff\x00\xb7\x89\x01\x01\x01\x01\x01"
            b"\x01\x01\x02\x80\x04\x95Q\x00\x00\x00\x00\x00"
            b"\x00\x00\x8c(napps.amlight.sdntrace.tracing."
            b"trace_msg\x94\x8c\x08TraceMsg\x94\x93\x94)"
            b"\x81\x94}\x94\x8c\x0b_request_id\x94M\xe7"
            b"\x03sb."
        )
E       AssertionError: assert b'\xca\xfe\xc...4M\xe7\x03sb.' == b'\xca\xfe\xc...4M\xe7\x03sb.'
E         At index 27 diff: b'\x06' != b'\x00'
E         Use -v to get more diff
Alopalao commented 10 months ago

Looks like this issue does not occur anymore. On my end all the tests pass.

viniarck commented 10 months ago

Looks like this issue does not occur anymore. On my end all the tests pass.

Indeed, Aldo, I've just also git pull and it no longer happens on my machine.

Also, as a final confirmation on CI with master branch it's passing too.

Let's close this.