Merge "[Manila] Add scenario for attach of security service to share network"

This commit is contained in:
Jenkins 2015-07-16 06:20:41 +00:00 committed by Gerrit Code Review
commit 4762b2e845
7 changed files with 125 additions and 0 deletions

View File

@ -110,3 +110,24 @@
failure_rate:
max: 0
{% endfor %}
ManilaShares.attach_security_service_to_share_network:
{% for s in ("ldap", "kerberos", "active_directory") %}
-
args:
security_service_type: {{s}}
runner:
type: "constant"
times: 10
concurrency: 10
context:
users:
tenants: 1
users_per_tenant: 1
quotas:
manila:
share_networks: -1
sla:
failure_rate:
max: 0
{% endfor %}

View File

@ -166,3 +166,19 @@ class ManilaShares(utils.ManilaScenario):
description=description,
)
self._delete_security_service(security_service)
@validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["manila"]})
def attach_security_service_to_share_network(self,
security_service_type="ldap"):
"""Attaches security service to share network.
:param security_service_type: type of security service to use.
Should be one of following: 'ldap', 'kerberos' or
'active_directory'.
"""
sn = self._create_share_network()
ss = self._create_security_service(
security_service_type=security_service_type)
self._add_security_service_to_share_network(sn, ss)

View File

@ -218,3 +218,17 @@ class ManilaScenario(scenario.OpenStackScenario):
update_resource=utils.get_from_manager(),
timeout=CONF.benchmark.manila_share_delete_timeout,
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
@base.atomic_action_timer("manila.add_security_service_to_share_network")
def _add_security_service_to_share_network(self, share_network,
security_service):
"""Associate given security service with a share network.
:param share_network: ID or instance of :class:`ShareNetwork`.
:param security_service: ID or instance of :class:`SecurityService`.
:returns: instance of :class:`ShareNetwork`.
"""
share_network = self.clients(
"manila").share_networks.add_security_service(
share_network, security_service)
return share_network

View File

@ -0,0 +1,25 @@
{
"ManilaShares.attach_security_service_to_share_network": [
{
"args": {
"security_service_type": "active_directory"
},
"runner": {
"type": "constant",
"times": 10,
"concurrency": 10
},
"context": {
"users": {
"tenants": 1,
"users_per_tenant": 1
},
"quotas": {
"manila": {
"share_networks": -1
}
}
}
}
]
}

View File

@ -0,0 +1,16 @@
---
ManilaShares.attach_security_service_to_share_network:
-
args:
security_service_type: "active_directory"
runner:
type: "constant"
times: 10
concurrency: 10
context:
users:
tenants: 1
users_per_tenant: 1
quotas:
manila:
share_networks: -1

View File

@ -182,3 +182,21 @@ class ManilaSharesTestCase(test.TestCase):
scenario._create_security_service.assert_called_once_with(
**expected_params)
scenario._delete_security_service.assert_called_once_with(fake_ss)
@ddt.data("ldap", "kerberos", "active_directory")
def test_attach_security_service_to_share_network(self,
security_service_type):
scenario = shares.ManilaShares()
scenario._create_share_network = mock.MagicMock()
scenario._create_security_service = mock.MagicMock()
scenario._add_security_service_to_share_network = mock.MagicMock()
scenario.attach_security_service_to_share_network(
security_service_type=security_service_type)
scenario._create_share_network.assert_called_once_with()
scenario._create_security_service.assert_called_once_with(
security_service_type=security_service_type)
scenario._add_security_service_to_share_network.assert_has_calls([
mock.call(scenario._create_share_network.return_value,
scenario._create_security_service.return_value)])

View File

@ -185,3 +185,18 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
mock_get_from_manager.assert_called_once_with()
mock_wait_for_delete.assert_called_once_with(
fake_ss, update_resource=mock.ANY, timeout=180, check_interval=2)
def test__add_security_service_to_share_network(self):
fake_sn = mock.MagicMock()
fake_ss = mock.MagicMock()
result = self.scenario._add_security_service_to_share_network(
share_network=fake_sn, security_service=fake_ss)
self.assertEqual(
self.clients(
"manila").share_networks.add_security_service.return_value,
result)
self.clients(
"manila").share_networks.add_security_service.assert_has_calls([
mock.call(fake_sn, fake_ss)])