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

capability: test improvements #170

Merged
merged 2 commits into from
Oct 11, 2024
Merged

Conversation

kolyshkin
Copy link
Collaborator

See commits for details.

@lifubang PTAL

1. Use testing.TB so it can also be used from a benchmark.

2. Add a call to t.Helper.

Signed-off-by: Kir Kolyshkin <[email protected]>
 - do not manipulate bounding set, it is not needed;
 - use a single list; add one more capability to it;
 - set Permitted/Inheritable/Effective at once;
 - use Unset to unset a capability;
 - use loop for the last check.

Signed-off-by: Kir Kolyshkin <[email protected]>
pid.Set(AMBIENT, capAmbient...)
if err = pid.Apply(CAPS | BOUNDING | AMBIENT); err != nil {

list := []Cap{CAP_KILL, CAP_CHOWN, CAP_SYS_CHROOT}
Copy link
Contributor

Choose a reason for hiding this comment

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

From docker to kubernetes, they always fill each type cap sets with the same cap bits, I think maybe it's wrong. So I want to test cap sets with different caps, this is my thought.
But anyway, it's not worth to be different in this test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I understand that (what I don't understand is why they do it that way -- for example, why drop bounding capabilities at all; but that is way out of scope for this PR).

@kolyshkin kolyshkin merged commit e9445a4 into moby:main Oct 11, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants