docker_cli_plugins_test.go 1.9 KB

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