• Pedro Tammela's avatar
    selftests/tc-testing: localize test resources · 98cfbe42
    Pedro Tammela authored
    As of today, the current tdc architecture creates one netns and uses it
    to run all tests. This assumption was embedded into the nsPlugin which
    carried over as how the tests were written.
    
    The tdc tests are by definition self contained and can,
    theoretically, run in parallel. Even though in the kernel they will
    serialize over the rtnl lock, we should expect a significant speedup of the
    total wall time for the entire test suite, which is hitting close to
    1100 tests at this point.
    
    A first step to achieve this goal is to remove sharing of global resources like
    veth/dummy interfaces and the netns. In this patch we 'localize' these
    resources on a per test basis. Each test gets it's own netns, VETH/dummy interfaces.
    The resources are spawned in the pre_suite phase, where tdc will prepare
    all netns and interfaces for all tests. This is done in order to avoid
    concurrency issues with netns / interfaces spawning and commands using
    them. As tdc progresses, the resources are deleted after each test finishes
    executing.
    
    Tests that don't use the nsPlugin still run under the root namespace,
    but are now required to manage any external resources like interfaces.
    These cannot be parallelized as their definition doesn't allow it.
    On the other hand, when using the nsPlugin, tests don't need to create
    dummy/veth interfaces as these are handled already.
    Tested-by: default avatarDavide Caratti <dcaratti@redhat.com>
    Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
    Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    98cfbe42
TdcPlugin.py 2.41 KB