mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-04 15:58:39 +00:00
Merge pull request #16009 from azurezk/vol-create-conflict-option
volume create error on conflict option
This commit is contained in:
@@ -4,7 +4,9 @@ import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
"github.com/docker/docker/volume"
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
@@ -20,6 +22,18 @@ func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
|
||||
c.Assert(name, check.Equals, "test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCliCreateOptionConflict(c *check.C) {
|
||||
dockerCmd(c, "volume", "create", "--name=test")
|
||||
out, _, err := dockerCmdWithError("volume", "create", "--name", "test", "--driver", "nosuchdriver")
|
||||
c.Assert(err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
||||
stderr := derr.ErrorVolumeNameTaken.WithArgs("test", volume.DefaultDriverName).Error()
|
||||
c.Assert(strings.Contains(out, strings.TrimPrefix(stderr, "volume name taken: ")), check.Equals, true)
|
||||
|
||||
out, _ = dockerCmd(c, "volume", "inspect", "--format='{{ .Driver }}'", "test")
|
||||
_, _, err = dockerCmdWithError("volume", "create", "--name", "test", "--driver", strings.TrimSpace(out))
|
||||
c.Assert(err, check.IsNil)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
c.Assert(
|
||||
|
||||
Reference in New Issue
Block a user