From 43151f4e44e64b8436bed234f2dcb60dfc643687 Mon Sep 17 00:00:00 2001 From: spisarski Date: Wed, 29 Nov 2017 13:11:20 -0700 Subject: Cluster template cleanup Removal of negative tests where an invalid keypair is being configured. This test was not operating consistently between pods Update testing documentation Updated some invalid class names in pydoc Change-Id: I7a392e9ed993450de40a20457044ba8294d45044 Signed-off-by: spisarski --- docs/how-to-use/APITests.rst | 4 ---- docs/how-to-use/IntegrationTests.rst | 3 --- snaps/config/cluster_template.py | 6 +++--- snaps/openstack/tests/cluster_template_tests.py | 21 +-------------------- snaps/openstack/utils/tests/magnum_utils_tests.py | 14 +------------- 5 files changed, 5 insertions(+), 43 deletions(-) diff --git a/docs/how-to-use/APITests.rst b/docs/how-to-use/APITests.rst index 86c855f..50cd437 100644 --- a/docs/how-to-use/APITests.rst +++ b/docs/how-to-use/APITests.rst @@ -562,10 +562,6 @@ magnum_utils_tests.py - MagnumUtilsTests | | | magnum_utils.create_cluster_template() will raise a | | | | BadRequest exception when the image does not exist | +---------------------------------------+---------------+-----------------------------------------------------------+ -| test_create_cluster_template_bad_kp | 1 | Ensures the function | -| | | magnum_utils.create_cluster_template() will raise a | -| | | NotFound exception when the keypair does not exist | -+---------------------------------------+---------------+-----------------------------------------------------------+ | test_create_cluster_template_bad_ext | 1 | Ensures the function | | _net | | magnum_utils.create_cluster_template() will raise a | | | | BadRequest exception when the external network does not | diff --git a/docs/how-to-use/IntegrationTests.rst b/docs/how-to-use/IntegrationTests.rst index 80c93d0..1856bb9 100644 --- a/docs/how-to-use/IntegrationTests.rst +++ b/docs/how-to-use/IntegrationTests.rst @@ -695,9 +695,6 @@ cluster_template_tests.py - CreateClusterTemplateTests | | | raise an exception when the image is invalid | +----------------------------------------+---------------+-----------------------------------------------------------+ | test_create_cluster_template_bad | 1 | Tests to ensure OpenStackClusterTemplate#create() will | -| _keypair | | raise an exception when the keypair is invalid | -+----------------------------------------+---------------+-----------------------------------------------------------+ -| test_create_cluster_template_bad | 1 | Tests to ensure OpenStackClusterTemplate#create() will | | _network_driver | | raise an exception when the network driver is invalid | +----------------------------------------+---------------+-----------------------------------------------------------+ | test_create_cluster_template_bad | 1 | Tests to ensure OpenStackClusterTemplate#create() will | diff --git a/snaps/config/cluster_template.py b/snaps/config/cluster_template.py index a9ef45c..0acf25a 100644 --- a/snaps/config/cluster_template.py +++ b/snaps/config/cluster_template.py @@ -255,7 +255,7 @@ def map_server_type(server_type): return None :param server_type: the server_type value to map :return: the ServerType enum object - :raise: ClusterTypeConfigError if value is invalid + :raise: ClusterTemplateConfigError if value is invalid """ if not server_type: return None @@ -275,7 +275,7 @@ def map_coe(coe): When None return None :param coe: the COE value to map :return: the ContainerOrchestrationEngine enum object - :raise: ClusterTypeConfigError if value is invalid + :raise: ClusterTemplateConfigError if value is invalid """ if not coe: return None @@ -294,7 +294,7 @@ def map_docker_storage_driver(driver): When None return None :param driver: the docker storage driver value to map :return: the DockerStorageDriver enum object - :raise: ClusterTypeConfigError if value is invalid + :raise: ClusterTemplateConfigError if value is invalid """ if not driver: return None diff --git a/snaps/openstack/tests/cluster_template_tests.py b/snaps/openstack/tests/cluster_template_tests.py index 791ace2..355467d 100644 --- a/snaps/openstack/tests/cluster_template_tests.py +++ b/snaps/openstack/tests/cluster_template_tests.py @@ -12,7 +12,7 @@ # 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 magnumclient.common.apiclient.exceptions import BadRequest, NotFound +from magnumclient.common.apiclient.exceptions import BadRequest from snaps.config.cluster_template import ClusterTemplateConfig from snaps.config.flavor import FlavorConfig @@ -241,25 +241,6 @@ class CreateClusterTemplateTests(OSIntegrationTestCase): with self.assertRaises(BadRequest): self.cluster_template_creator.create() - def test_create_cluster_template_bad_keypair(self): - """ - Tests the creation of an OpenStack cluster template raises an - exception with an invalid keypair. - """ - # Create ClusterTemplate - cluster_template_config = ClusterTemplateConfig( - name=self.cluster_type_name, - image=self.image_creator.image_settings.name, - keypair='foo', - external_net=self.ext_net_name, - flavor=self.flavor_creator.flavor_settings.name) - - self.cluster_template_creator = OpenStackClusterTemplate( - self.os_creds, cluster_template_config) - - with self.assertRaises(NotFound): - self.cluster_template_creator.create() - def test_create_cluster_template_bad_network_driver(self): """ Tests the creation of an OpenStack cluster template raises an diff --git a/snaps/openstack/utils/tests/magnum_utils_tests.py b/snaps/openstack/utils/tests/magnum_utils_tests.py index 766e3f2..f841c48 100644 --- a/snaps/openstack/utils/tests/magnum_utils_tests.py +++ b/snaps/openstack/utils/tests/magnum_utils_tests.py @@ -15,7 +15,7 @@ import logging import uuid -from magnumclient.common.apiclient.exceptions import BadRequest, NotFound +from magnumclient.common.apiclient.exceptions import BadRequest from snaps.config.cluster_template import ( ClusterTemplateConfig, ServerType, ContainerOrchestrationEngine, @@ -194,18 +194,6 @@ class MagnumUtilsClusterTypeTests(OSComponentTestCase): self.cluster_template = magnum_utils.create_cluster_template( self.magnum, config) - def test_create_cluster_template_bad_kp(self): - config = ClusterTemplateConfig( - name=self.cluster_type_name, - image=self.image_creator.image_settings.name, - keypair='foo', - external_net=self.ext_net_name, - flavor=self.flavor_creator.flavor_settings.name) - - with self.assertRaises(NotFound): - self.cluster_template = magnum_utils.create_cluster_template( - self.magnum, config) - def test_create_cluster_template_bad_ext_net(self): config = ClusterTemplateConfig( name=self.cluster_type_name, -- cgit 1.2.3-korg