traviscross / mtr

Official repository for mtr, a network diagnostic tool
http://www.bitwizard.nl/mtr/
GNU General Public License v2.0
2.66k stars 339 forks source link

Linux-Only Interface, Marking, and IP Unit Tests #488

Closed flu0r1ne closed 1 year ago

flu0r1ne commented 1 year ago

This commit introduces three unit tests focused on interface binding, packet marking, and IP source address spoofing/selection. Each of these tests builds upon the original MtrPacketTest base class. To evaluate these network-dependent features, the tests utilize an emulated network environment. To enable this, a small network emulation library, netem, has been developed specifically for this purpose. netem allows for the creation of arbitrary network configurations for testing and can reliably set up and clean up virtual network environments on Linux systems. The only dependencies are iproute2 and libc, which are generally pre-installed on most Linux hosts.

The commit adds three tests that are expected to fail (see #485):

  1. Interface Binding: Evaluates the capability of mtr-packet to bind to a specific interface.
  2. Packet Marking: Assesses the ability of mtr-packet to apply a Linux networking mark (fwmark).
  3. Source Address Selection: Tests mtr-packet's ability to spoof or bind to a specified source address.
rewolff commented 1 year ago

The netem seems to fail LINT checks. Please look into that.

You should've said: They "expected to fail" issues are issues that should be in progress of being fixed, but these tests actually detect that the issue is still present.

flu0r1ne commented 1 year ago

I will investigate the linting issues. Thank you for bringing them to my attention.

You are correct, I intended for them to fail with the main branch to demonstrate the issues. Fixes for some of these issues are currently underway.

rewolff commented 1 year ago

OK. great. I think that now that I've approved running of the tests once for your pull requests, in the future they will run automatically, so that you don't have to wait for me to be awake.

flu0r1ne commented 1 year ago

I believe I've resolved the linting issues; my local version of flake8 is no longer reporting any errors. However, it seems that the CI pipeline is not triggered when I push changes.