forked from openstack/rally
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Adds Nova floating IPs bulk tests"
- Loading branch information
Showing
13 changed files
with
308 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright 2015: Mirantis Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from rally.benchmark.scenarios import base | ||
from rally.benchmark.scenarios.nova import utils | ||
from rally.benchmark import validation | ||
from rally import consts | ||
|
||
|
||
class NovaFloatingIpsBulk(utils.NovaScenario): | ||
"""Benchmark scenarios for create nova floating IP by range.""" | ||
|
||
@validation.restricted_parameters("pool") | ||
@validation.required_parameters("start_cidr") | ||
@validation.required_services(consts.Service.NOVA) | ||
@validation.required_openstack(admin=True) | ||
@base.scenario(context={"admin_cleanup": ["nova"]}) | ||
def create_and_list_floating_ips_bulk(self, start_cidr, **kwargs): | ||
"""Create nova floating IP by range and list it. | ||
This scenario creates a floating IP by range and then lists all. | ||
:param start_cidr: Floating IP range | ||
:param kwargs: Optional additional arguments for range IP creation | ||
""" | ||
|
||
self._create_floating_ips_bulk(start_cidr, **kwargs) | ||
self._list_floating_ips_bulk() | ||
|
||
@validation.restricted_parameters("pool") | ||
@validation.required_parameters("start_cidr") | ||
@validation.required_services(consts.Service.NOVA) | ||
@validation.required_openstack(admin=True) | ||
@base.scenario(context={"admin_cleanup": ["nova"]}) | ||
def create_and_delete_floating_ips_bulk(self, start_cidr, **kwargs): | ||
"""Create nova floating IP by range and delete it. | ||
This scenario creates a floating IP by range and then delete it. | ||
:param start_cidr: Floating IP range | ||
:param kwargs: Optional additional arguments for range IP creation | ||
""" | ||
|
||
floating_ips_bulk = self._create_floating_ips_bulk(start_cidr, | ||
**kwargs) | ||
self._delete_floating_ips_bulk(floating_ips_bulk.ip_range) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
samples/tasks/scenarios/nova/create-and-delete-floating-ips-bulk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"NovaFloatingIpsBulk.create_and_delete_floating_ips_bulk": [ | ||
{ | ||
"args": { | ||
"start_cidr": "10.2.0.0/24" | ||
}, | ||
"runner": { | ||
"type": "constant", | ||
"times": 5, | ||
"concurrency": 2 | ||
}, | ||
"context": { | ||
"users": { | ||
"tenants": 3, | ||
"users_per_tenant": 2 | ||
} | ||
} | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
samples/tasks/scenarios/nova/create-and-delete-floating-ips-bulk.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
NovaFloatingIpsBulk.create_and_delete_floating_ips_bulk: | ||
- | ||
args: | ||
start_cidr: "10.2.0.0/24" | ||
runner: | ||
type: "constant" | ||
times: 5 | ||
concurrency: 2 | ||
context: | ||
users: | ||
tenants: 3 | ||
users_per_tenant: 2 |
20 changes: 20 additions & 0 deletions
20
samples/tasks/scenarios/nova/create-and-list-floating-ips-bulk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"NovaFloatingIpsBulk.create_and_list_floating_ips_bulk": [ | ||
{ | ||
"args": { | ||
"start_cidr": "10.2.0.0/24" | ||
}, | ||
"runner": { | ||
"type": "constant", | ||
"times": 5, | ||
"concurrency": 2 | ||
}, | ||
"context": { | ||
"users": { | ||
"tenants": 3, | ||
"users_per_tenant": 2 | ||
} | ||
} | ||
} | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
samples/tasks/scenarios/nova/create-and-list-floating-ips-bulk.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
NovaFloatingIpsBulk.create_and_list_floating_ips_bulk: | ||
- | ||
args: | ||
start_cidr: "10.2.0.0/24" | ||
runner: | ||
type: "constant" | ||
times: 5 | ||
concurrency: 2 | ||
context: | ||
users: | ||
tenants: 3 | ||
users_per_tenant: 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/unit/benchmark/scenarios/nova/test_floating_ips_bulk.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2015: Mirantis Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import mock | ||
|
||
from rally.benchmark.scenarios.nova import floating_ips_bulk | ||
from tests.unit import test | ||
|
||
|
||
class NovaFloatingIPsBulkTestCase(test.TestCase): | ||
|
||
def test_create_and_list_floating_ips_bulk(self): | ||
scenario = floating_ips_bulk.NovaFloatingIpsBulk() | ||
scenario._create_floating_ips_bulk = mock.MagicMock() | ||
scenario._list_floating_ips_bulk = mock.MagicMock() | ||
start_cidr = "10.2.0.0/24" | ||
scenario.create_and_list_floating_ips_bulk(start_cidr=start_cidr, | ||
fakearg="fakearg") | ||
|
||
scenario._create_floating_ips_bulk.assert_called_once_with( | ||
start_cidr, fakearg="fakearg") | ||
scenario._list_floating_ips_bulk.assert_called_once_with() | ||
|
||
def test_create_and_delete_floating_ips_bulk(self): | ||
scenario = floating_ips_bulk.NovaFloatingIpsBulk() | ||
fake_floating_ips_bulk = mock.MagicMock() | ||
fake_floating_ips_bulk.ip_range = "10.2.0.0/24" | ||
scenario._create_floating_ips_bulk = mock.MagicMock( | ||
return_value=fake_floating_ips_bulk) | ||
scenario._delete_floating_ips_bulk = mock.MagicMock() | ||
start_cidr = "10.2.0.0/24" | ||
scenario.create_and_delete_floating_ips_bulk(start_cidr=start_cidr, | ||
fakearg="fakearg") | ||
|
||
scenario._create_floating_ips_bulk.assert_called_once_with( | ||
start_cidr, fakearg="fakearg") | ||
scenario._delete_floating_ips_bulk.assert_called_once_with( | ||
fake_floating_ips_bulk.ip_range) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters