integration-cli: remove inspectMountPointJSON()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-06-03 11:01:25 +02:00
parent 940730093b
commit 61c434c030
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 6 additions and 14 deletions

View file

@ -106,12 +106,9 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *testing.T) {
c.Fatal(err, out)
}
out, err := s.d.Cmd("inspect", "-f", "{{json .Mounts}}", "volrestarttest1")
assert.NilError(c, err, out)
if _, err := inspectMountPointJSON(out, "/foo"); err != nil {
c.Fatalf("Expected volume to exist: /foo, error: %v\n", err)
}
out, err := s.d.Cmd("inspect", "-f", `{{range .Mounts}}{{.Destination}}{{"\n"}}{{end}}`, "volrestarttest1")
assert.Check(c, err)
assert.Check(c, is.Contains(strings.Split(out, "\n"), "/foo"))
}
// #11008

View file

@ -132,6 +132,8 @@ func inspectMountSourceField(name, destination string) (string, error) {
return m.Source, nil
}
var errMountNotFound = errors.New("mount point not found")
// Deprecated: use cli.Docker
func inspectMountPoint(name, destination string) (types.MountPoint, error) {
out, err := inspectFilter(name, "json .Mounts")
@ -139,15 +141,8 @@ func inspectMountPoint(name, destination string) (types.MountPoint, error) {
return types.MountPoint{}, err
}
return inspectMountPointJSON(out, destination)
}
var errMountNotFound = errors.New("mount point not found")
// Deprecated: use cli.Docker
func inspectMountPointJSON(j, destination string) (types.MountPoint, error) {
var mp []types.MountPoint
if err := json.Unmarshal([]byte(j), &mp); err != nil {
if err := json.Unmarshal([]byte(out), &mp); err != nil {
return types.MountPoint{}, err
}