integration/service/network integration tests to use network package
| ... | ... |
@@ -33,6 +33,13 @@ func WithInternal() func(*types.NetworkCreate) {
|
| 33 | 33 |
} |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
+// WithAttachable sets Attachable flag on the create network request |
|
| 37 |
+func WithAttachable() func(*types.NetworkCreate) {
|
|
| 38 |
+ return func(n *types.NetworkCreate) {
|
|
| 39 |
+ n.Attachable = true |
|
| 40 |
+ } |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 36 | 43 |
// WithMacvlan sets the network as macvlan with the specified parent |
| 37 | 44 |
func WithMacvlan(parent string) func(*types.NetworkCreate) {
|
| 38 | 45 |
return func(n *types.NetworkCreate) {
|
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/network" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
+ net "github.com/docker/docker/integration/internal/network" |
|
| 10 | 11 |
"github.com/docker/docker/integration/internal/swarm" |
| 11 | 12 |
"gotest.tools/assert" |
| 12 | 13 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -21,11 +22,10 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 21 | 21 |
ctx := context.Background() |
| 22 | 22 |
|
| 23 | 23 |
name := t.Name() + "test-alias" |
| 24 |
- _, err := client.NetworkCreate(ctx, name, types.NetworkCreate{
|
|
| 25 |
- Driver: "overlay", |
|
| 26 |
- Attachable: true, |
|
| 27 |
- }) |
|
| 28 |
- assert.NilError(t, err) |
|
| 24 |
+ net.CreateNoError(t, ctx, client, name, |
|
| 25 |
+ net.WithDriver("overlay"),
|
|
| 26 |
+ net.WithAttachable(), |
|
| 27 |
+ ) |
|
| 29 | 28 |
|
| 30 | 29 |
cID1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
| 31 | 30 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| ... | ... |
@@ -35,7 +35,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 35 | 35 |
} |
| 36 | 36 |
}) |
| 37 | 37 |
|
| 38 |
- err = client.NetworkConnect(ctx, name, cID1, &network.EndpointSettings{
|
|
| 38 |
+ err := client.NetworkConnect(ctx, name, cID1, &network.EndpointSettings{
|
|
| 39 | 39 |
Aliases: []string{
|
| 40 | 40 |
"aaa", |
| 41 | 41 |
}, |