1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Move defer method to the top right after New is called

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
(cherry picked from commit a65dee30fc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Arko Dasgupta 2019-08-15 14:09:47 -07:00 committed by Sebastiaan van Stijn
parent a24fddc2ad
commit 218af8c7bd
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -353,6 +353,7 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
// Clean up , set it back to original one to make sure other tests don't fail
// call without datapath port option.
d = swarm.NewSwarm(t, testEnv)
defer d.Stop(t)
nc := d.NewClientT(t)
defer nc.Close()
// Create a overlay network
@ -373,14 +374,12 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
assert.Equal(t, info.Swarm.Cluster.DataPathPort, defaultDataPathPort)
err = nc.ServiceRemove(ctx, serviceID)
assert.NilError(t, err)
assert.NilError(t, err)
poll.WaitOn(t, noServices(ctx, nc), swarm.ServicePoll)
poll.WaitOn(t, swarm.NoTasks(ctx, nc), swarm.ServicePoll)
err = nc.NetworkRemove(ctx, overlayID)
assert.NilError(t, err)
err = d.SwarmLeave(t, true)
assert.NilError(t, err)
defer d.Stop(t)
}
func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
@ -389,7 +388,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
d := swarm.NewSwarm(t, testEnv,
daemon.WithSwarmDefaultAddrPool([]string{"20.20.0.0/16"}),
daemon.WithSwarmDefaultAddrPoolSubnetSize(24))
defer d.Stop(t)
cli := d.NewClientT(t)
defer cli.Close()
ctx := context.Background()
@ -428,6 +427,5 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
assert.NilError(t, err)
err = d.SwarmLeave(t, true)
assert.NilError(t, err)
defer d.Stop(t)
}