From 9f0950869d9960bae949cbeae7e5fbfbe744c193 Mon Sep 17 00:00:00 2001 From: astaroverov Date: Thu, 20 Apr 2017 16:43:02 +0300 Subject: [PATCH] 'network-exists' validator removed Change-Id: Ifce72274c8675c06c1afcc362913ae54a658467f --- rally/plugins/openstack/validators.py | 16 ++++++++++ rally/task/validation.py | 17 ---------- .../unit/plugins/openstack/test_validators.py | 16 ++++++++++ tests/unit/task/test_validation.py | 32 +++++++++---------- 4 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 rally/plugins/openstack/validators.py create mode 100644 tests/unit/plugins/openstack/test_validators.py diff --git a/rally/plugins/openstack/validators.py b/rally/plugins/openstack/validators.py new file mode 100644 index 0000000000..99c8e2442e --- /dev/null +++ b/rally/plugins/openstack/validators.py @@ -0,0 +1,16 @@ +# Copyright 2017: 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. + +pass diff --git a/rally/task/validation.py b/rally/task/validation.py index 06c99f60b0..e4342b3d01 100755 --- a/rally/task/validation.py +++ b/rally/task/validation.py @@ -373,23 +373,6 @@ def image_valid_on_flavor(config, clients, deployment, flavor_name, return ValidationResult(False, message) -@validator -def network_exists(config, clients, deployment, network_name): - """Validator checks that network with network_name exist.""" - - network = config.get("args", {}).get(network_name, "private") - - networks = [net.label for net in - clients.nova().networks.list()] - if network not in networks: - message = _("Network with name %(network)s not found. " - "Available networks: %(networks)s") % { - "network": network, - "networks": networks - } - return ValidationResult(False, message) - - @validator def external_network_exists(config, clients, deployment, network_name): """Validator checks that external network with given name exists.""" diff --git a/tests/unit/plugins/openstack/test_validators.py b/tests/unit/plugins/openstack/test_validators.py new file mode 100644 index 0000000000..99c8e2442e --- /dev/null +++ b/tests/unit/plugins/openstack/test_validators.py @@ -0,0 +1,16 @@ +# Copyright 2017: 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. + +pass diff --git a/tests/unit/task/test_validation.py b/tests/unit/task/test_validation.py index 63d537f436..93a672912f 100755 --- a/tests/unit/task/test_validation.py +++ b/tests/unit/task/test_validation.py @@ -587,22 +587,22 @@ class ValidatorsTestCase(test.TestCase): result = validator(config, clients, None) self.assertFalse(result.is_valid, result.msg) - def test_network_exists(self): - validator = self._unwrap_validator(validation.network_exists, "net") - - net1 = mock.MagicMock() - net1.label = "private" - net2 = mock.MagicMock() - net2.label = "custom" - clients = mock.MagicMock() - clients.nova().networks.list.return_value = [net1, net2] - - result = validator({}, clients, None) - self.assertTrue(result.is_valid, result.msg) - result = validator({"args": {"net": "custom"}}, clients, None) - self.assertTrue(result.is_valid, result.msg) - result = validator({"args": {"net": "custom2"}}, clients, None) - self.assertFalse(result.is_valid, result.msg) + # def test_network_exists(self): + # validator = self._unwrap_validator(validation.network_exists, "net") + # + # net1 = mock.MagicMock() + # net1.label = "private" + # net2 = mock.MagicMock() + # net2.label = "custom" + # clients = mock.MagicMock() + # clients.nova().networks.list.return_value = [net1, net2] + # + # result = validator({}, clients, None) + # self.assertTrue(result.is_valid, result.msg) + # result = validator({"args": {"net": "custom"}}, clients, None) + # self.assertTrue(result.is_valid, result.msg) + # result = validator({"args": {"net": "custom2"}}, clients, None) + # self.assertFalse(result.is_valid, result.msg) def test_external_network_exists(self): validator = self._unwrap_validator(