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

unit test eventually fail for test_trace_manager.py::test_trace_in_process #23

Closed italovalcy closed 2 years ago

italovalcy commented 2 years ago

Hi,

The last daily execution pointed out the following failure:

____________________ TestTraceManager.test_trace_in_process ____________________

self = <sdntrace.tests.unit.tracing.test_trace_manager.TestTraceManager testMethod=test_trace_in_process>
mock_send_probe = <MagicMock name='send_trace_probe' id='139940307280272'>
mock_colors = <MagicMock name='get_switch_color' id='139940307310336'>

    @patch("napps.amlight.sdntrace.shared.colors.Colors.get_switch_color")
    @patch("napps.amlight.sdntrace.tracing.tracer.TracePath.send_trace_probe")
    def test_trace_in_process(self, mock_send_probe, mock_colors):
        """Test trace manager tracing request and processing."""
        mock_colors.return_value = {
            "color_field": "dl_src",
            "color_value": "ee:ee:ee:ee:ee:01",
        }
        mock_send_probe.return_value = {
            "dpid": "00:00:00:00:00:00:00:01",
            "port": 1,
        }, ""

        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 = self.trace_manager.is_entry_valid(entries)
        self.assertIsInstance(trace_entries, TraceEntries)

        trace_id = self.trace_manager.new_trace(trace_entries)
        self.assertEqual(trace_id, 30001)

        pending = self.trace_manager.number_pending_requests()
        self.assertEqual(pending, 1)

        while pending == 1:
            result = self.trace_manager.get_result(trace_id)
            pending = self.trace_manager.number_pending_requests()
            time.sleep(0.1)

>       self.assertEqual(result, {"msg": "trace in process"})
E       AssertionError: {'request_id': 30001, 'result': [{'type': '[445 chars]0}}}} != {'msg': 'trace in process'}
E       Diff is 762 characters long. Set self.maxDiff to None to see it.

tests/unit/tracing/test_trace_manager.py:222: AssertionError

Running the same pipeline again returns success; if we keep repeating the tests, we eventually get the same error again.