Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
| ... | ... |
@@ -33,14 +33,33 @@ func (s *DockerSuite) TestApiNetworkCreateDelete(c *check.C) {
|
| 33 | 33 |
id := createNetwork(c, config, true) |
| 34 | 34 |
c.Assert(isNetworkAvailable(c, name), checker.Equals, true) |
| 35 | 35 |
|
| 36 |
- // POST another network with same name and CheckDuplicate must fail |
|
| 37 |
- createNetwork(c, config, false) |
|
| 38 |
- |
|
| 39 | 36 |
// delete the network and make sure it is deleted |
| 40 | 37 |
deleteNetwork(c, id, true) |
| 41 | 38 |
c.Assert(isNetworkAvailable(c, name), checker.Equals, false) |
| 42 | 39 |
} |
| 43 | 40 |
|
| 41 |
+func (s *DockerSuite) TestApiNetworkCreateCheckDuplicate(c *check.C) {
|
|
| 42 |
+ name := "testcheckduplicate" |
|
| 43 |
+ configOnCheck := types.NetworkCreate{
|
|
| 44 |
+ Name: name, |
|
| 45 |
+ CheckDuplicate: true, |
|
| 46 |
+ } |
|
| 47 |
+ configNotCheck := types.NetworkCreate{
|
|
| 48 |
+ Name: name, |
|
| 49 |
+ CheckDuplicate: false, |
|
| 50 |
+ } |
|
| 51 |
+ |
|
| 52 |
+ // Creating a new network first |
|
| 53 |
+ createNetwork(c, configOnCheck, true) |
|
| 54 |
+ c.Assert(isNetworkAvailable(c, name), checker.Equals, true) |
|
| 55 |
+ |
|
| 56 |
+ // Creating another network with same name and CheckDuplicate must fail |
|
| 57 |
+ createNetwork(c, configOnCheck, false) |
|
| 58 |
+ |
|
| 59 |
+ // Creating another network with same name and not CheckDuplicate must succeed |
|
| 60 |
+ createNetwork(c, configNotCheck, true) |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 44 | 63 |
func (s *DockerSuite) TestApiNetworkFilter(c *check.C) {
|
| 45 | 64 |
nr := getNetworkResource(c, getNetworkIDByName(c, "bridge")) |
| 46 | 65 |
c.Assert(nr.Name, checker.Equals, "bridge") |