From 79590fda366145a2d2b1eef0ac6313e2e05198f9 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Fri, 15 Jun 2018 16:06:45 -0400 Subject: [PATCH] migrate TestAPINetworkCreateDelete from integration-cli/ to integration/ Signed-off-by: Arash Deshmeh Upstream-commit: f5426214295cb59d54ece5a24d4720e31947981b Component: engine --- .../integration-cli/docker_api_network_test.go | 18 ------------------ .../engine/integration/network/delete_test.go | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/engine/integration-cli/docker_api_network_test.go b/components/engine/integration-cli/docker_api_network_test.go index 9c22cb7e3a..9ec2ba90e8 100644 --- a/components/engine/integration-cli/docker_api_network_test.go +++ b/components/engine/integration-cli/docker_api_network_test.go @@ -26,24 +26,6 @@ func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) { } } -func (s *DockerSuite) TestAPINetworkCreateDelete(c *check.C) { - testRequires(c, DaemonIsLinux) - // Create a network - name := "testnetwork" - config := types.NetworkCreateRequest{ - Name: name, - NetworkCreate: types.NetworkCreate{ - CheckDuplicate: true, - }, - } - id := createNetwork(c, config, http.StatusCreated) - c.Assert(isNetworkAvailable(c, name), checker.Equals, true) - - // delete the network and make sure it is deleted - deleteNetwork(c, id, true) - c.Assert(isNetworkAvailable(c, name), checker.Equals, false) -} - func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) { testRequires(c, DaemonIsLinux) name := "testcheckduplicate" diff --git a/components/engine/integration/network/delete_test.go b/components/engine/integration/network/delete_test.go index c2684ae247..c9099f4816 100644 --- a/components/engine/integration/network/delete_test.go +++ b/components/engine/integration/network/delete_test.go @@ -44,6 +44,24 @@ func createAmbiguousNetworks(t *testing.T) (string, string, string) { return testNet, idPrefixNet, fullIDNet } +func TestNetworkCreateDelete(t *testing.T) { + skip.If(t, testEnv.DaemonInfo.OSType != "linux") + defer setupTest(t)() + client := request.NewAPIClient(t) + ctx := context.Background() + + netName := "testnetwork_" + t.Name() + network.CreateNoError(t, ctx, client, netName, + network.WithCheckDuplicate(), + ) + assert.Check(t, IsNetworkAvailable(client, netName)) + + // delete the network and make sure it is deleted + err := client.NetworkRemove(ctx, netName) + assert.NilError(t, err) + assert.Check(t, IsNetworkNotAvailable(client, netName)) +} + // TestDockerNetworkDeletePreferID tests that if a network with a name // equal to another network's ID exists, the Network with the given // ID is removed, and not the network with the given name.