Browse code

plugins: fix some tests

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2016/11/11 06:07:53
Showing 4 changed files
... ...
@@ -13,8 +13,6 @@ import (
13 13
 	"github.com/go-check/check"
14 14
 )
15 15
 
16
-var pluginName = "tiborvass/no-remove"
17
-
18 16
 // TestDaemonRestartWithPluginEnabled tests state restore for an enabled plugin
19 17
 func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) {
20 18
 	testRequires(c, Network)
... ...
@@ -23,15 +21,15 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) {
23 23
 		c.Fatalf("Could not start daemon: %v", err)
24 24
 	}
25 25
 
26
-	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName); err != nil {
26
+	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
27 27
 		c.Fatalf("Could not install plugin: %v %s", err, out)
28 28
 	}
29 29
 
30 30
 	defer func() {
31
-		if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
31
+		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
32 32
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
33 33
 		}
34
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
34
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
35 35
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
36 36
 		}
37 37
 	}()
... ...
@@ -44,7 +42,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) {
44 44
 	if err != nil {
45 45
 		c.Fatalf("Could not list plugins: %v %s", err, out)
46 46
 	}
47
-	c.Assert(out, checker.Contains, pluginName)
47
+	c.Assert(out, checker.Contains, pName)
48 48
 	c.Assert(out, checker.Contains, "true")
49 49
 }
50 50
 
... ...
@@ -56,12 +54,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) {
56 56
 		c.Fatalf("Could not start daemon: %v", err)
57 57
 	}
58 58
 
59
-	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName, "--disable"); err != nil {
59
+	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName, "--disable"); err != nil {
60 60
 		c.Fatalf("Could not install plugin: %v %s", err, out)
61 61
 	}
62 62
 
63 63
 	defer func() {
64
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
64
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
65 65
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
66 66
 		}
67 67
 	}()
... ...
@@ -74,7 +72,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) {
74 74
 	if err != nil {
75 75
 		c.Fatalf("Could not list plugins: %v %s", err, out)
76 76
 	}
77
-	c.Assert(out, checker.Contains, pluginName)
77
+	c.Assert(out, checker.Contains, pName)
78 78
 	c.Assert(out, checker.Contains, "false")
79 79
 }
80 80
 
... ...
@@ -86,17 +84,17 @@ func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *check.C) {
86 86
 	if err := s.d.Start("--live-restore"); err != nil {
87 87
 		c.Fatalf("Could not start daemon: %v", err)
88 88
 	}
89
-	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName); err != nil {
89
+	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
90 90
 		c.Fatalf("Could not install plugin: %v %s", err, out)
91 91
 	}
92 92
 	defer func() {
93 93
 		if err := s.d.Restart("--live-restore"); err != nil {
94 94
 			c.Fatalf("Could not restart daemon: %v", err)
95 95
 		}
96
-		if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
96
+		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
97 97
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
98 98
 		}
99
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
99
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
100 100
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
101 101
 		}
102 102
 	}()
... ...
@@ -105,7 +103,7 @@ func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *check.C) {
105 105
 		c.Fatalf("Could not kill daemon: %v", err)
106 106
 	}
107 107
 
108
-	cmd := exec.Command("pgrep", "-f", "plugin-no-remove")
108
+	cmd := exec.Command("pgrep", "-f", pluginProcessName)
109 109
 	if out, ec, err := runCommandWithOutput(cmd); ec != 0 {
110 110
 		c.Fatalf("Expected exit code '0', got %d err: %v output: %s ", ec, err, out)
111 111
 	}
... ...
@@ -119,17 +117,17 @@ func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C)
119 119
 	if err := s.d.Start("--live-restore"); err != nil {
120 120
 		c.Fatalf("Could not start daemon: %v", err)
121 121
 	}
122
-	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName); err != nil {
122
+	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
123 123
 		c.Fatalf("Could not install plugin: %v %s", err, out)
124 124
 	}
125 125
 	defer func() {
126 126
 		if err := s.d.Restart("--live-restore"); err != nil {
127 127
 			c.Fatalf("Could not restart daemon: %v", err)
128 128
 		}
129
-		if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
129
+		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
130 130
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
131 131
 		}
132
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
132
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
133 133
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
134 134
 		}
135 135
 	}()
... ...
@@ -138,7 +136,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C)
138 138
 		c.Fatalf("Could not kill daemon: %v", err)
139 139
 	}
140 140
 
141
-	cmd := exec.Command("pgrep", "-f", "plugin-no-remove")
141
+	cmd := exec.Command("pgrep", "-f", pluginProcessName)
142 142
 	if out, ec, err := runCommandWithOutput(cmd); ec != 0 {
143 143
 		c.Fatalf("Expected exit code '0', got %d err: %v output: %s ", ec, err, out)
144 144
 	}
... ...
@@ -151,7 +149,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) {
151 151
 	if err := s.d.Start(); err != nil {
152 152
 		c.Fatalf("Could not start daemon: %v", err)
153 153
 	}
154
-	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName); err != nil {
154
+	if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
155 155
 		c.Fatalf("Could not install plugin: %v %s", err, out)
156 156
 	}
157 157
 
... ...
@@ -159,10 +157,10 @@ func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) {
159 159
 		if err := s.d.Restart(); err != nil {
160 160
 			c.Fatalf("Could not restart daemon: %v", err)
161 161
 		}
162
-		if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
162
+		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
163 163
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
164 164
 		}
165
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
165
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
166 166
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
167 167
 		}
168 168
 	}()
... ...
@@ -177,7 +175,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) {
177 177
 		}
178 178
 	}
179 179
 
180
-	cmd := exec.Command("pgrep", "-f", "plugin-no-remove")
180
+	cmd := exec.Command("pgrep", "-f", pluginProcessName)
181 181
 	if out, ec, err := runCommandWithOutput(cmd); ec != 1 {
182 182
 		c.Fatalf("Expected exit code '1', got %d err: %v output: %s ", ec, err, out)
183 183
 	}
... ...
@@ -195,20 +193,20 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
195 195
 	if err := s.d.Start(); err != nil {
196 196
 		c.Fatalf("Could not start daemon: %v", err)
197 197
 	}
198
-	out, err := s.d.Cmd("plugin", "install", pluginName, "--grant-all-permissions")
198
+	out, err := s.d.Cmd("plugin", "install", pName, "--grant-all-permissions")
199 199
 	if err != nil {
200 200
 		c.Fatalf("Could not install plugin: %v %s", err, out)
201 201
 	}
202 202
 	defer func() {
203
-		if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
203
+		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
204 204
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
205 205
 		}
206
-		if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
206
+		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
207 207
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
208 208
 		}
209 209
 	}()
210 210
 
211
-	out, err = s.d.Cmd("volume", "create", "-d", pluginName, volName)
211
+	out, err = s.d.Cmd("volume", "create", "-d", pName, volName)
212 212
 	if err != nil {
213 213
 		c.Fatalf("Could not create volume: %v %s", err, out)
214 214
 	}
... ...
@@ -223,7 +221,7 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
223 223
 		c.Fatalf("Could not list volume: %v %s", err, out)
224 224
 	}
225 225
 	c.Assert(out, checker.Contains, volName)
226
-	c.Assert(out, checker.Contains, pluginName)
226
+	c.Assert(out, checker.Contains, pName)
227 227
 
228 228
 	mountPoint, err := s.d.Cmd("volume", "inspect", volName, "--format", "{{.Mountpoint}}")
229 229
 	if err != nil {
... ...
@@ -278,12 +278,11 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
278 278
 func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
279 279
 	testRequires(c, DaemonIsLinux)
280 280
 
281
-	pluginName := "tiborvass/no-remove:latest"
282 281
 	since := daemonUnixTime(c)
283 282
 
284
-	dockerCmd(c, "plugin", "install", pluginName, "--grant-all-permissions")
285
-	dockerCmd(c, "plugin", "disable", pluginName)
286
-	dockerCmd(c, "plugin", "remove", pluginName)
283
+	dockerCmd(c, "plugin", "install", pNameWithTag, "--grant-all-permissions")
284
+	dockerCmd(c, "plugin", "disable", pNameWithTag)
285
+	dockerCmd(c, "plugin", "remove", pNameWithTag)
287 286
 
288 287
 	out, _ := dockerCmd(c, "events", "--since", since, "--until", daemonUnixTime(c))
289 288
 	events := strings.Split(out, "\n")
... ...
@@ -292,7 +291,7 @@ func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
292 292
 	nEvents := len(events)
293 293
 	c.Assert(nEvents, checker.GreaterOrEqualThan, 4)
294 294
 
295
-	pluginEvents := eventActionsByIDAndType(c, events, pluginName, "plugin")
295
+	pluginEvents := eventActionsByIDAndType(c, events, pNameWithTag, "plugin")
296 296
 	c.Assert(pluginEvents, checker.HasLen, 4, check.Commentf("events: %v", events))
297 297
 
298 298
 	c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf(out))
... ...
@@ -772,7 +772,7 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) {
772 772
 	testRequires(c, DaemonIsLinux, Network, IsAmd64)
773 773
 
774 774
 	var (
775
-		npName        = "mavenugo/test-docker-netplugin"
775
+		npName        = "tiborvass/test-docker-netplugin"
776 776
 		npTag         = "latest"
777 777
 		npNameWithTag = npName + ":" + npTag
778 778
 	)
... ...
@@ -10,9 +10,10 @@ import (
10 10
 )
11 11
 
12 12
 var (
13
-	pName        = "tiborvass/no-remove"
14
-	pTag         = "latest"
15
-	pNameWithTag = pName + ":" + pTag
13
+	pluginProcessName = "no-remove"
14
+	pName             = "tiborvass/no-remove"
15
+	pTag              = "latest"
16
+	pNameWithTag      = pName + ":" + pTag
16 17
 )
17 18
 
18 19
 func (s *DockerSuite) TestPluginBasicOps(c *check.C) {