On Sat, 27 Apr 2024 09:49:28 -0400 Willem de Bruijn wrote:
Eventually probably want a more generic fault injection class.
And for both fault injection and background traffic the with object construct to ensure cleanup in all cases.
Maybe even the same for ethtool, as ip and ethtool config changes that need to be reverted to original state will be common.
Agreed, the nice way of wrapping all that has not revealed itself to me yet. When we discussed it with Petr a while back he was suggesting "with", and I was thinking of creating an object with test as the parent. The with is nicer but here we'd end up doing:
with a(): # some code with b(): # more code with c(): # check traffic
which offends my sensibilities.
There are many options, hard to say which one is best without having a bunch of tests to convert as a litmus test :S So I stuck to "finally"