firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

Allow Running `vmm` Unittests in Parallel

Open roypat opened this issue 1 year ago • 6 comments

Currently, the unittests in the vmm package have to be run sequentially due to reliance on global state in some virtio device tests. More specifically, various tests in the vsock and rng modules use a global METRICS object (see also https://github.com/firecracker-microvm/firecracker/issues/2899). This design using a global METRICS object is fine for production, because a VMM can have at most one vsock and rng device each, however multiple unit tests running in parallel can create multiple device objects, which then simultaneously update the global metrics. Since our tests contain assertions on the value of the metrics to validate functionality, this causes spurious failures.

We can fix this by moving the vsock and rng device to a "per device metrics" model, as already adopted by net and block devices (see for example https://github.com/firecracker-microvm/firecracker/pull/4145).

As part of this issue, 3 things will need to be done

  • [ ] Update the vsock device to use a "per device metrics" model
  • [ ] Update the rng device to use a "per device metrics" model
  • [ ] Fix the test_tap_name test to no longer use a hardcoded value of tap0 (if multiple tests run in parallel and create tap devices, it is no longer guaranteed that the tap device created in this test will be called "tap0", it could be "tap1" or "tap43". Thus we probably just want some sort of regex match on the tap device name).

These can all be addressed in individual PRs, or all in one, depending on how much of a task you want to tackle :)

roypat avatar Jul 29 '24 11:07 roypat

@roypat

I can try to look at this. Will send PR if I get anywhere.

Thanks!

jackabald avatar Aug 02 '24 00:08 jackabald

@jackabald CC @roypat

Are you still planning on working on this issue? If not, would I be able to take this on? Thank you!

gjkeller avatar Apr 10 '25 20:04 gjkeller

Hey @gjkeller. There isn't any progress here. Feel free to contribute to it, if you want.

bchalios avatar Apr 16 '25 13:04 bchalios

Submitted a hopeful fix to this by working with @gjkeller. If there's any changes needed to be made or if I went in the wrong direction please let me know.

bstrong04 avatar May 07 '25 05:05 bstrong04

Hi everyone! 🙏 If no one is currently working on this issue, I would be grateful for the opportunity to take it on. Please let me know. Thank you!

shashforge avatar Jul 16 '25 22:07 shashforge

@shashforge Thank you for your interest! Feel free to take this on since no one is currently working on!

zulinx86 avatar Jul 23 '25 14:07 zulinx86