github.com/go/docker@v1.12.0-rc2/integration-cli/docker_cli_plugins_test.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/docker/docker/pkg/integration/checker"
     5  	"github.com/go-check/check"
     6  )
     7  
     8  func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
     9  	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
    10  	name := "tiborvass/no-remove"
    11  	tag := "latest"
    12  	nameWithTag := name + ":" + tag
    13  
    14  	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", name)
    15  	c.Assert(err, checker.IsNil)
    16  
    17  	out, _, err := dockerCmdWithError("plugin", "ls")
    18  	c.Assert(err, checker.IsNil)
    19  	c.Assert(out, checker.Contains, name)
    20  	c.Assert(out, checker.Contains, tag)
    21  	c.Assert(out, checker.Contains, "true")
    22  
    23  	out, _, err = dockerCmdWithError("plugin", "inspect", nameWithTag)
    24  	c.Assert(err, checker.IsNil)
    25  	c.Assert(out, checker.Contains, "A test plugin for Docker")
    26  
    27  	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
    28  	c.Assert(out, checker.Contains, "is active")
    29  
    30  	_, _, err = dockerCmdWithError("plugin", "disable", nameWithTag)
    31  	c.Assert(err, checker.IsNil)
    32  
    33  	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
    34  	c.Assert(err, checker.IsNil)
    35  	c.Assert(out, checker.Contains, nameWithTag)
    36  }
    37  
    38  func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
    39  	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
    40  	name := "tiborvass/no-remove"
    41  	tag := "latest"
    42  	nameWithTag := name + ":" + tag
    43  
    44  	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", name)
    45  	c.Assert(err, checker.IsNil)
    46  
    47  	out, _, err := dockerCmdWithError("plugin", "ls")
    48  	c.Assert(err, checker.IsNil)
    49  	c.Assert(out, checker.Contains, "false")
    50  
    51  	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
    52  	c.Assert(err, checker.IsNil)
    53  	c.Assert(out, checker.Contains, nameWithTag)
    54  }