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

add test process_capabilities_fail #3010

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kazmsk
Copy link

@kazmsk kazmsk commented Dec 4, 2024

This implements the process_capabilities_fail validation in #361

Kazuki Massaki added 3 commits December 9, 2024 08:49
Signed-off-by: Kazuki Massaki <[email protected]>
Signed-off-by: kazuki.massaki <[email protected]>
Signed-off-by: Kazuki Massaki <[email protected]>
Signed-off-by: kazuki.massaki <[email protected]>
Signed-off-by: Kazuki Massaki <[email protected]>
Signed-off-by: kazuki.massaki <[email protected]>
@kazmsk kazmsk force-pushed the add-test-process_capabilities_fail branch from 52dfb64 to 841a685 Compare December 8, 2024 23:49
Signed-off-by: kazuki.massaki <[email protected]>
Copy link
Collaborator

@YJDoc2 YJDoc2 left a comment

Choose a reason for hiding this comment

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

Hey, Thanks for the PR! There is some change needed - basically the current test validates the capabilities call itself fails, i.e. it will error out from line 9. However, we want to check that the container creation itself fails. For this we will need to create a spec with invalid value, and then assert that the container creation has failed.

For this, what we can do is this -

  • create a valid spec, with a single valid capacity
  • then use this spec with test_inside_container
    • here you'll need to update the code of test_inside_container in test_utils:204 to return error instead of calling unwrap.
    • In the function call, we get to provide a callback function which runs right before the container is created. This fn gets the rootfs path as a param. The spec (named config.json) it right outside the rootfs files for our tests, so you can edit the path to get the spec string, replace the cap name with an invalid name and re-write it there. Now we will have an invalid spec.
  • With this, you can check that the test_inside_container fails because of the capabilities issue.

Please let me know if the above explanation is not clear/ you need any help.

@kazmsk kazmsk force-pushed the add-test-process_capabilities_fail branch from beac1c7 to 2b72e74 Compare December 26, 2024 02:51
@kazmsk kazmsk requested a review from YJDoc2 December 26, 2024 03:20
@kazmsk
Copy link
Author

kazmsk commented Dec 26, 2024

@YJDoc2
I have modified it to test capability modification in the callback function.
Please review.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 26, 2024

Hey @kazmsk , thanks for the change, I'll try to take a look at this by the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants