Merge pull request #51574 from 2003Aditya/TestAPINetworkInspectWithScope

migrate TestAPINetworkInspectWithScope to integration test
This commit is contained in:
Rob Murray
2025-12-15 20:53:15 +00:00
committed by GitHub
2 changed files with 23 additions and 20 deletions

View File

@@ -18,7 +18,6 @@ import (
"github.com/cloudflare/cfssl/csr"
"github.com/cloudflare/cfssl/helpers"
"github.com/cloudflare/cfssl/initca"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/client"
@@ -1019,22 +1018,3 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *testing.T) {
currentTrustRoot = clusterTLSInfo.TrustRoot
}
}
func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) {
ctx := testutil.GetContext(c)
d := s.AddDaemon(ctx, c, true, true)
name := "test-scoped-network"
apiclient := d.NewClientT(c)
create, err := apiclient.NetworkCreate(ctx, name, client.NetworkCreateOptions{Driver: "overlay"})
assert.NilError(c, err)
inspect, err := apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
assert.NilError(c, err)
assert.Check(c, is.Equal("swarm", inspect.Network.Scope))
assert.Check(c, is.Equal(create.ID, inspect.Network.ID))
_, err = apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{Scope: "local"})
assert.Check(c, is.ErrorType(err, cerrdefs.IsNotFound))
}