@@ -70,7 +70,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
7070 }
7171
7272 p := & mockProgress {}
73- updaterTester := updaterTester {
73+ ut := updaterTester {
7474 t : t ,
7575 updater : & replicatedProgressUpdater {
7676 progressOut : p ,
@@ -82,7 +82,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
8282
8383 tasks := []swarm.Task {}
8484
85- updaterTester .testUpdater (tasks , false ,
85+ ut .testUpdater (tasks , false ,
8686 []progress.Progress {
8787 {ID : "overall progress" , Action : "0 out of 1 tasks" },
8888 {ID : "1/1" , Action : " " },
@@ -97,14 +97,14 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
9797 DesiredState : swarm .TaskStateShutdown ,
9898 Status : swarm.TaskStatus {State : swarm .TaskStateNew },
9999 })
100- updaterTester .testUpdater (tasks , false ,
100+ ut .testUpdater (tasks , false ,
101101 []progress.Progress {
102102 {ID : "overall progress" , Action : "0 out of 1 tasks" },
103103 })
104104
105105 // Task with valid DesiredState and State updates progress bar
106106 tasks [0 ].DesiredState = swarm .TaskStateRunning
107- updaterTester .testUpdater (tasks , false ,
107+ ut .testUpdater (tasks , false ,
108108 []progress.Progress {
109109 {ID : "1/1" , Action : "new " , Current : 1 , Total : 9 , HideCounts : true },
110110 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -113,7 +113,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
113113 // If the task exposes an error, we should show that instead of the
114114 // progress bar.
115115 tasks [0 ].Status .Err = "something is wrong"
116- updaterTester .testUpdater (tasks , false ,
116+ ut .testUpdater (tasks , false ,
117117 []progress.Progress {
118118 {ID : "1/1" , Action : "something is wrong" },
119119 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -122,7 +122,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
122122 // When the task reaches running, update should return true
123123 tasks [0 ].Status .Err = ""
124124 tasks [0 ].Status .State = swarm .TaskStateRunning
125- updaterTester .testUpdater (tasks , true ,
125+ ut .testUpdater (tasks , true ,
126126 []progress.Progress {
127127 {ID : "1/1" , Action : "running " , Current : 9 , Total : 9 , HideCounts : true },
128128 {ID : "overall progress" , Action : "1 out of 1 tasks" },
@@ -131,7 +131,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
131131 // If the task fails, update should return false again
132132 tasks [0 ].Status .Err = "task failed"
133133 tasks [0 ].Status .State = swarm .TaskStateFailed
134- updaterTester .testUpdater (tasks , false ,
134+ ut .testUpdater (tasks , false ,
135135 []progress.Progress {
136136 {ID : "1/1" , Action : "task failed" },
137137 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -147,7 +147,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
147147 DesiredState : swarm .TaskStateRunning ,
148148 Status : swarm.TaskStatus {State : swarm .TaskStateRunning },
149149 })
150- updaterTester .testUpdater (tasks , true ,
150+ ut .testUpdater (tasks , true ,
151151 []progress.Progress {
152152 {ID : "1/1" , Action : "running " , Current : 9 , Total : 9 , HideCounts : true },
153153 {ID : "overall progress" , Action : "1 out of 1 tasks" },
@@ -162,7 +162,7 @@ func TestReplicatedProgressUpdaterOneReplica(t *testing.T) {
162162 DesiredState : swarm .TaskStateRunning ,
163163 Status : swarm.TaskStatus {State : swarm .TaskStatePreparing },
164164 })
165- updaterTester .testUpdater (tasks , false ,
165+ ut .testUpdater (tasks , false ,
166166 []progress.Progress {
167167 {ID : "1/1" , Action : "preparing" , Current : 6 , Total : 9 , HideCounts : true },
168168 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -183,7 +183,7 @@ func TestReplicatedProgressUpdaterManyReplicas(t *testing.T) {
183183 }
184184
185185 p := & mockProgress {}
186- updaterTester := updaterTester {
186+ ut := updaterTester {
187187 t : t ,
188188 updater : & replicatedProgressUpdater {
189189 progressOut : p ,
@@ -196,7 +196,7 @@ func TestReplicatedProgressUpdaterManyReplicas(t *testing.T) {
196196 tasks := []swarm.Task {}
197197
198198 // No per-task progress bars because there are too many replicas
199- updaterTester .testUpdater (tasks , false ,
199+ ut .testUpdater (tasks , false ,
200200 []progress.Progress {
201201 {ID : "overall progress" , Action : fmt .Sprintf ("0 out of %d tasks" , replicas )},
202202 {ID : "overall progress" , Action : fmt .Sprintf ("0 out of %d tasks" , replicas )},
@@ -215,13 +215,13 @@ func TestReplicatedProgressUpdaterManyReplicas(t *testing.T) {
215215 if i % 2 == 1 {
216216 tasks [i ].NodeID = "b"
217217 }
218- updaterTester .testUpdater (tasks , false ,
218+ ut .testUpdater (tasks , false ,
219219 []progress.Progress {
220220 {ID : "overall progress" , Action : fmt .Sprintf ("%d out of %d tasks" , i , replicas )},
221221 })
222222
223223 tasks [i ].Status .State = swarm .TaskStateRunning
224- updaterTester .testUpdater (tasks , uint64 (i ) == replicas - 1 ,
224+ ut .testUpdater (tasks , uint64 (i ) == replicas - 1 ,
225225 []progress.Progress {
226226 {ID : "overall progress" , Action : fmt .Sprintf ("%d out of %d tasks" , i + 1 , replicas )},
227227 })
@@ -238,7 +238,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
238238 }
239239
240240 p := & mockProgress {}
241- updaterTester := updaterTester {
241+ ut := updaterTester {
242242 t : t ,
243243 updater : & globalProgressUpdater {
244244 progressOut : p ,
@@ -250,7 +250,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
250250
251251 tasks := []swarm.Task {}
252252
253- updaterTester .testUpdater (tasks , false ,
253+ ut .testUpdater (tasks , false ,
254254 []progress.Progress {
255255 {ID : "overall progress" , Action : "waiting for new tasks" },
256256 })
@@ -263,15 +263,15 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
263263 DesiredState : swarm .TaskStateShutdown ,
264264 Status : swarm.TaskStatus {State : swarm .TaskStateNew },
265265 })
266- updaterTester .testUpdater (tasks , false ,
266+ ut .testUpdater (tasks , false ,
267267 []progress.Progress {
268268 {ID : "overall progress" , Action : "0 out of 1 tasks" },
269269 {ID : "overall progress" , Action : "0 out of 1 tasks" },
270270 })
271271
272272 // Task with valid DesiredState and State updates progress bar
273273 tasks [0 ].DesiredState = swarm .TaskStateRunning
274- updaterTester .testUpdater (tasks , false ,
274+ ut .testUpdater (tasks , false ,
275275 []progress.Progress {
276276 {ID : "a" , Action : "new " , Current : 1 , Total : 9 , HideCounts : true },
277277 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -280,7 +280,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
280280 // If the task exposes an error, we should show that instead of the
281281 // progress bar.
282282 tasks [0 ].Status .Err = "something is wrong"
283- updaterTester .testUpdater (tasks , false ,
283+ ut .testUpdater (tasks , false ,
284284 []progress.Progress {
285285 {ID : "a" , Action : "something is wrong" },
286286 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -289,7 +289,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
289289 // When the task reaches running, update should return true
290290 tasks [0 ].Status .Err = ""
291291 tasks [0 ].Status .State = swarm .TaskStateRunning
292- updaterTester .testUpdater (tasks , true ,
292+ ut .testUpdater (tasks , true ,
293293 []progress.Progress {
294294 {ID : "a" , Action : "running " , Current : 9 , Total : 9 , HideCounts : true },
295295 {ID : "overall progress" , Action : "1 out of 1 tasks" },
@@ -298,7 +298,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
298298 // If the task fails, update should return false again
299299 tasks [0 ].Status .Err = "task failed"
300300 tasks [0 ].Status .State = swarm .TaskStateFailed
301- updaterTester .testUpdater (tasks , false ,
301+ ut .testUpdater (tasks , false ,
302302 []progress.Progress {
303303 {ID : "a" , Action : "task failed" },
304304 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -314,7 +314,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
314314 DesiredState : swarm .TaskStateRunning ,
315315 Status : swarm.TaskStatus {State : swarm .TaskStateRunning },
316316 })
317- updaterTester .testUpdater (tasks , true ,
317+ ut .testUpdater (tasks , true ,
318318 []progress.Progress {
319319 {ID : "a" , Action : "running " , Current : 9 , Total : 9 , HideCounts : true },
320320 {ID : "overall progress" , Action : "1 out of 1 tasks" },
@@ -329,7 +329,7 @@ func TestGlobalProgressUpdaterOneNode(t *testing.T) {
329329 DesiredState : swarm .TaskStateRunning ,
330330 Status : swarm.TaskStatus {State : swarm .TaskStatePreparing },
331331 })
332- updaterTester .testUpdater (tasks , false ,
332+ ut .testUpdater (tasks , false ,
333333 []progress.Progress {
334334 {ID : "a" , Action : "preparing" , Current : 6 , Total : 9 , HideCounts : true },
335335 {ID : "overall progress" , Action : "0 out of 1 tasks" },
@@ -348,7 +348,7 @@ func TestGlobalProgressUpdaterManyNodes(t *testing.T) {
348348 }
349349
350350 p := & mockProgress {}
351- updaterTester := updaterTester {
351+ ut := updaterTester {
352352 t : t ,
353353 updater : & globalProgressUpdater {
354354 progressOut : p ,
@@ -359,12 +359,12 @@ func TestGlobalProgressUpdaterManyNodes(t *testing.T) {
359359 }
360360
361361 for i := 0 ; i != nodes ; i ++ {
362- updaterTester .activeNodes [strconv .Itoa (i )] = struct {}{}
362+ ut .activeNodes [strconv .Itoa (i )] = struct {}{}
363363 }
364364
365365 tasks := []swarm.Task {}
366366
367- updaterTester .testUpdater (tasks , false ,
367+ ut .testUpdater (tasks , false ,
368368 []progress.Progress {
369369 {ID : "overall progress" , Action : "waiting for new tasks" },
370370 })
@@ -379,15 +379,15 @@ func TestGlobalProgressUpdaterManyNodes(t *testing.T) {
379379 })
380380 }
381381
382- updaterTester .testUpdater (tasks , false ,
382+ ut .testUpdater (tasks , false ,
383383 []progress.Progress {
384384 {ID : "overall progress" , Action : fmt .Sprintf ("0 out of %d tasks" , nodes )},
385385 {ID : "overall progress" , Action : fmt .Sprintf ("0 out of %d tasks" , nodes )},
386386 })
387387
388388 for i := 0 ; i != nodes ; i ++ {
389389 tasks [i ].Status .State = swarm .TaskStateRunning
390- updaterTester .testUpdater (tasks , i == nodes - 1 ,
390+ ut .testUpdater (tasks , i == nodes - 1 ,
391391 []progress.Progress {
392392 {ID : "overall progress" , Action : fmt .Sprintf ("%d out of %d tasks" , i + 1 , nodes )},
393393 })
0 commit comments