Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
| ... | ... |
@@ -26,24 +26,6 @@ func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) {
|
| 26 | 26 |
} |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
-func (s *DockerSuite) TestAPINetworkCreateDelete(c *check.C) {
|
|
| 30 |
- testRequires(c, DaemonIsLinux) |
|
| 31 |
- // Create a network |
|
| 32 |
- name := "testnetwork" |
|
| 33 |
- config := types.NetworkCreateRequest{
|
|
| 34 |
- Name: name, |
|
| 35 |
- NetworkCreate: types.NetworkCreate{
|
|
| 36 |
- CheckDuplicate: true, |
|
| 37 |
- }, |
|
| 38 |
- } |
|
| 39 |
- id := createNetwork(c, config, http.StatusCreated) |
|
| 40 |
- c.Assert(isNetworkAvailable(c, name), checker.Equals, true) |
|
| 41 |
- |
|
| 42 |
- // delete the network and make sure it is deleted |
|
| 43 |
- deleteNetwork(c, id, true) |
|
| 44 |
- c.Assert(isNetworkAvailable(c, name), checker.Equals, false) |
|
| 45 |
-} |
|
| 46 |
- |
|
| 47 | 29 |
func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) {
|
| 48 | 30 |
testRequires(c, DaemonIsLinux) |
| 49 | 31 |
name := "testcheckduplicate" |
| ... | ... |
@@ -44,6 +44,24 @@ func createAmbiguousNetworks(t *testing.T) (string, string, string) {
|
| 44 | 44 |
return testNet, idPrefixNet, fullIDNet |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
+func TestNetworkCreateDelete(t *testing.T) {
|
|
| 48 |
+ skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
|
| 49 |
+ defer setupTest(t)() |
|
| 50 |
+ client := request.NewAPIClient(t) |
|
| 51 |
+ ctx := context.Background() |
|
| 52 |
+ |
|
| 53 |
+ netName := "testnetwork_" + t.Name() |
|
| 54 |
+ network.CreateNoError(t, ctx, client, netName, |
|
| 55 |
+ network.WithCheckDuplicate(), |
|
| 56 |
+ ) |
|
| 57 |
+ assert.Check(t, IsNetworkAvailable(client, netName)) |
|
| 58 |
+ |
|
| 59 |
+ // delete the network and make sure it is deleted |
|
| 60 |
+ err := client.NetworkRemove(ctx, netName) |
|
| 61 |
+ assert.NilError(t, err) |
|
| 62 |
+ assert.Check(t, IsNetworkNotAvailable(client, netName)) |
|
| 63 |
+} |
|
| 64 |
+ |
|
| 47 | 65 |
// TestDockerNetworkDeletePreferID tests that if a network with a name |
| 48 | 66 |
// equal to another network's ID exists, the Network with the given |
| 49 | 67 |
// ID is removed, and not the network with the given name. |