-
Notifications
You must be signed in to change notification settings - Fork 948
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
feature: add volume inspect on cli and client side #585
feature: add volume inspect on cli and client side #585
Conversation
Codecov Report
@@ Coverage Diff @@
## master #585 +/- ##
==========================================
- Coverage 13.71% 13.56% -0.15%
==========================================
Files 64 64
Lines 3412 3449 +37
==========================================
Hits 468 468
- Misses 2896 2933 +37
Partials 48 48
Continue to review full report at Codecov.
|
Oh, I see. I will avoid duplicated work in the future by paying more attention to open PRs. |
client/volume.go
Outdated
func (client *APIClient) VolumeRemove(name string) error { | ||
resp, err := client.delete("/volumes/"+name, nil) | ||
ensureCloseReader(resp) | ||
|
||
return err | ||
} | ||
|
||
//VolumeInspect inspects a volume. |
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.
Please add a white space after //.
test/api_volume_inspect_test.go
Outdated
} | ||
path := "/volumes/create" | ||
body := request.WithJSONBody(obj) | ||
request.Post(path, body) |
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.
Please make request.Post return error and do assert here, since this may error here but we ignore this.
test/api_volume_inspect_test.go
Outdated
c.Assert(resp.StatusCode, check.Equals, 200) | ||
} | ||
|
||
//TestVolumeInspectNotFound tests inspecting a volume which cannot be found. |
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.
Please add a white space after //.
test/api_volume_inspect_test.go
Outdated
//TestVolumeInspectNotFound tests inspecting a volume which cannot be found. | ||
func (suite *APIVolumeInspectSuite) TestVolumeInspectNotFound(c *check.C) { | ||
//Delete the volume "TestVolume" which has been created. | ||
vol := "TestVolume" |
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.
Just define vol := NonExistentVolume
, so we can check if the status code is 404 directly.
Please help review the test part. @Letty5411 |
In the future, we will test removing a used volume. |
CI fails:
I think we need to update code in network manager. @rudyfly |
Same pr with #577, can you merge these, and I will close my pr, I think this pr the volume's information is less, should add more information in the pouchd. Do you think so. |
Signed-off-by: Zou Rui <21751189@zju.edu.cn>
LGTM |
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.
@@ -33,6 +33,7 @@ func (v *VolumeCommand) Init(c *Cli) { | |||
|
|||
c.AddCommand(v, &VolumeCreateCommand{}) | |||
c.AddCommand(v, &VolumeRemoveCommand{}) | |||
c.AddCommand(v, &VolumeInspectCommand{}) |
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.
In my pr, I use 'info' instead of 'inspect', but because of consistenting with moby's, inspect is better.
|
||
// VolumeRemoveCommand is used to implement 'volume rm' command. | ||
type VolumeRemoveCommand struct { | ||
baseCommand | ||
name string |
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.
Why add this variable?
func volumeInspectExample() string { | ||
return `$ pouch volume inspect a02217023fc477876a5483100b87d84d8845d5ac7c0c706717f2ff6edc0cf425 | ||
Scope: | ||
CreatedAt: |
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.
We should display all of information what is exist in pouchd. So it should be added in pouchd.
Signed-off-by: Zou Rui 21751189@zju.edu.cn
1.Describe what this PR did
add volume inspect on cli and client side
2.Does this pull request fix one issue?
fixes part of #139
3.Describe how you did it
4.Describe how to verify it
Firstly, you should create a volume.
Then you verify whether or not 'volume inspect' command works.
Finally, you remove that volume and try the 'volume inspect' command again to see if the error returned indicates that the volume does not exist.
5.Special notes for reviews