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

refactored integration/service/network integration tests to use network package

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
This commit is contained in:
Arash Deshmeh 2018-06-16 06:04:31 -04:00
parent 8e610b2b55
commit 8b07ec58ea
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",
},