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 5 forks source link

Create unit test #20

Closed rmotitsuki closed 1 year ago

rmotitsuki commented 2 years ago

New unit tests to improve test coverage. New black lint configuration.

viniarck commented 2 years ago

@rmotitsuki I was double checking the pip installation failure on the CI, they're related to the fact that coloring depends on of_core so it's needed to also transitively install it on requirements/dev.in and requirements/dev.txt check out this commit here https://github.com/kytos-ng/sdntrace/commit/c529d8ac261b0a6d65d9ffd790abc464df553906 feel free to cherry pick.

Regarding the failing tests in addition to linting there's also this one here that's failing silently with a traceback if you could fix this as well, thanks:

tests/unit/tracing/test_trace_manager.py::TestTraceManager::test_trace_in_process
  /home/viniarck/repos/sdntrace/.tox/py39/lib/python3.9/site-packages/_pytest/unraisableex
ception.py:78: PytestUnraisableExceptionWarning: Exception ignored in thread started by: <
bound method TraceManager._spawn_trace of <napps.amlight.sdntrace.tracing.trace_manager.Tr
aceManager object at 0x7f53131fea90>>

  Traceback (most recent call last):
    File "/home/viniarck/repos/sdntrace/.tox/py39/var/lib/kytos/napps/amlight/sdntrace/tra
cing/trace_manager.py", line 95, in _spawn_trace
      tracer.tracepath()
    File "/home/viniarck/repos/sdntrace/.tox/py39/var/lib/kytos/napps/amlight/sdntrace/tra
cing/tracer.py", line 83, in tracepath
      self.tracepath_loop(entries, color, switch)
    File "/home/viniarck/repos/sdntrace/.tox/py39/var/lib/kytos/napps/amlight/sdntrace/tra
cing/tracer.py", line 101, in tracepath_loop
      in_port, probe_pkt = generate_trace_pkt(entries, color, self.id)
    File "/home/viniarck/repos/sdntrace/.tox/py39/var/lib/kytos/napps/amlight/sdntrace/tra
cing/trace_pkt.py", line 37, in generate_trace_pkt
      ethernet = _create_ethernet_frame(trace_entries, color)
    File "/home/viniarck/repos/sdntrace/.tox/py39/var/lib/kytos/napps/amlight/sdntrace/tra
cing/trace_pkt.py", line 150, in _create_ethernet_frame
      ethernet.source = color['color_value']
  TypeError: string indices must be integers