Skip to content

Commit

Permalink
refactored integration/service/network integration tests to use netwo…
Browse files Browse the repository at this point in the history
…rk package

Signed-off-by: Arash Deshmeh <[email protected]>
  • Loading branch information
adshmh committed Jun 26, 2018
1 parent 8e610b2 commit 8b07ec5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions integration/internal/network/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ func WithInternal() func(*types.NetworkCreate) {
}
}

// WithAttachable sets Attachable flag on the create network request
func WithAttachable() func(*types.NetworkCreate) {
return func(n *types.NetworkCreate) {
n.Attachable = true
}
}

// WithMacvlan sets the network as macvlan with the specified parent
func WithMacvlan(parent string) func(*types.NetworkCreate) {
return func(n *types.NetworkCreate) {
Expand Down
12 changes: 6 additions & 6 deletions integration/service/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/integration/internal/container"
net "github.com/docker/docker/integration/internal/network"
"github.com/docker/docker/integration/internal/swarm"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
Expand All @@ -21,11 +22,10 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
ctx := context.Background()

name := t.Name() + "test-alias"
_, err := client.NetworkCreate(ctx, name, types.NetworkCreate{
Driver: "overlay",
Attachable: true,
})
assert.NilError(t, err)
net.CreateNoError(t, ctx, client, name,
net.WithDriver("overlay"),
net.WithAttachable(),
)

cID1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
c.NetworkingConfig = &network.NetworkingConfig{
Expand All @@ -35,7 +35,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
}
})

err = client.NetworkConnect(ctx, name, cID1, &network.EndpointSettings{
err := client.NetworkConnect(ctx, name, cID1, &network.EndpointSettings{
Aliases: []string{
"aaa",
},
Expand Down

0 comments on commit 8b07ec5

Please sign in to comment.