You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Alias runroot rpm to rpm (and similar variants) if RPMTEST_SETUP_RW was used, or
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.
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.
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.
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 declareRPMTEST_SETUP_RW
instead ofRPMTEST_SETUP
at the top, and then use therunroot
wrapper when calling the RPM binaries. To modify or inspect the snapshot's filesystem in between thoserunroot
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:runroot rpm
torpm
(and similar variants) ifRPMTEST_SETUP_RW
was used, orRPMTEST_CHECK
in a snapshot ifRPMTEST_SETUP_RW
was used, basically likerunroot_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 viarunroot_other
(snapshot exec
underneath) or similar.Related discussion also here: #3542
The text was updated successfully, but these errors were encountered: