<s> from nailgun import consts <EOL> from nailgun . task import helpers <EOL> from nailgun . test import base <EOL> class TestClusterRedeploymentScenario ( base . BaseTestCase ) : <EOL> def create_env ( self , nodes_kwargs ) : <EOL> return self . env . create ( <EOL> cluster_kwargs = { '<STR_LIT>' : consts . CLUSTER_MODES . multinode } , <EOL> release_kwargs = { '<STR_LIT:version>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ consts . CLUSTER_MODES . ha_compact , <EOL> consts . CLUSTER_MODES . multinode ] } , <EOL> nodes_kwargs = nodes_kwargs ) <EOL> def test_cluster_deployed_with_computes ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertEqual ( cluster . nodes , nodes ) <EOL> def test_cluster_deployed_with_cinder ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertEqual ( cluster . nodes , nodes ) <EOL> def test_ceph_osd_is_not_affected ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertNotEqual ( cluster . nodes , nodes ) <EOL> self . assertEqual ( len ( nodes ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . pending_roles , [ '<STR_LIT>' ] ) <EOL> def test_cinder_is_not_affected_when_add_compute ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertNotEqual ( cluster . nodes , nodes ) <EOL> self . assertEqual ( len ( nodes ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . pending_roles , [ '<STR_LIT>' ] ) <EOL> def test_controllers_redeployed_if_ceph_added ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertEqual ( len ( nodes ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( sorted ( cluster . nodes ) , sorted ( nodes ) ) <EOL> def test_controllers_not_redeployed_if_ceph_previously_in_cluster ( self ) : <EOL> cluster = self . create_env ( <EOL> nodes_kwargs = [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } ] ) <EOL> nodes = helpers . TaskHelper . nodes_to_deploy ( cluster ) <EOL> self . assertEqual ( len ( nodes ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . pending_roles , [ '<STR_LIT>' ] ) </s>
