Repository navigation
tests/test_oci_features: fix comparison of features - #2385
Merged
Merged
Conversation
The test has a full copy of the mount options list from src/libcrun/mount_flags.perf, which has to be updated every time an option is added, and only catches the case when it is not. Check that a few basic options are present instead. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The test compares each expected feature with sorted(actual) == sorted(expected), which is wrong for anything but lists: - for strings, it compares sorted characters, so e.g. "0.1.1+dev" matches the expected "1.1.0+dev"; - for dicts, it only compares the keys, not the values. Worse, since the expected "linux" section has "capabilities", the whole section is skipped after checking capabilities, so namespaces, cgroup, seccomp, apparmor, selinux and mountExtensions are never checked, and the code adjusting the expected seccomp and systemd values is a no-op. Also, the expected "annotations" are never used (and have wrong names), as annotations are checked separately. Add a recursive comparison: dicts are checked key by key (extra keys in the actual output are ignored), lists must have the same elements in any order, and anything else must be equal. Check capabilities and annotations separately, as before, and remove the unused expected annotations. While at it, set the expected seccomp and systemd values for builds without them. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
TMT tests failed. @containers/packit-build please check. |
1 similar comment
|
TMT tests failed. @containers/packit-build please check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test compares each expected feature using
sorted(actual) == sorted(expected), which only works for lists:0.1.1+devmatches the expected1.1.0+dev;Worse, the whole
linuxsection is skipped after checking capabilities, so namespaces, cgroup, seccomp, apparmor, selinux and mountExtensions are never checked. The expectedannotationsare never used either.Replace it with a recursive comparison (extra keys in the actual output are ignored, lists are compared regardless of order), and set the expected seccomp and systemd values for builds without them.
I checked it by feeding the test a modified
crun featuresoutput: dropping a namespace, settingociVersionMaxto0.1.1+dev, disabling apparmor, removingmountExtensionsor a seccomp action, flippingsystemd. The old test passes with all of these, the new one fails as expected.Depends on #2384 (its first commit is included here, to avoid a conflict).