-
Notifications
You must be signed in to change notification settings - Fork 144
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 interface to remove mounts. #544
Conversation
validation/mounts.go
Outdated
"github.com/opencontainers/runtime-tools/validation/util" | ||
) | ||
|
||
func main() { | ||
util.Skip("TODO: mounts generation options have not been implemented", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is for runtime validation (and the TODO is stale now that #279 has landed, but that's another matter).
Tests for generation functionality (which is what you're adding in this PR) should go in generate/generate_test.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you would not want to have this in the validation code? This seems like the correct place unless you are dropping the validation code also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you would not want to have this in the validation code?
There are several types of validation in this repo:
- Config validation in
validate
, with unit tests invalidate/validate_test.go
. - Runtime validation (which calls the runtime executable, e.g. here) in
validation
. There are no unit tests for this (yet?). - Config generation argument checks in
generate
, with unit tests (of which there are currently few) ingenerate/generate_test.go
.
The tests you're currently adding here (a type-2 location) belong to type-3 (generation unit tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok copied it to the generate_test.go. But not sure if I should remove it totally from Validate. Currently tests in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok copied it to the generate_test.go.
That looks good to me.
But not sure if I should remove it totally from Validate.
I think you should, because the test has nothing to do with runtime compliance (which is what validation/
is for). It's just testing the generate implementation, so the generate_test.go
test you've added is all you need.
40c525c
to
1be2b1e
Compare
cmd/oci-runtime-tool/generate.go
Outdated
@@ -87,6 +87,7 @@ var generateFlags = []cli.Flag{ | |||
cli.StringSliceFlag{Name: "linux-sysctl", Usage: "add sysctl settings e.g net.ipv4.forward=1"}, | |||
cli.StringSliceFlag{Name: "linux-uidmappings", Usage: "add UIDMappings e.g HostID:ContainerID:Size"}, | |||
cli.StringSliceFlag{Name: "mounts-add", Usage: "configures additional mounts inside container"}, | |||
cli.StringSliceFlag{Name: "mounts-remove", Usage: "remove destionation mountpoints from inside container"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: destionation typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
The appropriate content should be added to |
@q384566678 Added to completions/bash |
@mrunalp PTAL |
One of the commits isn't signed. Otherwise looks good. |
We want to add a mount point to /dev/shm using the default spec, but we don't want to mount /dev/shm via a tmpfs and then add our mountpoint over it. RemoveMount will remove a mount point based on the Destination, if it exists. Does not return any error if the mount point does not exist. Also added Mounts() interface so that I could populate a test for new feature. Returns the list of mounts. Signed-off-by: Daniel J Walsh <[email protected]>
@mrunalp Fixed PR. |
We want to add a mount point to /dev/shm using the default spec,
but we don't want to mount /dev/shm via a tmpfs and then add our mountpoint
over it.
RemoveMount will remove a mount point based on the Destination, if it exists.
Does not return any error if the mount point does not exist. Also added
Mounts() interface so that I could populate a test for new feature. Returns
the list of mounts.
Signed-off-by: Daniel J Walsh [email protected]