Merge pull request #37298 from adshmh/refactor-network-integration-tests-service-use-network-create

integration/service/network integration tests to use network package
Upstream-commit: 408d317c6008e3d81912a81c3ea96d3f606cf210
Component: engine
This commit is contained in:
Vincent Demeester
2018-06-27 11:43:04 +02:00
committed by GitHub
2 changed files with 13 additions and 6 deletions

View File

@ -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) {

View File

@ -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"
@ -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{
@ -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",
},