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

Support testing different kernel versions #1100

Merged
merged 5 commits into from
Aug 27, 2024
Merged

Support testing different kernel versions #1100

merged 5 commits into from
Aug 27, 2024

Conversation

rafaelroquetto
Copy link
Contributor

@rafaelroquetto rafaelroquetto commented Aug 21, 2024

Virtual Machine Tests enables Beyla to be tested under different kernel versions and architectures. This works by exposing the path to the Beyla source code (i.e. this git repository) to the guest by means of mounting it to the '/build' directory. This allows Makefile targets to be invoked from within the guest, in particular those tied to integration tests. Analogous to a Docker container, changes to the '/build' directory are volatile and are neither reflected on the host nor preserved once the VM terminates.

The supported pre-compiled kernels can be found in the kernels/$arch/ subdirectory, alongside their respective kernel config files.


USAGE

Simply run 'make' to get started. This will build a new rootfs image and launch the VM using the default kernel specified in the Makefile. To select a different kernel version. The following environment variables can be used to specify the kernel version or architecture to run:

  • ARCH: the target architecture (currently only x86_64 is supported)
  • KERNEL_VER: the kernel version to use OR;
  • KERNEL: path the kernel image to use
  • TARGET_TEST: the target to pass to Beyla's toplevel Makefile (defaults to run-integration-test-vm). When set to empty, the VM will drop onto an interactive shell

For debugging purposes, the VM also exposes an SSH endpoint at port 2222. The
access credentials are root:root.

See test/vm/README for further information, including on how to deploy new kernels.

Resolves #878

Tip: reviewing individual commits might be simpler.

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.38%. Comparing base (a3ffb2f) to head (3f8cada).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1100      +/-   ##
==========================================
- Coverage   79.44%   79.38%   -0.07%     
==========================================
  Files         140      140              
  Lines       11514    11514              
==========================================
- Hits         9147     9140       -7     
- Misses       1825     1829       +4     
- Partials      542      545       +3     
Flag Coverage Δ
k8s-integration-test 59.27% <ø> (ø)
oats-test 37.07% <ø> (ø)
unittests 52.37% <ø> (+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.

@rafaelroquetto rafaelroquetto force-pushed the vmtests branch 12 times, most recently from b52b012 to 64081af Compare August 22, 2024 23:08
@rafaelroquetto rafaelroquetto changed the title WIP WIP: Support testing different kernel versions Aug 23, 2024
@rafaelroquetto rafaelroquetto force-pushed the vmtests branch 9 times, most recently from bdb3148 to 8db65a7 Compare August 24, 2024 00:03
@rafaelroquetto rafaelroquetto changed the title WIP: Support testing different kernel versions Support testing different kernel versions Aug 24, 2024
@rafaelroquetto rafaelroquetto added the do-not-merge WIP or something that musn't be merged label Aug 24, 2024
@rafaelroquetto rafaelroquetto force-pushed the vmtests branch 2 times, most recently from 6f1c0e2 to 8121d5c Compare August 24, 2024 00:24
@rafaelroquetto rafaelroquetto marked this pull request as ready for review August 24, 2024 00:34
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Excellent work!

Copy link
Contributor

@marctc marctc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @rafaelroquetto, very much needed!

My question here is, do we want to run these tests on every PR? The pipeline is already slow, some times flaky, and quite complex to debug if something fails. Adding more tests here might be a burden for some pull requests.

In this PR you added two tests, but what would happen if we want to test more kernel and different architectures? My suggestion would be to move these tests to be built only in main. This has the cost that we have to monitor the health of builds/test in main as some thing may broke, but hopefully what can use some tooling like this: https://grafana.com/blog/2023/11/20/ci-cd-observability-via-opentelemetry-at-grafana-labs/

@rafaelroquetto
Copy link
Contributor Author

@marctc that sound pretty reasonable to me - it should also be straightforward to flick the switch back and forth if we decide down the road that building only on main is not cutting it. @mariomac @grcevski, any thoughts from your end?

@grcevski
Copy link
Contributor

@marctc that sound pretty reasonable to me - it should also be straightforward to flick the switch back and forth if we decide down the road that building only on main is not cutting it. @mariomac @grcevski, any thoughts from your end?

I think limiting when these tests run makes a lot of sense, I wonder if the best approach is to run them only if we have changes in the BPF generated files? PRs that don't touch that part shouldn't need to run the VM tests. This is similar how testing of the documentation works, unless we touch docs, doc testing isn't running. WDYT?

@grcevski
Copy link
Contributor

I personally would like to run them on PRs, because they catch failures which I can't catch myself with my main development kernel version.

@rafaelroquetto
Copy link
Contributor Author

Good idea - I can look into running these workflows only when the ebpf files have changed. This should address @marctc's concerns whilst not compromising coverage.

@rafaelroquetto
Copy link
Contributor Author

Tests now passing:

They aren't appearing on the latest update as they have been disabled when there are no changes to the ebpf files.

@rafaelroquetto rafaelroquetto force-pushed the vmtests branch 2 times, most recently from 1db7459 to bf00bf7 Compare August 27, 2024 20:28
@rafaelroquetto rafaelroquetto removed the do-not-merge WIP or something that musn't be merged label Aug 27, 2024
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@rafaelroquetto rafaelroquetto merged commit 3b5450b into main Aug 27, 2024
6 checks passed
@rafaelroquetto rafaelroquetto deleted the vmtests branch August 27, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create VM tests
4 participants