mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add network create api test on CheckDuplicate
Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
This commit is contained in:
parent
6bf8844f11
commit
5649dae89b
1 changed files with 22 additions and 3 deletions
|
@ -33,14 +33,33 @@ func (s *DockerSuite) TestApiNetworkCreateDelete(c *check.C) {
|
||||||
id := createNetwork(c, config, true)
|
id := createNetwork(c, config, true)
|
||||||
c.Assert(isNetworkAvailable(c, name), checker.Equals, true)
|
c.Assert(isNetworkAvailable(c, name), checker.Equals, true)
|
||||||
|
|
||||||
// POST another network with same name and CheckDuplicate must fail
|
|
||||||
createNetwork(c, config, false)
|
|
||||||
|
|
||||||
// delete the network and make sure it is deleted
|
// delete the network and make sure it is deleted
|
||||||
deleteNetwork(c, id, true)
|
deleteNetwork(c, id, true)
|
||||||
c.Assert(isNetworkAvailable(c, name), checker.Equals, false)
|
c.Assert(isNetworkAvailable(c, name), checker.Equals, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DockerSuite) TestApiNetworkCreateCheckDuplicate(c *check.C) {
|
||||||
|
name := "testcheckduplicate"
|
||||||
|
configOnCheck := types.NetworkCreate{
|
||||||
|
Name: name,
|
||||||
|
CheckDuplicate: true,
|
||||||
|
}
|
||||||
|
configNotCheck := types.NetworkCreate{
|
||||||
|
Name: name,
|
||||||
|
CheckDuplicate: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating a new network first
|
||||||
|
createNetwork(c, configOnCheck, true)
|
||||||
|
c.Assert(isNetworkAvailable(c, name), checker.Equals, true)
|
||||||
|
|
||||||
|
// Creating another network with same name and CheckDuplicate must fail
|
||||||
|
createNetwork(c, configOnCheck, false)
|
||||||
|
|
||||||
|
// Creating another network with same name and not CheckDuplicate must succeed
|
||||||
|
createNetwork(c, configNotCheck, true)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestApiNetworkFilter(c *check.C) {
|
func (s *DockerSuite) TestApiNetworkFilter(c *check.C) {
|
||||||
nr := getNetworkResource(c, getNetworkIDByName(c, "bridge"))
|
nr := getNetworkResource(c, getNetworkIDByName(c, "bridge"))
|
||||||
c.Assert(nr.Name, checker.Equals, "bridge")
|
c.Assert(nr.Name, checker.Equals, "bridge")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue