Open dpino opened 6 years ago
I don't know much about our docker setup. This is for snabb-bot, right? I guess we should get review from @eugeneia before merging. To me this sounds like we should make another environment variable to determine whether --net=host
is passed to the container. WDYT?
You should be able to achieve this in your test by using
DOCKERFLAGS="--net=host $DOCKERFLAGS"
,
no?
@eugeneia your suggested change worked, but in addition to that I also had to change the following line in snabb_bot.sh:
function dock_build { (cd src && DOCKERFLAGS=$DOCKERFLAGS scripts/dock.sh "(cd .. && make)"); }
So it would be necessary to change that in src/scripts/snabb_bot.sh
as well.
Still, the result is that all tests are executed inside the Docket container using the networking stack of the host. I think it won't possible to use this setting for a specific script, because test execution is per container and not per test, that means, when a container is started (that's when --net=host is set), all tests are executed.
As for me, I'm fine with leaving this option on always since in all other Snabb tests the NICs won't have a networking interface, unlikely to cause a side-effect.
Fixes #251.
Adding this test requires that the Docker container uses the host network stack (so it's possible to attach devices to OS interfaces). I don't know if that's desirable for all tests.
It would be better to enable this feature only for certain tests. For example, by making the use of the
--net=host
conditional based on the script name (if the name ishost-selftest.sh
, then enable this flag).