Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny integration test fixes to fill accidental gaps in coverage #5050

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Feb 25, 2025

Fixes a handful of small issues discovered in integration tests, such as

  • specific tests that were supposed to cover all io engines only testing the async engine
  • tests not asserting error messages even though that was clearly the intention
  • test duplicating functionality for which we have helper functions

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

Make the test actually assert that the returned error matches the error
message stored in a local variable.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
The `response` variable was assigned, but never used. Just delete it.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.19%. Comparing base (3fb9a2a) to head (17f40ef).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5050   +/-   ##
=======================================
  Coverage   83.19%   83.19%           
=======================================
  Files         247      247           
  Lines       26641    26641           
=======================================
  Hits        22163    22163           
  Misses       4478     4478           
Flag Coverage Δ
5.10-c5n.metal 83.67% <ø> (+<0.01%) ⬆️
5.10-m5n.metal 83.66% <ø> (+<0.01%) ⬆️
5.10-m6a.metal 82.87% <ø> (+<0.01%) ⬆️
5.10-m6g.metal 79.66% <ø> (ø)
5.10-m6i.metal 83.65% <ø> (ø)
5.10-m7g.metal 79.66% <ø> (ø)
6.1-c5n.metal 83.67% <ø> (ø)
6.1-m5n.metal 83.65% <ø> (-0.01%) ⬇️
6.1-m6a.metal 82.86% <ø> (ø)
6.1-m6g.metal 79.66% <ø> (ø)
6.1-m6i.metal 83.64% <ø> (-0.01%) ⬇️
6.1-m7g.metal 79.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Instead of sleeping for 2 seconds to wait for booting, add a network
device and wait for ssh availability (happens automatically in
.start()). Use mark_killed() to assert that Firecracker exited instead
of "waitpid". Using `waitpid(2)` here is wrong, because it only works on
child processes, and Firecracker is no child of the pytest process (it
is daemonized, for starters). The reason we never caught this being
broken is because the test also simply ignores all exceptions raised.

But there's more issues here: The test never caused _killed to be set to
`True`, so if Firecracker really did exit, then we would have been
seeing intermittent failures during microvm teardown (as Microvm.kill()
asserts that the process is still alive if _killed is False). In fact,
our guest kernels do not have the required drivers compiled in to
support CTRL+ALT+DEL (thanks Riccardo for figuring this part out).

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Ensure all io_engine related tests run with both the sync and the async
io_engine.

Prior to 4.14 deprecation, some tests used the following logic to
determine whether the Async engine or the Sync engine should be tested:

If io_uring is supported (e.g. host_kernel != 4.14) then use Async
Else use Sync

This meant we were running with the Async engine on 5.10 and 6.1, and
with the Sync engine on 4.14. However, once 4.14 went out of support,
this meant that tests employing this logic only ever tested the Async
engine anymore. Fix this by having all these tests always run with both
Sync and Async engines, independently of host kernel version.

Also remove all logic around checking whether io_uring is supported,
because it definitely is supported on all currently supported host
kernels.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Turns out that `except ConnectionError` catches the `ConnectionError`
from the standard library, while what needs to be caught is the
(different) `ConnectionError` from the `requests` package.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat added a commit to roypat/firecracker that referenced this pull request Feb 26, 2025
Firecracker supports sending a CTRL+ALT+DEL event to the guest, to
trigger a reboot, and we had an integration test for this. However, the
integration test was broken (see firecracker-microvm#5050), and actually, our guest kernels
dont have the necessary drivers compiled in to actually receive the
CTRL+ALT+DEL.

Fix this by actually enabling the relavant Kconfigs. We don't re-build
the artifacts just yet, as it'll happen anyway in a few days when we
branch off the next release.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat added a commit to roypat/firecracker that referenced this pull request Feb 26, 2025
Firecracker supports sending a CTRL+ALT+DEL event to the guest, to
trigger a reboot, and we had an integration test for this. However, the
integration test was broken (see firecracker-microvm#5050), and actually, our guest kernels
dont have the necessary drivers compiled in to actually receive the
CTRL+ALT+DEL.

Fix this by actually enabling the relavant Kconfigs. We don't re-build
the artifacts just yet, as it'll happen anyway in a few days when we
branch off the next release.

Suggested-by: Riccardo Mancini <mancio@amazon.com>
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
roypat added a commit that referenced this pull request Feb 26, 2025
Firecracker supports sending a CTRL+ALT+DEL event to the guest, to
trigger a reboot, and we had an integration test for this. However, the
integration test was broken (see #5050), and actually, our guest kernels
dont have the necessary drivers compiled in to actually receive the
CTRL+ALT+DEL.

Fix this by actually enabling the relavant Kconfigs. We don't re-build
the artifacts just yet, as it'll happen anyway in a few days when we
branch off the next release.

Suggested-by: Riccardo Mancini <mancio@amazon.com>
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
@roypat
Copy link
Contributor Author

roypat commented Feb 26, 2025

blocked until we rebuild CI artifacts

@roypat roypat added the Status: Blocked Indicates that an issue or pull request cannot currently be worked on label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Indicates that an issue or pull request cannot currently be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant