From 28461933e4bfd541bc763b0d384ef1f15342be67 Mon Sep 17 00:00:00 2001 From: Bulat Gaifullin Date: Fri, 15 Jul 2016 16:38:40 +0000 Subject: [PATCH] Revert "Remove 'nodes' key from serializer for 10.0" This reverts commit 80d7188700a699f0c3da763f5103e793b3c1d9c0. Change-Id: I71288ce79ab1f30bb291e77dde1217a26899c85d --- .../orchestrator/deployment_serializers.py | 21 ++++--------- .../test_orchestrator_serializer_100.py | 30 ------------------- .../test_orchestrator_serializer_90.py | 16 ++++++++++ .../test/unit/test_deployment_serializer.py | 2 +- 4 files changed, 22 insertions(+), 47 deletions(-) delete mode 100644 nailgun/nailgun/test/integration/test_orchestrator_serializer_100.py diff --git a/nailgun/nailgun/orchestrator/deployment_serializers.py b/nailgun/nailgun/orchestrator/deployment_serializers.py index 6ded98584f..782ba0c7df 100644 --- a/nailgun/nailgun/orchestrator/deployment_serializers.py +++ b/nailgun/nailgun/orchestrator/deployment_serializers.py @@ -539,6 +539,10 @@ class DeploymentHASerializer90(DeploymentHASerializer80): node_attrs['nova_hugepages_enabled'] = ( objects.NodeAttributes.is_nova_hugepages_enabled(node)) + # we don't need nodes in serialized data for 9.0 environments + # https://bugs.launchpad.net/fuel/+bug/1531128 + attrs.pop('nodes') + return attrs @classmethod @@ -635,18 +639,6 @@ class DeploymentHASerializer90(DeploymentHASerializer80): hugepages) -class DeploymentHASerializer10(DeploymentHASerializer90): - - def get_common_attrs(self, cluster): - attrs = super(DeploymentHASerializer10, self).get_common_attrs(cluster) - - # we don't need nodes in serialized data for 10.0 environments - # https://bugs.launchpad.net/fuel/+bug/1531128 - attrs.pop('nodes') - - return attrs - - class DeploymentLCMSerializer(DeploymentHASerializer90): _configs = None _priorities = { @@ -808,10 +800,7 @@ def get_serializer_for_cluster(cluster): }, '9.0': { 'ha': DeploymentHASerializer90, - }, - '10.0': { - 'ha': DeploymentHASerializer10, - }, + } } env_mode = 'ha' if cluster.is_ha_mode else 'multinode' diff --git a/nailgun/nailgun/test/integration/test_orchestrator_serializer_100.py b/nailgun/nailgun/test/integration/test_orchestrator_serializer_100.py deleted file mode 100644 index a3492614cb..0000000000 --- a/nailgun/nailgun/test/integration/test_orchestrator_serializer_100.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# 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 nailgun.test.integration import test_orchestrator_serializer_90 - - -class TestDeploymentHASerializer100( - test_orchestrator_serializer_90.TestDeploymentHASerializer90): - - env_version = 'newton-10.0' - - def test_remove_nodes_from_common_attrs(self): - cluster_db = self.env.clusters[0] - serializer = self.create_serializer(cluster_db) - - common_attrs = serializer.get_common_attrs(cluster_db) - self.assertNotIn('nodes', common_attrs) diff --git a/nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py b/nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py index b6f08e7e70..60cbadb83f 100644 --- a/nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py +++ b/nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py @@ -18,6 +18,7 @@ import mock import six from oslo_serialization import jsonutils +import unittest2 from nailgun import consts from nailgun import objects @@ -653,6 +654,13 @@ class TestDeploymentHASerializer90( for item in serialized: self.assertIn(item, cust_serialized) + def test_remove_nodes_from_common_attrs(self): + cluster_db = self.env.clusters[0] + serializer = self.create_serializer(cluster_db) + + common_attrs = serializer.get_common_attrs(cluster_db) + self.assertNotIn('nodes', common_attrs) + class TestDeploymentTasksSerialization90( TestSerializer90Mixin, @@ -721,6 +729,14 @@ class TestNetworkTemplateSerializer90CompatibleWith80( self.assertEqual(node_attrs['swift_zone'], node.uid) self.assertEqual(node_attrs['nova_cpu_pinning_enabled'], False) + @unittest2.skip( + "'nodes' key was removed from 9.0 version serializer output, " + "thus test bound to this data (that exists in parent test case class) " + "must be skipped" + ) + def test_network_not_mapped_to_nics_w_template(self): + pass + class TestNetworkTemplateSerializer90( TestSerializer90Mixin, diff --git a/nailgun/nailgun/test/unit/test_deployment_serializer.py b/nailgun/nailgun/test/unit/test_deployment_serializer.py index ab42e5d168..f39e622ff1 100644 --- a/nailgun/nailgun/test/unit/test_deployment_serializer.py +++ b/nailgun/nailgun/test/unit/test_deployment_serializer.py @@ -97,4 +97,4 @@ class TestGetSerializer(BaseUnitTest): cluster.release.environment_version = '9999.0' self.assertIs( ds.get_serializer_for_cluster(cluster), - ds.DeploymentHASerializer10) + ds.DeploymentHASerializer90)