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

RPMTEST_CHECK should run in the snapshot by default #3545

Open
dmnks opened this issue Jan 29, 2025 · 2 comments
Open

RPMTEST_CHECK should run in the snapshot by default #3545

dmnks opened this issue Jan 29, 2025 · 2 comments
Labels
RFE test Testsuite-related

Comments

@dmnks
Copy link
Contributor

dmnks commented Jan 29, 2025

Currently, we allow individual tests to perform their objective in a separate (nested) container which we call a snapshot. The snapshot is a mutable variant of the read-only parent container that holds the rpmtests script itself. To request a snapshot, a test can declare RPMTEST_SETUP_RW instead of RPMTEST_SETUP at the top, and then use the runroot wrapper when calling the RPM binaries. To modify or inspect the snapshot's filesystem in between those runroot commands, a test can use the $RPMTEST path which points to it.

Since RPM is a package management tool, its purpose is to modify the root filesystem (or a different installroot if specified). Snapshots provide a way to isolate this from the test logic itself which typically uses various system utilities whose functionality could otherwise be affected. It basically allows a test to inspect the $RPMTEST filesystem from the outside, using the system utilities provided in the immutable test image.

This separation actually comes from the fakechroot times where it was more of a necessity than anything. However, it turns out to be a useful feature on its own since it provides a clear separation as described. It was also kept in the containerization of the test-suite via #1580 since the whole test infrastructure relied on this separation and reworking that would've made the whole effort much more complex.

That said, most tests don't really need this separation as they don't make breaking changes to the filesystem that could potentially have an effect on the verification steps. In fact, I don't think we have any such tests at the moment that would benefit from such complete isolation. Yet, I don't think we should get rid of this ability altogether, either.

As it is now, the separation adds additional boilerplate and/or confusion to individual tests. One has to always remember to use runroot when calling RPM commands and $RPMTEST when e.g. creating files in the snapshot beforehand. Therefore, to make this experience less jarring and optimize for the most common use case (which doesn't require this kind of full isolation), we could either:

  1. Alias runroot rpm to rpm (and similar variants) if RPMTEST_SETUP_RW was used, or
  2. Run the entirety of RPMTEST_CHECK in a snapshot if RPMTEST_SETUP_RW was used, basically like runroot_other ./this-test.sh

No. 2 might prove to be challenging since we'd have to somehow wrap the contents of the M4 macro RPMTEST_CHECK inside an executable script that's run via runroot_other (snapshot exec underneath) or similar.

Related discussion also here: #3542

@dmnks dmnks added the RFE label Jan 29, 2025
@dmnks
Copy link
Contributor Author

dmnks commented Jan 29, 2025

One downside of 1. is that the alias would just obfuscate the separation and could make writing tests even more confusing in the long run. So this ticket is primarily about exploring option 2.

@dmnks
Copy link
Contributor Author

dmnks commented Jan 29, 2025

Of course, to keep the full isolation feature in place, we could still make it possible to do just that, via some additional RPMTEST_SETUP_* variant of the like.

@dmnks dmnks added the test Testsuite-related label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFE test Testsuite-related
Projects
None yet
Development

No branches or pull requests

1 participant