<s> import mock <EOL> import pkg_resources as pkg <EOL> from sahara . conductor import resource as rsc <EOL> from sahara . plugins import exceptions as ex <EOL> from sahara . plugins . hdp import clusterspec as cs <EOL> from sahara . plugins . hdp . versions . version_2_0_6 import services as s2 <EOL> from sahara . plugins import provisioning <EOL> from sahara . tests . unit import base as sahara_base <EOL> import sahara . tests . unit . plugins . hdp . hdp_test_base as base <EOL> from sahara . topology import topology_helper as th <EOL> from sahara import version <EOL> class TestCONF ( object ) : <EOL> def __init__ ( self , enable_data_locality , enable_hypervisor_awareness ) : <EOL> self . enable_data_locality = enable_data_locality <EOL> self . enable_hypervisor_awareness = enable_hypervisor_awareness <EOL> @ mock . patch ( "<STR_LIT>" , <EOL> base . get_instance_info ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> return_value = [ ] ) <EOL> class ClusterSpecTestForHDP2 ( sahara_base . SaharaTestCase ) : <EOL> service_validators = { } <EOL> def setUp ( self ) : <EOL> super ( ClusterSpecTestForHDP2 , self ) . setUp ( ) <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_yarn <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_hdfs <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_mrv2 <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_ganglia <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_nagios <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_ambari <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_pig <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_hive <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_hcatalog <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_zookeeper <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_webhcat <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_oozie <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_sqoop <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_hbase <EOL> self . service_validators [ '<STR_LIT>' ] = self . _assert_hue <EOL> def test_parse_default_with_cluster ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( '<STR_LIT>' , [ server2 ] , [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . _assert_services ( cluster_config . services ) <EOL> self . _assert_configurations ( cluster_config . configurations ) <EOL> node_groups = cluster_config . node_groups <EOL> self . assertEqual ( <NUM_LIT:2> , len ( node_groups ) ) <EOL> self . assertIn ( '<STR_LIT>' , node_groups ) <EOL> self . assertIn ( '<STR_LIT>' , node_groups ) <EOL> master_node_group = node_groups [ '<STR_LIT>' ] <EOL> self . assertEqual ( '<STR_LIT>' , master_node_group . name ) <EOL> self . assertEqual ( <NUM_LIT> , len ( master_node_group . components ) ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> slave_node_group = node_groups [ '<STR_LIT>' ] <EOL> self . assertEqual ( '<STR_LIT>' , slave_node_group . name ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> return cluster_config <EOL> def test_determine_component_hosts ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> server3 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server3 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> hosts = cluster_config . determine_component_hosts ( '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( hosts ) ) <EOL> self . assertEqual ( '<STR_LIT>' , hosts . pop ( ) . fqdn ( ) ) <EOL> hosts = cluster_config . determine_component_hosts ( '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( hosts ) ) <EOL> datanodes = set ( [ server2 . fqdn ( ) , server3 . fqdn ( ) ] ) <EOL> host_fqdn = set ( [ hosts . pop ( ) . fqdn ( ) , hosts . pop ( ) . fqdn ( ) ] ) <EOL> self . assertEqual ( datanodes , host_fqdn & datanodes ) <EOL> def test_finalize_configuration ( self , patched ) : <EOL> patched . return_value = [ { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : '<STR_LIT>' } , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : '<STR_LIT>' } ] <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> master_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> jt_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> nn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> snn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_ms_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_mysql_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hcat_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> zk1_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> zk2_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> oozie_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> slave_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> master_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ master_host ] , [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> jt_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ jt_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> nn_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ nn_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> snn_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ snn_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_ms_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_ms_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_mysql_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_mysql_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hcat_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hcat_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> zk1_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ zk1_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> zk2_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ zk2_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> oozie_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ oozie_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> slave_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ slave_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> user_input_config = TestUserInputConfig ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( <EOL> user_input_config , '<STR_LIT>' ) <EOL> cluster = base . TestCluster ( [ master_ng , jt_ng , nn_ng , snn_ng , hive_ng , <EOL> hive_ms_ng , hive_mysql_ng , <EOL> hcat_ng , zk1_ng , zk2_ng , oozie_ng , <EOL> slave_ng ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> config = cluster_config . configurations <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( <EOL> '<STR_LIT>' in <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> set ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> set ( config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> def test_finalize_configuration_with_hue ( self , patched ) : <EOL> patched . return_value = [ { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : '<STR_LIT>' } , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : '<STR_LIT>' } ] <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> master_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> jt_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> nn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> snn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_ms_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hive_mysql_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> hcat_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> zk1_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> zk2_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> oozie_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> slave_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> master_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ master_host ] , [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> jt_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ jt_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> nn_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ nn_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> snn_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ snn_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_ms_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_ms_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hive_mysql_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hive_mysql_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> hcat_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ hcat_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> zk1_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ zk1_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> zk2_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ zk2_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> oozie_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ oozie_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> slave_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ slave_host ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> user_input_config = TestUserInputConfig ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( <EOL> user_input_config , '<STR_LIT>' ) <EOL> cluster = base . TestCluster ( [ master_ng , jt_ng , nn_ng , snn_ng , hive_ng , <EOL> hive_ms_ng , hive_mysql_ng , <EOL> hcat_ng , zk1_ng , zk2_ng , oozie_ng , <EOL> slave_ng ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> config = cluster_config . configurations <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:true>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:true>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( <EOL> '<STR_LIT>' in <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> set ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> set ( config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) ) ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' <EOL> '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:*>' , <EOL> config [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' <EOL> '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> def test__determine_deployed_services ( self , nova_mock ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> master_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> jt_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> nn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> snn_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> slave_host = base . TestServer ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> master_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ master_host ] , <EOL> [ '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> jt_ng = TestNodeGroup ( '<STR_LIT>' , [ jt_host ] , [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> nn_ng = TestNodeGroup ( '<STR_LIT>' , [ nn_host ] , [ "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> snn_ng = TestNodeGroup ( '<STR_LIT>' , [ snn_host ] , [ "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> slave_ng = TestNodeGroup ( <EOL> '<STR_LIT>' , [ slave_host ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ master_ng , jt_ng , nn_ng , <EOL> snn_ng , slave_ng ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> services = cluster_config . services <EOL> for service in services : <EOL> if service . name in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . assertTrue ( service . deployed ) <EOL> else : <EOL> self . assertFalse ( service . deployed ) <EOL> def test_ambari_rpm_path ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> cluster_spec = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> ambari_config = cluster_spec . configurations [ '<STR_LIT>' ] <EOL> rpm = ambari_config . get ( '<STR_LIT>' , None ) <EOL> self . assertEqual ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , rpm ) <EOL> def test_fs_umask ( self , patched ) : <EOL> s_conf = s2 . CONF <EOL> try : <EOL> s2 . CONF = TestCONF ( False , False ) <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> finally : <EOL> s2 . CONF = s_conf <EOL> def test_parse_default ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> self . _assert_services ( cluster_config . services ) <EOL> self . _assert_configurations ( cluster_config . configurations ) <EOL> node_groups = cluster_config . node_groups <EOL> self . assertEqual ( <NUM_LIT:2> , len ( node_groups ) ) <EOL> master_node_group = node_groups [ '<STR_LIT>' ] <EOL> self . assertEqual ( '<STR_LIT>' , master_node_group . name ) <EOL> self . assertIsNone ( master_node_group . predicate ) <EOL> self . assertEqual ( '<STR_LIT:1>' , master_node_group . cardinality ) <EOL> self . assertEqual ( <NUM_LIT:8> , len ( master_node_group . components ) ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , master_node_group . components ) <EOL> slave_node_group = node_groups [ '<STR_LIT>' ] <EOL> self . assertEqual ( '<STR_LIT>' , slave_node_group . name ) <EOL> self . assertIsNone ( slave_node_group . predicate ) <EOL> self . assertEqual ( '<STR_LIT>' , slave_node_group . cardinality ) <EOL> self . assertEqual ( <NUM_LIT:5> , len ( slave_node_group . components ) ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> self . assertIn ( '<STR_LIT>' , slave_node_group . components ) <EOL> return cluster_config <EOL> def test_ambari_rpm ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> self . _assert_configurations ( cluster_config . configurations ) <EOL> ambari_config = cluster_config . configurations [ '<STR_LIT>' ] <EOL> self . assertIsNotNone ( '<STR_LIT>' , <EOL> ambari_config . get ( '<STR_LIT>' , None ) ) <EOL> def test_normalize ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster = cluster_config . normalize ( ) <EOL> configs = cluster . cluster_configs <EOL> contains_dfs_datanode_http_address = False <EOL> contains_staging_dir = False <EOL> contains_mapred_user = False <EOL> for entry in configs : <EOL> config = entry . config <EOL> if config . name == '<STR_LIT>' : <EOL> contains_dfs_datanode_http_address = True <EOL> self . assertEqual ( '<STR_LIT:string>' , config . type ) <EOL> self . assertEqual ( '<STR_LIT>' , config . default_value ) <EOL> self . assertEqual ( '<STR_LIT>' , config . applicable_target ) <EOL> if config . name == '<STR_LIT>' : <EOL> contains_staging_dir = True <EOL> self . assertEqual ( '<STR_LIT:string>' , config . type ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> config . default_value ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> config . applicable_target ) <EOL> if config . name == '<STR_LIT>' : <EOL> contains_mapred_user = True <EOL> self . assertEqual ( '<STR_LIT:string>' , config . type ) <EOL> self . assertEqual ( '<STR_LIT>' , config . default_value ) <EOL> self . assertEqual ( '<STR_LIT>' , config . applicable_target ) <EOL> self . assertTrue ( contains_dfs_datanode_http_address ) <EOL> self . assertTrue ( contains_staging_dir ) <EOL> self . assertTrue ( contains_mapred_user ) <EOL> node_groups = cluster . node_groups <EOL> self . assertEqual ( <NUM_LIT:2> , len ( node_groups ) ) <EOL> contains_master_group = False <EOL> contains_slave_group = False <EOL> for i in range ( <NUM_LIT:2> ) : <EOL> node_group = node_groups [ i ] <EOL> components = node_group . node_processes <EOL> if node_group . name == "<STR_LIT>" : <EOL> contains_master_group = True <EOL> self . assertEqual ( <NUM_LIT:8> , len ( components ) ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> elif node_group . name == '<STR_LIT>' : <EOL> contains_slave_group = True <EOL> self . assertEqual ( <NUM_LIT:5> , len ( components ) ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> self . assertIn ( '<STR_LIT>' , components ) <EOL> else : <EOL> self . fail ( '<STR_LIT>' . format ( node_group . name ) ) <EOL> self . assertTrue ( contains_master_group ) <EOL> self . assertTrue ( contains_slave_group ) <EOL> def test_existing_config_item_in_top_level_within_blueprint ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> user_input_config = TestUserInputConfig ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( user_input_config , <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> self . assertEqual ( '<STR_LIT>' , cluster_config . configurations <EOL> [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> def test_new_config_item_in_top_level_within_blueprint ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> user_input_config = TestUserInputConfig ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( user_input_config , '<STR_LIT:foo>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT:foo>' , cluster_config . configurations [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> def test_topology_configuration_no_hypervisor ( self , patched ) : <EOL> s_conf = s2 . CONF <EOL> th_conf = th . CONF <EOL> try : <EOL> s2 . CONF = TestCONF ( True , False ) <EOL> th . CONF = TestCONF ( True , False ) <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , <EOL> version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT:true>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT:true>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT:true>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT:3>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> finally : <EOL> s2 . CONF = s_conf <EOL> th . CONF = th_conf <EOL> def test_topology_configuration_with_hypervisor ( self , patched ) : <EOL> s_conf = s2 . CONF <EOL> try : <EOL> s2 . CONF = TestCONF ( True , True ) <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , <EOL> version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . assertEqual ( <EOL> '<STR_LIT>' , <EOL> cluster_config . configurations [ '<STR_LIT>' ] <EOL> [ '<STR_LIT>' ] ) <EOL> finally : <EOL> s2 . CONF = s_conf <EOL> def test_update_ambari_admin_user ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> user_input_config = TestUserInputConfig ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( user_input_config , '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , <EOL> [ server1 ] , <EOL> [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , <EOL> [ server2 ] , <EOL> [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> ambari_service = next ( service for service in cluster_config . services <EOL> if service . name == '<STR_LIT>' ) <EOL> users = ambari_service . users <EOL> self . assertEqual ( <NUM_LIT:1> , len ( users ) ) <EOL> self . assertEqual ( '<STR_LIT>' , users [ <NUM_LIT:0> ] . name ) <EOL> def test_update_ambari_admin_password ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> user_input_config = TestUserInputConfig ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> user_input = provisioning . UserInput ( user_input_config , '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , <EOL> [ server1 ] , <EOL> [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , <EOL> [ server2 ] , <EOL> [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ user_input ] ) <EOL> ambari_service = next ( service for service in cluster_config . services <EOL> if service . name == '<STR_LIT>' ) <EOL> users = ambari_service . users <EOL> self . assertEqual ( <NUM_LIT:1> , len ( users ) ) <EOL> self . assertEqual ( '<STR_LIT>' , users [ <NUM_LIT:0> ] . password ) <EOL> def test_update_ambari_admin_user_and_password ( self , patched ) : <EOL> cluster_config_file = pkg . resource_string ( <EOL> version . version_info . package , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> user_user_input_config = TestUserInputConfig ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> pwd_user_input_config = TestUserInputConfig ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> user_user_input = provisioning . UserInput ( user_user_input_config , <EOL> '<STR_LIT>' ) <EOL> pwd_user_input = provisioning . UserInput ( pwd_user_input_config , <EOL> '<STR_LIT>' ) <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group1 , node_group2 ] ) <EOL> cluster_config = cs . ClusterSpec ( cluster_config_file , version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( <EOL> cluster , [ user_user_input , pwd_user_input ] ) <EOL> ambari_service = next ( service for service in cluster_config . services <EOL> if service . name == '<STR_LIT>' ) <EOL> users = ambari_service . users <EOL> self . assertEqual ( <NUM_LIT:1> , len ( users ) ) <EOL> self . assertEqual ( '<STR_LIT>' , users [ <NUM_LIT:0> ] . name ) <EOL> self . assertEqual ( '<STR_LIT>' , users [ <NUM_LIT:0> ] . password ) <EOL> def test_validate_missing_hdfs ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . RequiredServiceMissingException : <EOL> pass <EOL> def test_validate_missing_mr2 ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . RequiredServiceMissingException : <EOL> pass <EOL> def test_validate_missing_ambari ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . RequiredServiceMissingException : <EOL> pass <EOL> def test_validate_hdfs ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_hdfs_ha ( self , patched ) : <EOL> server1 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server3 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group1 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server1 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server3 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> cc = { '<STR_LIT>' : { '<STR_LIT>' : True } } <EOL> cc_r = rsc . Resource ( cc ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> self . assertRaises ( ex . NameNodeHAConfigurationError , <EOL> cluster_config . create_operational_config , <EOL> cluster1 , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> self . assertRaises ( ex . NameNodeHAConfigurationError , <EOL> cluster_config . create_operational_config , <EOL> cluster1 , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> self . assertRaises ( ex . NameNodeHAConfigurationError , <EOL> cluster_config . create_operational_config , <EOL> cluster1 , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> cluster_config . create_operational_config ( cluster1 , [ ] ) <EOL> cc = { '<STR_LIT>' : { '<STR_LIT>' : False } } <EOL> cc_r = rsc . Resource ( cc ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> self . assertRaises ( ex . NameNodeHAConfigurationError , <EOL> cluster_config . create_operational_config , <EOL> cluster1 , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> cluster1 = base . TestCluster ( [ node_group1 , node_group2 , node_group3 ] , <EOL> cc_r ) <EOL> self . assertRaises ( ex . NameNodeHAConfigurationError , <EOL> cluster_config . create_operational_config , <EOL> cluster1 , [ ] ) <EOL> def test_validate_yarn ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_hive ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_zk ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server3 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server3 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> def test_validate_oozie ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_ganglia ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_ambari ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> try : <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_validate_hue ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> self . assertRaises ( ex . RequiredServiceMissingException , <EOL> cluster_config . create_operational_config , <EOL> cluster , [ ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> self . assertRaises ( ex . RequiredServiceMissingException , <EOL> cluster_config . create_operational_config , <EOL> cluster , [ ] ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> self . assertRaises ( ex . RequiredServiceMissingException , <EOL> cluster_config . create_operational_config , <EOL> cluster , [ ] ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> hue_ngs = cluster_config . get_node_groups_containing_component ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( hue_ngs ) ) <EOL> self . assertIn ( "<STR_LIT>" , hue_ngs . pop ( ) . components ) <EOL> node_group3 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 , node_group3 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> self . assertRaises ( ex . InvalidComponentCountException , <EOL> cluster_config . create_operational_config , <EOL> cluster , [ ] ) <EOL> def test_validate_scaling_existing_ng ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> scaled_groups = { '<STR_LIT>' : <NUM_LIT:2> } <EOL> try : <EOL> cluster_config . create_operational_config ( <EOL> cluster , [ ] , scaled_groups ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except ex . InvalidComponentCountException : <EOL> pass <EOL> def test_scale ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> slave_ng = cluster_config . node_groups [ '<STR_LIT>' ] <EOL> self . assertEqual ( <NUM_LIT:1> , slave_ng . count ) <EOL> cluster_config . scale ( { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> self . assertEqual ( <NUM_LIT:2> , slave_ng . count ) <EOL> def test_get_deployed_configurations ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> node_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> node_group2 = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ node_group , node_group2 ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> configs = cluster_config . get_deployed_configurations ( ) <EOL> expected_configs = set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEqual ( expected_configs , expected_configs & configs ) <EOL> def test_get_deployed_node_group_count ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> slave_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> slave2_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> master_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ master_group , slave_group , slave2_group ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> self . assertEqual ( <NUM_LIT:2> , cluster_config . get_deployed_node_group_count ( <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( <NUM_LIT:1> , cluster_config . get_deployed_node_group_count ( <EOL> '<STR_LIT>' ) ) <EOL> def test_get_node_groups_containing_component ( self , patched ) : <EOL> server = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> server2 = base . TestServer ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:3> , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> slave_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> slave2_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server ] , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> master_group = TestNodeGroup ( <EOL> '<STR_LIT>' , [ server2 ] , [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> cluster = base . TestCluster ( [ master_group , slave_group , slave2_group ] ) <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> cluster_config . create_operational_config ( cluster , [ ] ) <EOL> datanode_ngs = cluster_config . get_node_groups_containing_component ( <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( datanode_ngs ) ) <EOL> ng_names = set ( [ datanode_ngs [ <NUM_LIT:0> ] . name , datanode_ngs [ <NUM_LIT:1> ] . name ] ) <EOL> self . assertIn ( '<STR_LIT>' , ng_names ) <EOL> self . assertIn ( '<STR_LIT>' , ng_names ) <EOL> def test_get_components_for_type ( self , patched ) : <EOL> cluster_config = base . create_clusterspec ( hdp_version = '<STR_LIT>' ) <EOL> clients = cluster_config . get_components_for_type ( '<STR_LIT>' ) <EOL> slaves = cluster_config . get_components_for_type ( '<STR_LIT>' ) <EOL> masters = cluster_config . get_components_for_type ( '<STR_LIT>' ) <EOL> expected_clients = set ( [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEqual ( expected_clients , expected_clients & set ( clients ) ) <EOL> expected_slaves = set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . assertEqual ( expected_slaves , expected_slaves & set ( slaves ) ) <EOL> expected_masters = set ( [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEqual ( expected_masters , expected_masters & set ( masters ) ) <EOL> def _assert_services ( self , services ) : <EOL> found_services = [ ] <EOL> for service in services : <EOL> name = service . name <EOL> found_services . append ( name ) <EOL> self . service_validators [ name ] ( service ) <EOL> self . assertEqual ( <NUM_LIT:15> , len ( found_services ) ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> self . assertIn ( '<STR_LIT>' , found_services ) <EOL> def _assert_hdfs ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:6> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_mrv2 ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:2> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_yarn ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:3> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_nagios ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:1> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_ganglia ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:2> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_ambari ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:2> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( service . users ) ) <EOL> user = service . users [ <NUM_LIT:0> ] <EOL> self . assertEqual ( '<STR_LIT>' , user . name ) <EOL> self . assertEqual ( '<STR_LIT>' , user . password ) <EOL> groups = user . groups <EOL> self . assertEqual ( <NUM_LIT:1> , len ( groups ) ) <EOL> self . assertIn ( '<STR_LIT>' , groups ) <EOL> def _assert_pig ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( service . components ) ) <EOL> self . assertEqual ( '<STR_LIT>' , service . components [ <NUM_LIT:0> ] . name ) <EOL> def _assert_hive ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:4> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_hcatalog ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( service . components ) ) <EOL> self . assertEqual ( '<STR_LIT>' , service . components [ <NUM_LIT:0> ] . name ) <EOL> def _assert_zookeeper ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:2> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_webhcat ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( service . components ) ) <EOL> self . assertEqual ( '<STR_LIT>' , service . components [ <NUM_LIT:0> ] . name ) <EOL> def _assert_oozie ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:2> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_sqoop ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( service . components ) ) <EOL> self . assertEqual ( '<STR_LIT>' , service . components [ <NUM_LIT:0> ] . name ) <EOL> def _assert_hbase ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:3> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_hue ( self , service ) : <EOL> self . assertEqual ( '<STR_LIT>' , service . name ) <EOL> found_components = { } <EOL> for component in service . components : <EOL> found_components [ component . name ] = component <EOL> self . assertEqual ( <NUM_LIT:1> , len ( found_components ) ) <EOL> self . _assert_component ( '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT:1>" , <EOL> found_components [ '<STR_LIT>' ] ) <EOL> def _assert_component ( self , name , comp_type , cardinality , component ) : <EOL> self . assertEqual ( name , component . name ) <EOL> self . assertEqual ( comp_type , component . type ) <EOL> self . assertEqual ( cardinality , component . cardinality ) <EOL> def _assert_configurations ( self , configurations ) : <EOL> self . assertEqual ( <NUM_LIT> , len ( configurations ) ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> self . assertIn ( '<STR_LIT>' , configurations ) <EOL> class TestNodeGroup ( object ) : <EOL> def __init__ ( self , name , instances , node_processes , count = <NUM_LIT:1> ) : <EOL> self . name = name <EOL> self . instances = instances <EOL> for i in instances : <EOL> i . node_group = self <EOL> self . node_processes = node_processes <EOL> self . count = count <EOL> self . id = name <EOL> def storage_paths ( self ) : <EOL> return [ '<STR_LIT>' ] <EOL> class TestUserInputConfig ( object ) : <EOL> def __init__ ( self , tag , target , name ) : <EOL> self . tag = tag <EOL> self . applicable_target = target <EOL> self . name = name </s>
