Add unit tests to cli/command/volume package#31124
Conversation
7f2c630 to
d414c92
Compare
|
d414c92 to
056259a
Compare
|
The test failure is related to this change |
|
@dnephin yep I need to update 😛 |
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
056259a to
6da111b
Compare
| "golang.org/x/net/context" | ||
| ) | ||
|
|
||
| type fakeClient struct { |
| } | ||
|
|
||
| func runCreate(dockerCli *command.DockerCli, opts createOptions) error { | ||
| func runCreate(dockerCli command.Cli, opts createOptions) error { |
There was a problem hiding this comment.
Curious about removing the pointer reference here?
There was a problem hiding this comment.
command.DockerCli is a struct, command.Cli is an interface. I don't want a pointer on the interface, I just want something that satisfy my interface (and *command.DockerCli is one of them)
| volumeInspectFunc func(volumeID string) (types.Volume, error) | ||
| expectedError string | ||
| }{ | ||
| { |
There was a problem hiding this comment.
I think initialising this table value with nil args/volumeInspectFunc would be easier to read over time.
| } | ||
|
|
||
| func TestVolumeInspectWithoutFormat(t *testing.T) { | ||
| testCases := []struct { |
There was a problem hiding this comment.
Since the anonymous struct is re-used several times perhaps you could refactor it to its own named struct type (unexported)
| if opts.name != "" { | ||
| fmt.Fprint(dockerCli.Err(), "Conflicting options: either specify --name or provide positional arg, not both\n") | ||
| return cli.StatusError{StatusCode: 1} | ||
| return fmt.Errorf("Conflicting options: either specify --name or provide positional arg, not both\n") |
There was a problem hiding this comment.
Just confirmed with @vdemeester that the exit code is still 1 here
Add unit tests to cli/command/volume package
Another cli unit test PR, this time, on
volumes👼/cc @aaronlehmann @thaJeztah @cpuguy83 @dnephin @icecrime
🐸
Signed-off-by: Vincent Demeester vincent@sbr.pm