refactor network inspect integration tests to use network package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
This commit is contained in:
parent
093424bec0
commit
dda4128c7e
|
@ -19,7 +19,7 @@ func WithIPv6() func(*types.NetworkCreate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithCheckDuplicate enables CheckDuplicate on the create network request
|
// WithCheckDuplicate sets the CheckDuplicate field on create network request
|
||||||
func WithCheckDuplicate() func(*types.NetworkCreate) {
|
func WithCheckDuplicate() func(*types.NetworkCreate) {
|
||||||
return func(n *types.NetworkCreate) {
|
return func(n *types.NetworkCreate) {
|
||||||
n.CheckDuplicate = true
|
n.CheckDuplicate = true
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
swarmtypes "github.com/docker/docker/api/types/swarm"
|
swarmtypes "github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
"github.com/docker/docker/integration/internal/network"
|
||||||
"github.com/docker/docker/integration/internal/swarm"
|
"github.com/docker/docker/integration/internal/swarm"
|
||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
"gotest.tools/poll"
|
"gotest.tools/poll"
|
||||||
|
@ -24,14 +25,10 @@ func TestInspectNetwork(t *testing.T) {
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
|
|
||||||
overlayName := "overlay1"
|
overlayName := "overlay1"
|
||||||
networkCreate := types.NetworkCreate{
|
overlayID := network.CreateNoError(t, context.Background(), client, overlayName,
|
||||||
CheckDuplicate: true,
|
network.WithDriver("overlay"),
|
||||||
Driver: "overlay",
|
network.WithCheckDuplicate(),
|
||||||
}
|
)
|
||||||
|
|
||||||
netResp, err := client.NetworkCreate(context.Background(), overlayName, networkCreate)
|
|
||||||
assert.NilError(t, err)
|
|
||||||
overlayID := netResp.ID
|
|
||||||
|
|
||||||
var instances uint64 = 4
|
var instances uint64 = 4
|
||||||
serviceName := "TestService" + t.Name()
|
serviceName := "TestService" + t.Name()
|
||||||
|
@ -44,7 +41,7 @@ func TestInspectNetwork(t *testing.T) {
|
||||||
|
|
||||||
poll.WaitOn(t, serviceRunningTasksCount(client, serviceID, instances), swarm.ServicePoll)
|
poll.WaitOn(t, serviceRunningTasksCount(client, serviceID, instances), swarm.ServicePoll)
|
||||||
|
|
||||||
_, _, err = client.ServiceInspectWithRaw(context.Background(), serviceID, types.ServiceInspectOptions{})
|
_, _, err := client.ServiceInspectWithRaw(context.Background(), serviceID, types.ServiceInspectOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// Test inspect verbose with full NetworkID
|
// Test inspect verbose with full NetworkID
|
||||||
|
|
Loading…
Reference in New Issue