Add test and sample to CreateAndListNetworks

Create a network with type and then list all networks.
This type must be supported in your environment.

Change-Id: Id0f0aa6b7768f60d7686214a08e6d757bec6683e
This commit is contained in:
zhangzhang 2016-10-14 02:44:41 -04:00
parent 16e29e1368
commit d1f0123283
4 changed files with 86 additions and 10 deletions

View File

@ -5,7 +5,7 @@
NeutronNetworks.create_and_list_networks:
-
args:
network_create_args:
network_create_args: {}
runner:
type: "constant"
times: {{smoke or 40}}
@ -20,6 +20,26 @@
sla:
failure_rate:
max: 20
-
args:
network_create_args:
provider:network_type: "vxlan"
runner:
type: "constant"
times: {{smoke or 40}}
concurrency: {{smoke or 20}}
context:
users:
tenants: {{smoke or 3}}
users_per_tenant: {{smoke or 2}}
quotas:
neutron:
network: -1
roles:
- "admin"
sla:
failure_rate:
max: 20
NeutronNetworks.create_and_list_subnets:
-

View File

@ -19,6 +19,40 @@
"network": -1
}
}
},
"sla": {
"failure_rate": {
"max": 0
}
}
},
{
"args": {
"network_create_args": {
"provider:network_type": "vxlan"
}
},
"runner": {
"type": "constant",
"times": 100,
"concurrency": 10
},
"context": {
"users": {
"tenants": 3,
"users_per_tenant": 3
},
"quotas": {
"neutron": {
"network": -1
}
},
"roles": ["admin"]
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]

View File

@ -14,3 +14,26 @@
quotas:
neutron:
network: -1
sla:
failure_rate:
max: 0
-
args:
network_create_args:
provider:network_type: "vxlan"
runner:
type: "constant"
times: 100
concurrency: 10
context:
users:
tenants: 3
users_per_tenant: 3
quotas:
neutron:
network: -1
roles:
- "admin"
sla:
failure_rate:
max: 0

View File

@ -25,15 +25,20 @@ BASE = "rally.plugins.openstack.scenarios.neutron.network"
@ddt.ddt
class NeutronNetworksTestCase(test.ScenarioTestCase):
@ddt.data(
{"network_create_args": {}},
{"network_create_args": {"name": "given-name"}},
{"network_create_args": {"provider:network_type": "vxlan"}}
)
@ddt.unpack
@mock.patch("%s.CreateAndListNetworks._list_networks" % BASE)
@mock.patch("%s.CreateAndListNetworks._create_network" % BASE)
def test_create_and_list_networks(self,
mock__create_network,
mock__list_networks):
mock__list_networks,
network_create_args):
scenario = network.CreateAndListNetworks(self.context)
# Default options
network_create_args = {}
scenario.run(network_create_args=network_create_args)
mock__create_network.assert_called_once_with(network_create_args)
mock__list_networks.assert_called_once_with()
@ -41,12 +46,6 @@ class NeutronNetworksTestCase(test.ScenarioTestCase):
mock__create_network.reset_mock()
mock__list_networks.reset_mock()
# Explicit network name is specified
network_create_args = {"name": "given-name"}
scenario.run(network_create_args=network_create_args)
mock__create_network.assert_called_once_with(network_create_args)
mock__list_networks.assert_called_once_with()
@mock.patch("%s.CreateAndUpdateNetworks._update_network" % BASE)
@mock.patch("%s.CreateAndUpdateNetworks._create_network" % BASE,
return_value={