thombashi / tcconfig

A tc command wrapper. Make it easy to set up traffic control of network bandwidth/latency/packet-loss/packet-corruption/etc. to a network-interface/Docker-container(veth).
https://tcconfig.rtfd.io/
MIT License
790 stars 84 forks source link

Unit tests require full installation #154

Closed fredleb closed 3 years ago

fredleb commented 3 years ago

I'm new to unit test in Python, so I guess I am doing something wrong here.

I want to add a couple of features to your very useful project, but before I do, I want to make sure the unit tests work. I had no idea how to run them properly (inside a docker container for many reasons) but after a while I got some results.

First I create a fake device in the container: sudo ip link add name radio0 link eth0 address 00:01:02:aa:bb:11 type macvtap

Then I run (from the root directory): PATH=/sbin:$PATH pytest --md-report --device=radio0

(PATH fix being because my PATH is not what your tests expect - this does not matter)

However most of the tests fail because they try to call the "tcdel", "tcshow", etc... commands directly as if they were installed on the system (but they are not)...

The only way I found to go a bit further is to build the deb package and install it. But this takes forever. I would like to test the python scripts directly.

I am doing everything wrong here ? How am I supposed to run the unit tests ?

Thanks ! Great project !

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

thombashi commented 3 years ago

@fredleb Please try the followings:

  1. cd <path to the cloned/forked tcconfig directory>
  2. make setup

The above commands will install test dependencies.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.