mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix volume Create to check against canonical driver name
Previously, it was comparing against the driver name passed in by the caller. This could lead to subtle issues when using plugins, like "plugin" vs. "plugin:latest". Also, remove "conflict:" prefix to improve the error message. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
2a97ea9a6e
commit
53d447c5d5
4 changed files with 28 additions and 18 deletions
|
@ -284,6 +284,22 @@ func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C) {
|
||||
dockerCmd(c, "volume", "create", "test")
|
||||
|
||||
out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
|
||||
c.Assert(err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
||||
c.Assert(out, checker.Contains, "A volume named test already exists")
|
||||
|
||||
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
|
||||
_, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out))
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
// make sure hidden --name option conflicts with positional arg name
|
||||
out, _, err = dockerCmdWithError("volume", "create", "--name", "test2", "test2")
|
||||
c.Assert(err, check.NotNil, check.Commentf("Conflicting options: either specify --name or provide positional arg, not both"))
|
||||
}
|
||||
|
||||
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) {
|
||||
s.d.StartWithBusybox(c)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue