mirror of https://github.com/docker/cli.git
TestServiceUpdateResolveImageChanged: use subtests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
732d8b51a8
commit
fde22be3ea
|
@ -87,24 +87,26 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
for _, testcase := range testcases {
|
for _, tc := range testcases {
|
||||||
t.Logf("Testing image %q", testcase.image)
|
tc := tc
|
||||||
spec := map[string]swarm.ServiceSpec{
|
t.Run(tc.image, func(t *testing.T) {
|
||||||
"myservice": {
|
spec := map[string]swarm.ServiceSpec{
|
||||||
TaskTemplate: swarm.TaskSpec{
|
"myservice": {
|
||||||
ContainerSpec: &swarm.ContainerSpec{
|
TaskTemplate: swarm.TaskSpec{
|
||||||
Image: testcase.image,
|
ContainerSpec: &swarm.ContainerSpec{
|
||||||
|
Image: tc.image,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
err := deployServices(ctx, client, spec, namespace, false, ResolveImageChanged)
|
||||||
err := deployServices(ctx, client, spec, namespace, false, ResolveImageChanged)
|
assert.NilError(t, err)
|
||||||
assert.NilError(t, err)
|
assert.Check(t, is.Equal(receivedOptions.QueryRegistry, tc.expectedQueryRegistry))
|
||||||
assert.Check(t, is.Equal(receivedOptions.QueryRegistry, testcase.expectedQueryRegistry))
|
assert.Check(t, is.Equal(receivedService.TaskTemplate.ContainerSpec.Image, tc.expectedImage))
|
||||||
assert.Check(t, is.Equal(receivedService.TaskTemplate.ContainerSpec.Image, testcase.expectedImage))
|
assert.Check(t, is.Equal(receivedService.TaskTemplate.ForceUpdate, tc.expectedForceUpdate))
|
||||||
assert.Check(t, is.Equal(receivedService.TaskTemplate.ForceUpdate, testcase.expectedForceUpdate))
|
|
||||||
|
|
||||||
receivedService = swarm.ServiceSpec{}
|
receivedService = swarm.ServiceSpec{}
|
||||||
receivedOptions = types.ServiceUpdateOptions{}
|
receivedOptions = types.ServiceUpdateOptions{}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue