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 4 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 <kazukimassaki@R217WM4317.local>
Signed-off-by: kazuki.massaki <kazuki.massaki@gmail.com>
Signed-off-by: Kazuki Massaki <kazukimassaki@R217WM4317.local>
Signed-off-by: kazuki.massaki <kazuki.massaki@gmail.com>
Signed-off-by: Kazuki Massaki <kazukimassaki@R217WM4317.local>
Signed-off-by: kazuki.massaki <kazuki.massaki@gmail.com>
@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 <kazuki.massaki@gmail.com>
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.

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