Skip to content

CLI error calculating RTT when any latency point is None #14

Open
@RascalTwo

Description

@RascalTwo

When executing the CLI with more then one run, if a single latency_point in the latency_points list is None, then when the last run is reached, an error is thrown:

> tcp_latency example.does.not.exist
tcp-latency example.does.not.exist
example.does.not.exist: tcp seq=0 port=443 timeout=5 failed
example.does.not.exist: tcp seq=1 port=443 timeout=5 failed
example.does.not.exist: tcp seq=2 port=443 timeout=5 failed
example.does.not.exist: tcp seq=3 port=443 timeout=5 failed
example.does.not.exist: tcp seq=4 port=443 timeout=5 failed
--- example.does.not.exist tcp-latency statistics ---
5 packets transmitted
Traceback (most recent call last):
  File "tcp_latency/tcp_latency.py", line 154, in <module>
    _main()
  File "tcp_latency/tcp_latency.py", line 143, in _main
    measure_latency(
  File "tcp_latency/tcp_latency.py", line 91, in measure_latency
    f'rtt min/avg/max = {min(latency_points)}/{mean(latency_points)}/{max(latency_points)} ms',   # noqa: E501
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

None of the three methods - min, mean, or max - are able to accept iterables that contain None.

The behavior is the same when just one of the points are None and the rest are valid floatss.

Due to another issue, the last latency_point is not included in RTT calculations, therefore if only the last point that is None, this error is not thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions