Browse code

Add basic integration tests for plugins.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit a2d48c9e4e2abadcba582de47891837b0a80b24c)

Anusha Ragunathan authored on 2016/06/16 02:18:55
Showing 3 changed files
... ...
@@ -31,7 +31,7 @@ func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command {
31 31
 	}
32 32
 
33 33
 	flags := cmd.Flags()
34
-	flags.BoolVar(&options.grantPerms, "grant-permissions", true, "grant all permissions necessary to run the plugin")
34
+	flags.BoolVar(&options.grantPerms, "grant-all-permissions", true, "grant all permissions necessary to run the plugin")
35 35
 
36 36
 	return cmd
37 37
 }
38 38
new file mode 100644
... ...
@@ -0,0 +1,36 @@
0
+package main
1
+
2
+import (
3
+	"github.com/docker/docker/pkg/integration/checker"
4
+	"github.com/go-check/check"
5
+)
6
+
7
+func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
8
+	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
9
+	name := "tiborvass/no-remove"
10
+	tag := "latest"
11
+	nameWithTag := name + ":" + tag
12
+
13
+	_, _, err := dockerCmdWithError("plugin", "install", name)
14
+	c.Assert(err, checker.IsNil)
15
+
16
+	out, _, err := dockerCmdWithError("plugin", "ls")
17
+	c.Assert(err, checker.IsNil)
18
+	c.Assert(out, checker.Contains, name)
19
+	c.Assert(out, checker.Contains, tag)
20
+	c.Assert(out, checker.Contains, "true")
21
+
22
+	out, _, err = dockerCmdWithError("plugin", "inspect", nameWithTag)
23
+	c.Assert(err, checker.IsNil)
24
+	c.Assert(out, checker.Contains, "A test plugin for Docker")
25
+
26
+	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
27
+	c.Assert(out, checker.Contains, "is active")
28
+
29
+	_, _, err = dockerCmdWithError("plugin", "disable", nameWithTag)
30
+	c.Assert(err, checker.IsNil)
31
+
32
+	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
33
+	c.Assert(err, checker.IsNil)
34
+	c.Assert(out, checker.Contains, nameWithTag)
35
+}
... ...
@@ -30,6 +30,10 @@ var (
30 30
 		func() bool { return daemonPlatform == "linux" },
31 31
 		"Test requires a Linux daemon",
32 32
 	}
33
+	ExperimentalDaemon = testRequirement{
34
+		func() bool { return utils.ExperimentalBuild() },
35
+		"Test requires an experimental daemon",
36
+	}
33 37
 	NotExperimentalDaemon = testRequirement{
34 38
 		func() bool { return !utils.ExperimentalBuild() },
35 39
 		"Test requires a non experimental daemon",