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

Tests: Misc fixes and documentation #4160

Merged
merged 8 commits into from
Oct 19, 2023

Conversation

pb8o
Copy link
Contributor

@pb8o pb8o commented Oct 9, 2023

Changes

Some small fixes to the tests regarding tech debt, and making it easier to run for other Firecracker binaries or outside the dev contrainer.

  • Replace old dependencies with more modern ones, or simpler approaches.
  • Changes to enable running a different firecracker binary.
  • Document how to run tests outside Docker

Reason

To decrease technical debt and simplify the codebase.

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

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@pb8o pb8o self-assigned this Oct 9, 2023
@pb8o pb8o added Priority: Low Indicates that an issue or pull request should be resolved behind issues or pull requests labelled ` Status: Awaiting author Indicates that an issue or pull request requires author action python Pull requests that update Python code labels Oct 9, 2023
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (8f4f0a0) 83.02% compared to head (940ccf2) 83.02%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4160   +/-   ##
=======================================
  Coverage   83.02%   83.02%           
=======================================
  Files         222      222           
  Lines       28635    28635           
=======================================
  Hits        23775    23775           
  Misses       4860     4860           
Flag Coverage Δ
4.14-c7g.metal 78.59% <ø> (+<0.01%) ⬆️
4.14-m5d.metal 80.37% <ø> (ø)
4.14-m6a.metal 79.52% <ø> (ø)
4.14-m6g.metal 78.59% <ø> (ø)
4.14-m6i.metal 80.37% <ø> (ø)
5.10-c7g.metal 81.50% <ø> (ø)
5.10-m5d.metal 83.04% <ø> (ø)
5.10-m6a.metal 82.29% <ø> (ø)
5.10-m6g.metal 81.50% <ø> (ø)
5.10-m6i.metal 83.04% <ø> (ø)
6.1-c7g.metal 81.50% <ø> (ø)
6.1-m5d.metal 83.05% <ø> (ø)
6.1-m6a.metal 82.29% <ø> (ø)
6.1-m6g.metal 81.50% <ø> (ø)
6.1-m6i.metal 83.04% <ø> (+<0.01%) ⬆️

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.

@pb8o pb8o force-pushed the test-misc-fixes branch 7 times, most recently from 40f47fd to b4de25c Compare October 10, 2023 14:57
@pb8o pb8o added Status: Awaiting review Indicates that a pull request is ready to be reviewed and removed Status: Awaiting author Indicates that an issue or pull request requires author action labels Oct 10, 2023
@pb8o pb8o changed the title Test misc fixes Tests: Misc fixes and documentation Oct 10, 2023
tests/framework/microvm.py Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
tools/sandbox.py Show resolved Hide resolved
tests/README.md Outdated Show resolved Hide resolved
pb8o added 8 commits October 18, 2023 17:49
Turns out bin_cloner is not needed to run Firecracker under pytest.
Could be it was only required by older versions of Python, but not
anymore.

Running directly the jailer with PID namespaces is closer to our
recommended prod setup.

Signed-off-by: Pablo Barbáchano <[email protected]>
Clean a bit the Microvm constructor by moving the uuid optional
parameters to factory defaults, and always expecting `pathlib.Path`

Signed-off-by: Pablo Barbáchano <[email protected]>
The retry library has been unmaintained for a while with its last
release in 2016.

Replace with tenacity, which is the spiritual successor.

Signed-off-by: Pablo Barbáchano <[email protected]>
Use `ip netns exec` when calling the ssh process. This means the pytest
thread does not have to switch network namespace and back.

We already use the same approach just below for the tap device, so now
there is a single way to enter a network namespace.

Also drop the nsenter Python package dependency, which seems
unmaintained.

Signed-off-by: Pablo Barbáchano <[email protected]>
Since we added the option to use a different binary than the workspace
in 83fcb04, add a property to capture
the name of the binary.

Signed-off-by: Pablo Barbáchano <[email protected]>
Can be useful to test against different Firecracker versions.

Signed-off-by: Pablo Barbáchano <[email protected]>
Document some of the sandbox subcommand options.

Signed-off-by: Pablo Barbáchano <[email protected]>
In get_host_os, if there are not enough components, return None.

Signed-off-by: Pablo Barbáchano <[email protected]>
@pb8o pb8o merged commit eb292e3 into firecracker-microvm:main Oct 19, 2023
5 checks passed
@pb8o pb8o deleted the test-misc-fixes branch October 19, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Indicates that an issue or pull request should be resolved behind issues or pull requests labelled ` python Pull requests that update Python code Status: Awaiting review Indicates that a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants