add -f to plugin inspect

Signed-off-by: Victor Vieux <vieux@docker.com>

Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 63a19edcb18b1bc650cc1d6eed78c2c3b376be62
Component: engine
This commit is contained in:
Victor Vieux
2016-08-17 04:52:27 -07:00
parent 67ccfbdecc
commit e357d485dd
10 changed files with 70 additions and 50 deletions

View File

@ -4,9 +4,7 @@ import (
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
)
@ -28,17 +26,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
c.Assert(out, checker.Contains, pTag)
c.Assert(out, checker.Contains, "true")
out, _, err = dockerCmdWithError("plugin", "inspect", pNameWithTag)
c.Assert(err, checker.IsNil)
tmpFile, err := ioutil.TempFile("", "inspect.json")
c.Assert(err, checker.IsNil)
defer tmpFile.Close()
if _, err := tmpFile.Write([]byte(out)); err != nil {
c.Fatal(err)
}
// FIXME: When `docker plugin inspect` takes a format as input, jq can be replaced.
id, err := exec.Command("jq", ".Id", "--raw-output", tmpFile.Name()).CombinedOutput()
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
c.Assert(err, checker.IsNil)
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
@ -51,7 +39,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, pNameWithTag)
_, err = os.Stat(filepath.Join(dockerBasePath, "plugins", string(id)))
_, err = os.Stat(filepath.Join(dockerBasePath, "plugins", id))
if !os.IsNotExist(err) {
c.Fatal(err)
}