refactor network inspect integration tests to use network package
| ... | ... |
@@ -19,7 +19,7 @@ func WithIPv6() func(*types.NetworkCreate) {
|
| 19 | 19 |
} |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// WithCheckDuplicate enables CheckDuplicate on the create network request |
|
| 22 |
+// WithCheckDuplicate sets the CheckDuplicate field on create network request |
|
| 23 | 23 |
func WithCheckDuplicate() func(*types.NetworkCreate) {
|
| 24 | 24 |
return func(n *types.NetworkCreate) {
|
| 25 | 25 |
n.CheckDuplicate = true |
| ... | ... |
@@ -9,6 +9,7 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types/filters" |
| 10 | 10 |
swarmtypes "github.com/docker/docker/api/types/swarm" |
| 11 | 11 |
"github.com/docker/docker/client" |
| 12 |
+ "github.com/docker/docker/integration/internal/network" |
|
| 12 | 13 |
"github.com/docker/docker/integration/internal/swarm" |
| 13 | 14 |
"gotest.tools/assert" |
| 14 | 15 |
"gotest.tools/poll" |
| ... | ... |
@@ -24,14 +25,10 @@ func TestInspectNetwork(t *testing.T) {
|
| 24 | 24 |
defer client.Close() |
| 25 | 25 |
|
| 26 | 26 |
overlayName := "overlay1" |
| 27 |
- networkCreate := types.NetworkCreate{
|
|
| 28 |
- CheckDuplicate: true, |
|
| 29 |
- Driver: "overlay", |
|
| 30 |
- } |
|
| 31 |
- |
|
| 32 |
- netResp, err := client.NetworkCreate(context.Background(), overlayName, networkCreate) |
|
| 33 |
- assert.NilError(t, err) |
|
| 34 |
- overlayID := netResp.ID |
|
| 27 |
+ overlayID := network.CreateNoError(t, context.Background(), client, overlayName, |
|
| 28 |
+ network.WithDriver("overlay"),
|
|
| 29 |
+ network.WithCheckDuplicate(), |
|
| 30 |
+ ) |
|
| 35 | 31 |
|
| 36 | 32 |
var instances uint64 = 4 |
| 37 | 33 |
serviceName := "TestService" + t.Name() |
| ... | ... |
@@ -44,7 +41,7 @@ func TestInspectNetwork(t *testing.T) {
|
| 44 | 44 |
|
| 45 | 45 |
poll.WaitOn(t, serviceRunningTasksCount(client, serviceID, instances), swarm.ServicePoll) |
| 46 | 46 |
|
| 47 |
- _, _, err = client.ServiceInspectWithRaw(context.Background(), serviceID, types.ServiceInspectOptions{})
|
|
| 47 |
+ _, _, err := client.ServiceInspectWithRaw(context.Background(), serviceID, types.ServiceInspectOptions{})
|
|
| 48 | 48 |
assert.NilError(t, err) |
| 49 | 49 |
|
| 50 | 50 |
// Test inspect verbose with full NetworkID |