Conversation
Codecov Report
@@ Coverage Diff @@
## master #10864 +/- ##
==========================================
+ Coverage 78.37% 78.40% +0.02%
==========================================
Files 923 925 +2
Lines 105246 105409 +163
==========================================
+ Hits 82484 82643 +159
- Misses 17624 17627 +3
- Partials 5138 5139 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
f4d6bb6 to
e19b4d8
Compare
Yes, to me it makes sense. But I'll let @pedronis make the decision (this will also require a rule like |
e19b4d8 to
3807565
Compare
3807565 to
7ea0c54
Compare
@pedronis hi, do you have any concern about supporting |
pedronis
left a comment
There was a problem hiding this comment.
overall looks good, bunch of initial comments
There was a problem hiding this comment.
the long help should mention mount-control
There was a problem hiding this comment.
error should be lowercase, s/Failed to/cannot/
There was a problem hiding this comment.
yes, that makes sense I think
There was a problem hiding this comment.
umount should mention that the mount point should have been created with snapctl mount
There was a problem hiding this comment.
we should accept Type to be empty only if it's empty also in the attributes. In that case we also will omit from the unit.
There was a problem hiding this comment.
afaict the unit tests don't exercise this code, we need test for $SNAP_DATA and $SNAP_COMMON and the valid/invalid combinations with persistent
There was a problem hiding this comment.
I don't see them, forgot to push something?
There was a problem hiding this comment.
This code is now tested (it appears green in the coverage report), and the combinatio with persistent is tested here. You didn't mention $SNAP_COMMON in your other comment, so I didn't treat it specially. Let me know if I should.
There was a problem hiding this comment.
coverage and tested are not the same thing. I haven't rechecked but if this line is removed no tests fail, so this is not tested.
There was a problem hiding this comment.
You are right, I added one test now. I wanted to mock snapInfo.ExpandSnapVariables() but snap.Info is not an interface, so I fell back on using the production code and just compose the "where" in such a way that it would replicate the logic of info.DataDir().
There was a problem hiding this comment.
for a follow up but now I think we have 2 or 3 places in ctlcmd doing matches against this, maybe they can share a helper? worth checking at least
pedronis
left a comment
There was a problem hiding this comment.
another pass, some feedback changes seems not pushed
There was a problem hiding this comment.
I don't see them, forgot to push something?
There was a problem hiding this comment.
is this scenario tested?
There was a problem hiding this comment.
Yes, one branch was tested by the existing tests, and this new else is tested with this small addition
There was a problem hiding this comment.
I don't see a test for the happy case where both the plug and the command don't have type
There was a problem hiding this comment.
The newly added TestHappyWithVariableExpansion() incidentally tests that. Let me know if you'd rather have a separate test.
pedronis
left a comment
There was a problem hiding this comment.
thank you, one question about expanding the spread test
There was a problem hiding this comment.
would it be possible to add a happy/positive test using -t ?
There was a problem hiding this comment.
Ah! I tried it with tmpfs, just to realize that the interface does not really support it. I created #11190 to address the issue (and this also adds a positive test for the -t option)
There was a problem hiding this comment.
Isn't this already guaranteed by the required:"yes" in line 43?
There was a problem hiding this comment.
It doesn't seem so; at least, the unit test at https://github.com/mardy/snapd/blob/mount-control-3/overlord/hookstate/ctlcmd/umount_test.go#L108-L111 is able to trigger this condition.
There was a problem hiding this comment.
It doesn't seem so; at least, the unit test at https://github.com/mardy/snapd/blob/mount-control-3/overlord/hookstate/ctlcmd/umount_test.go#L108-L111 is able to trigger this condition.
The test isn't triggering the go-flags validation because of the empty string arg (I left a comment in the test). Fixing that means we can also remove this.
(I quoted your comment because even though I replied in the thread, it doesn't show in the new review's comment which makes this look like I'm talking to myself)
There was a problem hiding this comment.
nitpick: you could invert the condition and continue to remove a level of nesting but the code isn't contrived as it is so might not be worth it
There was a problem hiding this comment.
| * Copyright (C) 2021 Canonical Ltd | |
| * Copyright (C) 2022 Canonical Ltd |
There was a problem hiding this comment.
| * Copyright (C) 2021 Canonical Ltd | |
| * Copyright (C) 2022 Canonical Ltd |
There was a problem hiding this comment.
| * Copyright (C) 2021 Canonical Ltd | |
| * Copyright (C) 2022 Canonical Ltd |
There was a problem hiding this comment.
| * Copyright (C) 2021 Canonical Ltd | |
| * Copyright (C) 2022 Canonical Ltd |
There was a problem hiding this comment.
Nitpick^2, maybe "Remove a temporary.." or "Unmount a temporary.." ?
a4611cd to
ff43166
Compare
| _, _, err := ctlcmd.Run(s.mockContext, []string{"umount", ""}, 0) | ||
| c.Check(err, ErrorMatches, `mount point cannot be empty`) |
There was a problem hiding this comment.
This test isn't triggering the go-flags validation because of the empty string arg. Removing it fixes it (which means we also don't need to do the manual validation in umount.go)
| _, _, err := ctlcmd.Run(s.mockContext, []string{"umount", ""}, 0) | |
| c.Check(err, ErrorMatches, `mount point cannot be empty`) | |
| _, _, err := ctlcmd.Run(s.mockContext, []string{"umount"}, 0) | |
| c.Check(err, ErrorMatches, "the required argument `<where>` was not provided") |
There was a problem hiding this comment.
It doesn't seem so; at least, the unit test at https://github.com/mardy/snapd/blob/mount-control-3/overlord/hookstate/ctlcmd/umount_test.go#L108-L111 is able to trigger this condition.
The test isn't triggering the go-flags validation because of the empty string arg (I left a comment in the test). Fixing that means we can also remove this.
(I quoted your comment because even though I replied in the thread, it doesn't show in the new review's comment which makes this look like I'm talking to myself)
This adds support for persistent mounts, via a
snapctlsubcommand.