Merge "Add test and sample to CreateAndListNetworks"

This commit is contained in:
Jenkins 2016-10-31 12:42:54 +00:00 committed by Gerrit Code Review
commit 058ac8c268
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={