integration-cli/docker_cli_plugins_test.go
3e44703c
 package main
 
 import (
 	"github.com/docker/docker/pkg/integration/checker"
 	"github.com/go-check/check"
da773af8
 
 	"strings"
 )
 
 var (
 	pName        = "tiborvass/no-remove"
 	pTag         = "latest"
 	pNameWithTag = pName + ":" + pTag
3e44703c
 )
 
 func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
 	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
da773af8
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
3e44703c
 	c.Assert(err, checker.IsNil)
 
 	out, _, err := dockerCmdWithError("plugin", "ls")
 	c.Assert(err, checker.IsNil)
da773af8
 	c.Assert(out, checker.Contains, pName)
 	c.Assert(out, checker.Contains, pTag)
3e44703c
 	c.Assert(out, checker.Contains, "true")
 
da773af8
 	out, _, err = dockerCmdWithError("plugin", "inspect", pNameWithTag)
3e44703c
 	c.Assert(err, checker.IsNil)
 	c.Assert(out, checker.Contains, "A test plugin for Docker")
 
da773af8
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
3e44703c
 	c.Assert(out, checker.Contains, "is active")
 
da773af8
 	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
3e44703c
 	c.Assert(err, checker.IsNil)
 
da773af8
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
3e44703c
 	c.Assert(err, checker.IsNil)
da773af8
 	c.Assert(out, checker.Contains, pNameWithTag)
3e44703c
 }
82608cd4
 
 func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
 	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
da773af8
 	out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
82608cd4
 	c.Assert(err, checker.IsNil)
da773af8
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
82608cd4
 
da773af8
 	out, _, err = dockerCmdWithError("plugin", "ls")
82608cd4
 	c.Assert(err, checker.IsNil)
 	c.Assert(out, checker.Contains, "false")
 
da773af8
 	out, _, err = dockerCmdWithError("plugin", "enable", pName)
 	c.Assert(err, checker.IsNil)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "disable", pName)
 	c.Assert(err, checker.IsNil)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pName)
82608cd4
 	c.Assert(err, checker.IsNil)
da773af8
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
82608cd4
 }
61dc82f4
 
 func (s *DockerSuite) TestPluginInstallImage(c *check.C) {
 	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
 	out, _, err := dockerCmdWithError("plugin", "install", "redis")
 	c.Assert(err, checker.NotNil)
 	c.Assert(out, checker.Contains, "content is not a plugin")
 }