1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/docker_cli_plugins_test.go
Anusha Ragunathan d32df6d934 Detect non-plugin content during install and error out.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-06 18:49:39 -07:00

61 lines
1.9 KiB
Go

package main
import (
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
)
func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
testRequires(c, DaemonIsLinux, ExperimentalDaemon)
name := "tiborvass/no-remove"
tag := "latest"
nameWithTag := name + ":" + tag
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", name)
c.Assert(err, checker.IsNil)
out, _, err := dockerCmdWithError("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, name)
c.Assert(out, checker.Contains, tag)
c.Assert(out, checker.Contains, "true")
out, _, err = dockerCmdWithError("plugin", "inspect", nameWithTag)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "A test plugin for Docker")
out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
c.Assert(out, checker.Contains, "is active")
_, _, err = dockerCmdWithError("plugin", "disable", nameWithTag)
c.Assert(err, checker.IsNil)
out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, nameWithTag)
}
func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
testRequires(c, DaemonIsLinux, ExperimentalDaemon)
name := "tiborvass/no-remove"
tag := "latest"
nameWithTag := name + ":" + tag
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", name)
c.Assert(err, checker.IsNil)
out, _, err := dockerCmdWithError("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "false")
out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, nameWithTag)
}
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")
}