http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py deleted file mode 100644 index 88fb008..0000000 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py +++ /dev/null @@ -1,429 +0,0 @@ -#!/usr/bin/env python - -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -''' - -import os, json, crypt -import resource_management.libraries.functions - -from mock.mock import MagicMock, call, patch -from stacks.utils.RMFTestCase import * - -@patch.object(resource_management.libraries.functions, 'check_process_status', new = MagicMock()) -class TestHawqMaster(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = 'HAWQ/2.0.0/package' - STACK_VERSION = '2.3' - GPADMIN = 'gpadmin' - POSTGRES = 'postgres' - DEFAULT_IMMUTABLE_PATHS = ['/apps/hive/warehouse', '/apps/falcon', '/mr-history/done', '/app-logs', '/tmp'] - CONFIG_FILE = os.path.join(os.path.dirname(__file__), '../configs/hawq_default.json') - HAWQ_CHECK_COMMAND = 'source /usr/local/hawq/greenplum_path.sh && export PGHOST="c6403.ambari.apache.org" && hawq check -f /usr/local/hawq/etc/hawq_hosts --hadoop /usr/phd/current/hadoop-client --config /usr/local/hawq/etc/hawq_check.cnf ' - - def setUp(self): - try: - with open(self.CONFIG_FILE, "r") as f: - self.config_dict = json.load(f) - except IOError: - raise RuntimeError("Can not read config file: " + self.CONFIG_FILE) - - - def __asserts_for_configure(self): - - self.assertResourceCalled('Group', self.GPADMIN, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.GPADMIN, - gid = self.GPADMIN, - groups = ['gpadmin', u'hadoop'], - ignore_failures = True, - password = crypt.crypt(self.config_dict['configurations']['hawq-env']['hawq_password'], "$1$salt$") - ) - - self.assertResourceCalled('Group', self.POSTGRES, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.POSTGRES, - gid = self.POSTGRES, - groups = [self.POSTGRES, u'hadoop'], - ignore_failures = True - ) - - self.assertResourceCalled('Execute', 'chown -R gpadmin:gpadmin /usr/local/hawq/', - timeout = 600 - ) - - self.assertResourceCalled('XmlConfig', 'hdfs-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hdfs-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['hdfs-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'yarn-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['yarn-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['yarn-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'hawq-site.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hawq-site'], - configuration_attributes = self.getConfig()['configuration_attributes']['hawq-site'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('File', '/usr/local/hawq/etc/hawq_check.cnf', - content = self.getConfig()['configurations']['hawq-check-env']['content'], - owner = self.GPADMIN, - group = self.GPADMIN, - mode=0644 - ) - - self.assertResourceCalled('File', '/usr/local/hawq/etc/slaves', - content = InlineTemplate('c6401.ambari.apache.org\nc6402.ambari.apache.org\nc6403.ambari.apache.org\n\n'), - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('Directory', '/data/hawq/master', - group = self.GPADMIN, - owner = self.GPADMIN, - create_parents = True - ) - - self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', - user = 'root', - timeout = 600 - ) - - self.assertResourceCalled('Directory', '/data/hawq/tmp/master', - group = self.GPADMIN, - owner = self.GPADMIN, - create_parents = True - ) - - - @patch ('hawqmaster.common.__set_osparams') - def test_configure_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'configure', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - @patch ('hawqmaster.common.__set_osparams') - def test_install_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'install', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - @patch ('hawqmaster.common.__set_osparams') - def test_start_default(self, set_osparams_mock): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'start', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - - self.assertResourceCalled('HdfsResource', '/hawq_data', - immutable_paths = self.DEFAULT_IMMUTABLE_PATHS, - default_fs = u'hdfs://c6401.ambari.apache.org:8020', - hdfs_site = self.getConfig()['configurations']['hdfs-site'], - type = 'directory', - action = ['create_on_execute'], - owner = self.GPADMIN, - group = self.GPADMIN, - user = u'hdfs', - mode = 493, - security_enabled = False, - kinit_path_local = '/usr/bin/kinit', - recursive_chown = True, - keytab = UnknownConfigurationMock(), - principal_name = UnknownConfigurationMock(), - ) - - self.assertResourceCalled('HdfsResource', None, - immutable_paths = self.DEFAULT_IMMUTABLE_PATHS, - default_fs = u'hdfs://c6401.ambari.apache.org:8020', - hdfs_site = self.getConfig()['configurations']['hdfs-site'], - action = ['execute'], - user = u'hdfs', - security_enabled = False, - kinit_path_local = '/usr/bin/kinit', - keytab = UnknownConfigurationMock(), - principal_name = UnknownConfigurationMock() - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq init master -a -v --ignore-bad-hosts', - logoutput = True, - not_if = None, - only_if = None, - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() - - - def __asserts_for_stop(self, componentCommand, expectedCommand): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = componentCommand, - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('Execute', expectedCommand, - logoutput = True, - not_if = None, - only_if = "netstat -tupln | egrep ':5432\\s' | egrep postgres", - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() - - - @patch ('hawqmaster.common.__set_osparams') - @patch ('common.get_local_hawq_site_property_value') - def test_stop_default(self, get_local_hawq_site_property_value_mock, set_osparams_mock): - """ Run Stop HAWQMASTER """ - - get_local_hawq_site_property_value_mock.return_value = 5432 - self.__asserts_for_stop('stop', 'source /usr/local/hawq/greenplum_path.sh && hawq stop master -M fast -a -v') - - - @patch ('hawqmaster.common.__set_osparams') - @patch ('common.get_local_hawq_site_property_value') - def test_stop_cluster_immediate(self, get_local_hawq_site_property_value_mock, set_osparams_mock): - """ Run Stop HAWQ Cluster Immediate Mode """ - - get_local_hawq_site_property_value_mock.return_value = 5432 - self.__asserts_for_stop('immediate_stop_hawq_service','source /usr/local/hawq/greenplum_path.sh && hawq stop cluster -M immediate -a -v') - - - def __asserts_for_hawq_check(self, expectedCommand): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'run_hawq_check', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('File', "/usr/local/hawq/etc/hawq_hosts", - content = InlineTemplate("{% for host in hawq_all_hosts %}{{host}}\n{% endfor %}"), - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('Execute', expectedCommand, - logoutput = True, - not_if = None, - only_if = None, - user=self.GPADMIN, - timeout=900 - ) - - self.assertNoMoreResources() - - - def test_run_hawq_check_case1(self): - """ Running HAWQ Check Case 1: Non HDFS-HA, Standalone Resource Management, Not Kerberized """ - - expectedCommand = self.HAWQ_CHECK_COMMAND - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case2(self): - """ Running HAWQ Check Case 2: Non HDFS-HA, Standalone Resource Management, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - expectedCommand = "{0}--kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case3(self): - """ Running HAWQ Check Case 3: Non HDFS-HA, YARN Resource Management Non YARN_HA, Not Kerberized """ - - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - expectedCommand = "{0}--yarn".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case4(self): - """ Running HAWQ Check Case 4: Non HDFS-HA, YARN Resource Management Non YARN_HA, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - expectedCommand = "{0}--yarn --kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case5(self): - """ Running HAWQ Check Case 5: Non HDFS-HA, YARN Resource Management YARN_HA, Not Kerberized """ - - self.config_dict['configurations']['yarn-site']['yarn.resourcemanager.ha.enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - expectedCommand = "{0}--yarn-ha".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case6(self): - """ Running HAWQ Check Case 6: Non HDFS-HA, YARN Resource Management YARN_HA, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - self.config_dict['configurations']['yarn-site']['yarn.resourcemanager.ha.enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - expectedCommand = "{0}--yarn-ha --kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case7(self): - """ Running HAWQ Check Case 7: HDFS-HA, Standalone Resource Management, Not Kerberized """ - - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case8(self): - """ Running HAWQ Check Case 8: HDFS-HA, Standalone Resource Management, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha --kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case9(self): - """ Running HAWQ Check Case 9: HDFS-HA, YARN Resource Management Non YARN_HA, Not Kerberized """ - - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha --yarn".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case10(self): - """ Running HAWQ Check Case 10: HDFS-HA, YARN Resource Management Non YARN_HA, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha --yarn --kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case11(self): - """ Running HAWQ Check Case 11: HDFS-HA, YARN Resource Management YARN_HA, Not Kerberized """ - - self.config_dict['configurations']['yarn-site']['yarn.resourcemanager.ha.enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha --yarn-ha".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_run_hawq_check_case12(self): - """ Running HAWQ Check Case 12: HDFS-HA, YARN Resource Management YARN_HA, Kerberized """ - - self.config_dict['configurations']['cluster-env']['security_enabled'] = "true" - self.config_dict['configurations']['yarn-site']['yarn.resourcemanager.ha.enabled'] = "true" - self.config_dict['configurations']['hawq-site']['hawq_global_rm_type'] = "yarn" - self.config_dict['configurations']['hdfs-site']['dfs.nameservices'] = "haservice" - expectedCommand = "{0}--hdfs-ha --yarn-ha --kerberos".format(self.HAWQ_CHECK_COMMAND) - self.__asserts_for_hawq_check(expectedCommand) - - - def test_resync_hawq_standby(self): - """ Run custom command Resync HAWQ Standby """ - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'resync_hawq_standby', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && export PGHOST="c6403.ambari.apache.org" && hawq init standby -n -a -v -M fast', - user = self.GPADMIN, - timeout = 900, - not_if = None, - only_if = None, - logoutput = True - ) - - self.assertNoMoreResources() - - - def test_remove_hawq_standby(self): - """ Run custom command Remove HAWQ Standby """ - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqmaster.py', - classname = 'HawqMaster', - command = 'remove_hawq_standby', - config_dict = self.config_dict, - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && export PGHOST="c6403.ambari.apache.org" && hawq init standby -a -v -r --ignore-bad-hosts', - user = self.GPADMIN, - timeout = 900, - not_if = None, - only_if = None, - logoutput = True - ) - - self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py deleted file mode 100644 index 8639ca5..0000000 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python - -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -''' - -import os, json, crypt -from mock.mock import MagicMock, call, patch -from stacks.utils.RMFTestCase import * - -class TestHawqSegment(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = 'HAWQ/2.0.0/package' - STACK_VERSION = '2.3' - GPADMIN = 'gpadmin' - POSTGRES = 'postgres' - - def __asserts_for_configure(self): - - self.assertResourceCalled('Group', self.GPADMIN, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.GPADMIN, - gid = self.GPADMIN, - groups = [self.GPADMIN, u'hadoop'], - ignore_failures = True, - password = crypt.crypt(self.getConfig()['configurations']['hawq-env']['hawq_password'], "$1$salt$") - ) - - self.assertResourceCalled('Group', self.POSTGRES, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.POSTGRES, - gid = self.POSTGRES, - groups = [self.POSTGRES, u'hadoop'], - ignore_failures = True - ) - - self.assertResourceCalled('Execute', 'chown -R gpadmin:gpadmin /usr/local/hawq/', - timeout = 600 - ) - - self.assertResourceCalled('XmlConfig', 'hdfs-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hdfs-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['hdfs-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'yarn-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['yarn-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['yarn-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'hawq-site.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hawq-site'], - configuration_attributes = self.getConfig()['configuration_attributes']['hawq-site'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('Directory', '/data/hawq/segment', - owner = self.GPADMIN, - group = self.GPADMIN, - create_parents = True - ) - - self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/segment', - user = 'root', - timeout = 600 - ) - - self.assertResourceCalled('Directory', '/data/hawq/tmp/segment', - owner = self.GPADMIN, - group = self.GPADMIN, - create_parents = True - ) - - - - @patch ('hawqsegment.common.__set_osparams') - def test_configure_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqsegment.py', - classname = 'HawqSegment', - command = 'configure', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - @patch ('hawqsegment.common.__set_osparams') - def test_install_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqsegment.py', - classname = 'HawqSegment', - command = 'install', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - @patch ('hawqsegment.common.__set_osparams') - def test_start_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqsegment.py', - classname = 'HawqSegment', - command = 'start', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq init segment -a -v', - logoutput = True, - not_if = None, - only_if = None, - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() - - - @patch ('common.get_local_hawq_site_property_value') - def test_stop_default(self, get_local_hawq_site_property_value_mock): - get_local_hawq_site_property_value_mock.return_value = 40000 - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqsegment.py', - classname = 'HawqSegment', - command = 'stop', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq stop segment -M fast -a -v', - logoutput = True, - not_if = None, - only_if = "netstat -tupln | egrep ':40000\\s' | egrep postgres", - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py deleted file mode 100644 index b406723..0000000 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python - -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -''' - -import os, json, crypt -from mock.mock import MagicMock, call, patch -from stacks.utils.RMFTestCase import * - - -class TestHawqStandby(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = 'HAWQ/2.0.0/package' - STACK_VERSION = '2.3' - GPADMIN = 'gpadmin' - POSTGRES = 'postgres' - - def __asserts_for_configure(self): - - self.assertResourceCalled('Group', self.GPADMIN, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.GPADMIN, - gid = self.GPADMIN, - groups = [self.GPADMIN, u'hadoop'], - ignore_failures = True, - password = crypt.crypt(self.getConfig()['configurations']['hawq-env']['hawq_password'], "$1$salt$") - ) - - self.assertResourceCalled('Group', self.POSTGRES, - ignore_failures = True - ) - - self.assertResourceCalled('User', self.POSTGRES, - gid = self.POSTGRES, - groups = [self.POSTGRES, u'hadoop'], - ignore_failures = True - ) - - self.assertResourceCalled('Execute', 'chown -R gpadmin:gpadmin /usr/local/hawq/', - timeout = 600 - ) - - self.assertResourceCalled('XmlConfig', 'hdfs-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hdfs-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['hdfs-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'yarn-client.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['yarn-client'], - configuration_attributes = self.getConfig()['configuration_attributes']['yarn-client'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('XmlConfig', 'hawq-site.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hawq-site'], - configuration_attributes = self.getConfig()['configuration_attributes']['hawq-site'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('File', '/usr/local/hawq/etc/hawq_check.cnf', - content = self.getConfig()['configurations']['hawq-check-env']['content'], - owner = self.GPADMIN, - group = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('File', '/usr/local/hawq/etc/slaves', - content = InlineTemplate('c6401.ambari.apache.org\nc6402.ambari.apache.org\nc6403.ambari.apache.org\n\n'), - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('Directory', '/data/hawq/master', - group = self.GPADMIN, - owner = self.GPADMIN, - create_parents = True - ) - - self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', - user = 'root', - timeout = 600 - ) - - self.assertResourceCalled('Directory', '/data/hawq/tmp/master', - group = self.GPADMIN, - owner = self.GPADMIN, - create_parents = True - ) - - - @patch ('hawqstandby.common.__set_osparams') - def test_configure_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', - classname = 'HawqStandby', - command = 'configure', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - @patch ('hawqstandby.common.__set_osparams') - def test_install_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', - classname = 'HawqStandby', - command = 'install', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - self.assertNoMoreResources() - - - - @patch ('hawqstandby.common.__set_osparams') - def test_start_default(self, set_osparams_mock): - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', - classname = 'HawqStandby', - command = 'start', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.__asserts_for_configure() - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq init standby -a -v', - logoutput = True, - not_if = None, - only_if = None, - user = self.GPADMIN, - timeout = 900 - ) - self.assertNoMoreResources() - - - @patch ('hawqstandby.common.__set_osparams') - @patch ('common.get_local_hawq_site_property_value') - def test_stop_default(self, get_local_hawq_site_property_value_mock, set_osparams_mock): - get_local_hawq_site_property_value_mock.return_value = 5432 - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', - classname = 'HawqStandby', - command = 'stop', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq stop standby -M fast -a -v', - logoutput = True, - not_if = None, - only_if = "netstat -tupln | egrep ':5432\\s' | egrep gpsyncmaster", - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() - - - @patch ('common.get_local_hawq_site_property_value') - def test_activate_hawq_standby(self, get_local_hawq_site_property_value_mock): - """Test Activate HAWQ Standby Command""" - - get_local_hawq_site_property_value_mock.return_value = 5432 - - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', - classname = 'HawqStandby', - command = 'activate_hawq_standby', - config_file ='hawq_default.json', - stack_version = self.STACK_VERSION, - target = RMFTestCase.TARGET_COMMON_SERVICES - ) - - self.assertResourceCalled('XmlConfig', 'hawq-site.xml', - conf_dir = '/usr/local/hawq/etc/', - configurations = self.getConfig()['configurations']['hawq-site'], - configuration_attributes = self.getConfig()['configuration_attributes']['hawq-site'], - group = self.GPADMIN, - owner = self.GPADMIN, - mode = 0644 - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && export PGHOST=\"c6402.ambari.apache.org\" && hawq activate standby -a -M fast -v --ignore-bad-hosts', - logoutput = True, - not_if = None, - only_if = None, - user = self.GPADMIN, - timeout = 900 - ) - - self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq stop master -M fast -a -v', - logoutput = True, - not_if = None, - only_if = "netstat -tupln | egrep ':5432\\s' | egrep postgres", - user = self.GPADMIN, - timeout = 900 - ) - - self.assertNoMoreResources() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py deleted file mode 100644 index 8d97baa..0000000 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_service_advisor.py +++ /dev/null @@ -1,318 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -""" - -import os -import imp -from unittest import TestCase -from mock.mock import patch - - -class TestHAWQ200ServiceAdvisor(TestCase): - - def setUp(self): - self.testDirectory = os.path.dirname(os.path.abspath(__file__)) - stackAdvisorPath = os.path.join(self.testDirectory, '../../../../../main/resources/stacks/stack_advisor.py') - hawq200ServiceAdvisorPath = os.path.join(self.testDirectory, '../../../../../main/resources/common-services/HAWQ/2.0.0/service_advisor.py') - with open(stackAdvisorPath, 'rb') as fp: - imp.load_module('stack_advisor', fp, stackAdvisorPath, ('.py', 'rb', imp.PY_SOURCE)) - with open(hawq200ServiceAdvisorPath, 'rb') as fp: - service_advisor_impl = imp.load_module('service_advisor_impl', fp, hawq200ServiceAdvisorPath, ('.py', 'rb', imp.PY_SOURCE)) - serviceAdvisorClass = getattr(service_advisor_impl, 'HAWQ200ServiceAdvisor') - self.serviceAdvisor = serviceAdvisorClass() - - - @patch("socket.getfqdn") - def test_getHostsForMasterComponent(self, getfqdn_mock): - getfqdn_mock.return_value = "c6401.ambari.apache.org" - - services = { - "services": [ - { - "StackServices": { - "service_name": "HAWQ" - }, - "components": [ - { - "StackServiceComponents": { - "component_name": "HAWQMASTER", - "hostnames": [ - "c6403.ambari.apache.org" - ] - } - }, - { - "StackServiceComponents": { - "component_name": "HAWQSTANDBY", - "hostnames": [ - ] - } - } - ] - } - ] - } - - hostsList = ["c6401.ambari.apache.org", "c6402.ambari.apache.org", "c6403.ambari.apache.org", "c6404.ambari.apache.org"] - - component = { - "StackServiceComponents": { - "component_name": "HAWQSTANDBY" - } - } - - # Case 1: - # Ambari Server is placed on c6401.ambari.apache.org - # HAWQMASTER is placed on c6403.ambari.apache.org - # There are 4 available hosts in the cluster - # Recommend HAWQSTANDBY on next available host, c6402.ambari.apache.org - standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(services, None, component, hostsList) - self.assertEquals(standbyHosts, ["c6402.ambari.apache.org"]) - - # Case 2: - # Ambari Server is placed on c6401.ambari.apache.org - # HAWQMASTER is placed on c6402.ambari.apache.org - # There are 4 available hosts in the cluster - # Recommend HAWQSTANDBY on next available host, c6403.ambari.apache.org - services["services"][0]["components"][0]["StackServiceComponents"]["hostnames"] = ["c6402.ambari.apache.org"] - standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(services, None, component, hostsList) - self.assertEquals(standbyHosts, ["c6403.ambari.apache.org"]) - - # Case 3: - # Ambari Server is placed on c6401.ambari.apache.org - # HAWQMASTER is placed on c6402.ambari.apache.org - # There are 2 available hosts in the cluster - # Recommend HAWQSTANDBY on a host which does not have HAWQMASTER, c6401.ambari.apache.org - hostsList = ["c6401.ambari.apache.org", "c6402.ambari.apache.org"] - standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(services, None, component, hostsList) - self.assertEquals(standbyHosts, ["c6401.ambari.apache.org"]) - - # Case 4: - # Ambari Server is placed on c6401.ambari.apache.org - # HAWQMASTER is placed on c6401.ambari.apache.org - # There is 1 available host in the cluster - # Do not recommend HAWQSTANDBY on a single node cluster - hostsList = ["c6401.ambari.apache.org"] - services["services"][0]["components"][0]["StackServiceComponents"]["hostnames"] = ["c6401.ambari.apache.org"] - standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(services, None, component, hostsList) - self.assertEquals(standbyHosts, []) - - # Case 5: - # Ambari Server is placed on c6401.ambari.apache.org - # HAWQMASTER is placed on c6402.ambari.apache.org - # HAWQSTANDBY is placed on c6401.ambari.apache.org - # There are 3 available host in the cluster - # Do not change HAWQSTANDBY host according to recommendation since HAWQSTANDBY has already been assigned a host - hostsList = ["c6401.ambari.apache.org", "c6402.ambari.apache.org", "c6403.ambari.apache.org"] - services["services"][0]["components"][0]["StackServiceComponents"]["hostnames"] = ["c6402.ambari.apache.org"] - services["services"][0]["components"][1]["StackServiceComponents"]["hostnames"] = ["c6401.ambari.apache.org"] - standbyHosts = self.serviceAdvisor.getHostsForMasterComponent(services, None, component, hostsList) - self.assertEquals(standbyHosts, ["c6401.ambari.apache.org"]) - - - def test_getServiceConfigurationRecommendations(self): - - configurations = { - "hawq-sysctl-env": { - "properties": { - "vm.overcommit_memory": 1, - "vm.overcommit_ratio": 50 - } - }, - "hawq-site": { - "properties": { - "hawq_rm_memory_limit_perseg": "65535MB", - "hawq_rm_nvcore_limit_perseg": "16", - "hawq_global_rm_type": "yarn" - } - } - } - - services = { - "services": [ - { - "StackServices": { - "service_name": "HAWQ", - "service_version": "2.0", - "stack_name": "HDP", - "stack_version": "2.3" - }, - "components": [ - { - "StackServiceComponents": { - "component_name": "HAWQMASTER", - "hostnames": [ - "c6401.ambari.apache.org" - ] - } - }, - { - "StackServiceComponents": { - "component_name": "HAWQSEGMENT", - "hostnames": [ - "c6402.ambari.apache.org", - "c6404.ambari.apache.org", - ] - } - } - ] - } - ], - "configurations": configurations - } - - hosts = { - "items": [ - { - "Hosts": { - "host_name": "c6401.ambari.apache.org", - "cpu_count" : 2, - "total_mem": 33554432 - } - }, - { - "Hosts": { - "host_name": "c6402.ambari.apache.org", - "cpu_count" : 4, - "total_mem": 33554433 - } - }, - { - "Hosts": { - "host_name": "c6403.ambari.apache.org", - "cpu_count" : 1, - "total_mem": 33554434 - } - }, - { - "Hosts": { - "host_name": "c6404.ambari.apache.org", - "cpu_count" : 2, - "total_mem": 33554435 - } - } - ] - } - - ## Test if hawq_rm_nvcore_limit_perseg is set correctly - - # Case 1: - # HAWQ Hosts Core Count: c6401.ambari.apache.org - 2, c6402.ambari.apache.org - 4, c6404.ambari.apache.org - 2 - # hawq_global_rm_type: yarn - # Non HAWQ Hosts Core Count: c6401.ambari.apache.org - 1 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEquals(configurations["hawq-site"]["properties"]["hawq_rm_nvcore_limit_perseg"], "2") - - ## Test if vm.overcommit_memory is set correctly - - # Case 1: All machines have total_mem above 32GB (total_mem >= 33554432) - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEquals(configurations["hawq-sysctl-env"]["properties"]["vm.overcommit_memory"], "2") - - # Case 2: One machine has total_mem below 32GB - hosts["items"][0]["Hosts"]["total_mem"] = 33554431 - services["configurations"]["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"] = "65535MB" - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEquals(configurations["hawq-sysctl-env"]["properties"]["vm.overcommit_memory"], "1") - - ## Test if hawq_rm_memory_limit_perseg is set correctly - - # Case 1: Minimum host memory is ~ 2 GB (2048MB), recommended val must be .75% of 2GB as vm.overcommit_memory = 1 and in MB - hosts["items"][0]["Hosts"]["total_mem"] = 2097152 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "1536MB") - - # Case 2: Minimum host memory is ~ 16 GB, recommended val must be .75% of 16GB as vm.overcommit_memory = 1 and in GB - hosts["items"][0]["Hosts"]["total_mem"] = 16777216 - hosts["items"][1]["Hosts"]["total_mem"] = 26777216 - hosts["items"][3]["Hosts"]["total_mem"] = 36777216 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "12GB") - - # Case 2: Minimum host memory is ~ 64 GB, recommended val must be .75% of 32GB as vm.overcommit_memory = 2 and in GB - hosts["items"][0]["Hosts"]["total_mem"] = 67108864 - hosts["items"][1]["Hosts"]["total_mem"] = 77108864 - hosts["items"][3]["Hosts"]["total_mem"] = 87108864 - services["configurations"]["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"] = "65535MB" - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "24GB") - - # Case 4: Minimum host memory is ~ 512 GB, recommended val must be .85% of 256GB as vm.overcommit_memory = 2 and in GB - hosts["items"][0]["Hosts"]["total_mem"] = 536870912 - hosts["items"][1]["Hosts"]["total_mem"] = 636870912 - hosts["items"][3]["Hosts"]["total_mem"] = 736870912 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEquals(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "218GB") - - # Case 5: Minimum host memory is ~ 1024 GB, recommended val must be .95% of 512GB as vm.overcommit_memory = 2 and in GB - hosts["items"][0]["Hosts"]["total_mem"] = 1073741824 - hosts["items"][1]["Hosts"]["total_mem"] = 2073741824 - hosts["items"][3]["Hosts"]["total_mem"] = 3073741824 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "436GB") - - # Case 6: Minimum host memory is ~ 1024 GB, vm.overcommit_ratio = 75, vm.overcommit_memory = 2 - # recommended val must be .95% of (1024*75)/100 and in GB - hosts["items"][0]["Hosts"]["total_mem"] = 1073741824 - hosts["items"][1]["Hosts"]["total_mem"] = 2073741824 - hosts["items"][3]["Hosts"]["total_mem"] = 3073741824 - services["configurations"]["hawq-sysctl-env"]["properties"]["vm.overcommit_ratio"] = 75 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-site"]["properties"]["hawq_rm_memory_limit_perseg"], "730GB") - - ## Test if the properties are set to visible / invisible based on the value of hawq_global_rm_type - - # Case 1: When hawq_global_rm_type is yarn - services["configurations"]["hawq-site"]["properties"]["hawq_global_rm_type"] = "yarn" - properties_visible_status = {"hawq_rm_memory_limit_perseg": "false", - "hawq_rm_nvcore_limit_perseg": "false", - "hawq_rm_yarn_app_name":"true", - "hawq_rm_yarn_queue_name": "true", - "hawq_rm_yarn_scheduler_address": "true", - "hawq_rm_yarn_address": "true"} - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - for property, status in properties_visible_status.iteritems(): - self.assertEqual(configurations["hawq-site"]["property_attributes"][property]["visible"], status) - - # Case 2: When hawq_global_rm_type is none - services["configurations"]["hawq-site"]["properties"]["hawq_global_rm_type"] = "none" - properties_visible_status = {"hawq_rm_memory_limit_perseg": "true", - "hawq_rm_nvcore_limit_perseg": "true", - "hawq_rm_yarn_app_name": "false", - "hawq_rm_yarn_queue_name": "false", - "hawq_rm_yarn_scheduler_address": "false", - "hawq_rm_yarn_address": "false"} - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - for property, status in properties_visible_status.iteritems(): - self.assertEqual(configurations["hawq-site"]["property_attributes"][property]["visible"], status) - - ## Test if vm.overcommit_ratio is set to visible / invisible based on the value of vm.overcommit_memory - - # Case 1: vm.overcommit_ratio should be invisible when overcommit_memory is set as 0 - services["configurations"]["hawq-sysctl-env"]["properties"]["vm.overcommit_memory"] = 0 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-sysctl-env"]["property_attributes"]["vm.overcommit_ratio"]["visible"], "false") - - # Case 2: vm.overcommit_ratio should be invisible when overcommit_memory is set as 1 - services["configurations"]["hawq-sysctl-env"]["properties"]["vm.overcommit_memory"] = 1 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-sysctl-env"]["property_attributes"]["vm.overcommit_ratio"]["visible"], "false") - - # Case 3: vm.overcommit_ratio should be visible when overcommit_memory is set as 2 - services["configurations"]["hawq-sysctl-env"]["properties"]["vm.overcommit_memory"] = 2 - self.serviceAdvisor.getServiceConfigurationRecommendations(configurations, None, services, hosts) - self.assertEqual(configurations["hawq-sysctl-env"]["property_attributes"]["vm.overcommit_ratio"]["visible"], "true") \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/HAWQ/test_utils.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_utils.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_utils.py deleted file mode 100644 index 07737eb..0000000 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_utils.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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 stacks.utils.RMFTestCase import * - -import utils - -class TestUtils(RMFTestCase): - - def test_generate_hawq_process_status_cmd(self): - cmd = utils.generate_hawq_process_status_cmd("master", 12345) - self.assertEqual(cmd, "netstat -tupln | egrep ':12345\s' | egrep postgres") http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/PXF/test_alerts_api_status.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/PXF/test_alerts_api_status.py b/ambari-server/src/test/python/stacks/2.3/PXF/test_alerts_api_status.py deleted file mode 100644 index ee187e2..0000000 --- a/ambari-server/src/test/python/stacks/2.3/PXF/test_alerts_api_status.py +++ /dev/null @@ -1,77 +0,0 @@ -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -''' - -# System imports -import os -import sys - -from mock.mock import patch - -# Local imports -from stacks.utils.RMFTestCase import RMFTestCase - -COMMON_SERVICES_ALERTS_DIR_PATH = "../../../../../main/resources/common-services/PXF/3.0.0/package/alerts" - -current_dir = os.path.dirname(os.path.abspath(__file__)) -alerts_dir = os.path.abspath(os.path.join(current_dir, COMMON_SERVICES_ALERTS_DIR_PATH)) - -class TestAlertsApiStatus(RMFTestCase): - - def setUp(self): - """ - Import the class under test. - Because the class is present in a different folder, append its dir to the system path. - Also, shorten the import name and make it a global so the test functions can access it. - """ - sys.path.append(alerts_dir) - global api_status - import api_status - - @patch("api_status._makeHTTPCall") - def test_get_pxf_protocol_version(self, makeHTTPCall_mock): - - mock_response = '{ "version": "v14"}' - makeHTTPCall_mock.return_value = mock_response - BASE_URL = "http://localhost:51200/pxf/" - - version = api_status._get_pxf_protocol_version(BASE_URL) - self.assertEqual(version, "v14") - - mock_response = 'BAD RESPONSE' - makeHTTPCall_mock.return_value = mock_response - - try: - api_status._get_pxf_protocol_version(BASE_URL) - self.fail() - except Exception as e: - self.assertEqual(str(e), "version could not be found in response BAD RESPONSE") - - @patch("api_status._makeHTTPCall") - def test_execute(self, makeHTTPCall_mock): - - mock_response = '{ "version": "v14"}' - makeHTTPCall_mock.return_value = mock_response - - result = api_status.execute(configurations = {}) - self.assertEqual(result, (api_status.RESULT_STATE_OK, ['PXF is functional'])) - - mock_response = 'BAD RESPONSE' - makeHTTPCall_mock.return_value = mock_response - - result = api_status.execute(configurations = {}) - self.assertEqual(result, ('WARNING', ['PXF is not functional on host, None: version could not be found in response BAD RESPONSE'])) http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/PXF/test_pxf.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/PXF/test_pxf.py b/ambari-server/src/test/python/stacks/2.3/PXF/test_pxf.py deleted file mode 100644 index 1147a7e..0000000 --- a/ambari-server/src/test/python/stacks/2.3/PXF/test_pxf.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python - -''' -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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 mock.mock import patch -from stacks.utils.RMFTestCase import Template, RMFTestCase -from only_for_platform import not_for_platform, PLATFORM_WINDOWS - -@not_for_platform(PLATFORM_WINDOWS) -class TestPxf(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = "PXF/3.0.0/package" - STACK_VERSION = "2.3" - PXF_USER = 'pxf' - PXF_GROUP = 'pxf' - TOMCAT_GROUP = 'tomcat' - BASH_SHELL = '/bin/bash' - DEFAULT_TIMEOUT = 600 - - def assert_configure_default(self): - self.assertResourceCalled('User', self.PXF_USER, - groups=[self.getConfig()['configurations']['hdfs-site']['dfs.permissions.superusergroup'], - self.getConfig()['configurations']['cluster-env']['user_group'], - self.TOMCAT_GROUP], - shell=self.BASH_SHELL) - - self.assertResourceCalled('File', '/etc/pxf/conf/pxf-env.sh', - content=Template('pxf-env.j2')) - - self.assertResourceCalled('File', '/etc/pxf/conf/pxf-public.classpath', - content = self.getConfig()['configurations']['pxf-public-classpath']['content'].lstrip()) - - self.assertResourceCalled('File', '/etc/pxf/conf/pxf-profiles.xml', - content = self.getConfig()['configurations']['pxf-profiles']['content'].lstrip()) - - self.assertResourceCalled('XmlConfig', 'pxf-site.xml', - conf_dir='/etc/pxf/conf', - configurations=self.getConfig()['configurations']['pxf-site'], - configuration_attributes=self.getConfig()['configuration_attributes']['pxf-site']) - - self.assertResourceCalled('Execute', 'service pxf-service init', - timeout=self.DEFAULT_TIMEOUT, - logoutput=True) - - @patch('shutil.copy2') - def test_install_default(self, shutil_copy2_mock): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/pxf.py", - classname="Pxf", - command="install", - config_file="pxf_default.json", - stack_version=self.STACK_VERSION, - target=RMFTestCase.TARGET_COMMON_SERVICES, - try_install=True) - - self.assertResourceCalled('Package', 'pxf-service', - retry_count=5, - retry_on_repo_unavailability=False) - self.assertResourceCalled('Package', 'apache-tomcat', - retry_count=5, - retry_on_repo_unavailability=False) - self.assertResourceCalled('Package', 'pxf-hive', - retry_count=5, - retry_on_repo_unavailability=False) - self.assertResourceCalled('Package', 'pxf-hdfs', - retry_count=5, - retry_on_repo_unavailability=False) - self.assertResourceCalled('Package', 'pxf-hbase', - retry_count=5, - retry_on_repo_unavailability=False) - - self.assert_configure_default() - - @patch('shutil.copy2') - def test_configure_default(self, shutil_copy2_mock): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/pxf.py", - classname="Pxf", - command="configure", - config_file="pxf_default.json", - stack_version=self.STACK_VERSION, - target=RMFTestCase.TARGET_COMMON_SERVICES, - try_install=True) - - self.assert_configure_default() - - @patch('shutil.copy2') - def test_start_default(self, shutil_copy2_mock): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/pxf.py", - classname="Pxf", - command="start", - config_file="pxf_default.json", - stack_version=self.STACK_VERSION, - target=RMFTestCase.TARGET_COMMON_SERVICES, - try_install=True) - - self.assert_configure_default() - - self.assertResourceCalled('Directory', '/var/pxf', - owner=self.PXF_USER, - group=self.PXF_GROUP, - create_parents = True) - - self.assertResourceCalled('Execute', 'service pxf-service restart', - timeout=self.DEFAULT_TIMEOUT, - logoutput=True) - - def test_stop_default(self): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/pxf.py", - classname="Pxf", - command="stop", - config_file="pxf_default.json", - stack_version=self.STACK_VERSION, - target=RMFTestCase.TARGET_COMMON_SERVICES, - try_install=True) - - self.assertResourceCalled('Execute', 'service pxf-service stop', - timeout=self.DEFAULT_TIMEOUT, - logoutput=True) - - def test_status_default(self): - self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/pxf.py", - classname="Pxf", - command="status", - config_file="pxf_default.json", - stack_version=self.STACK_VERSION, - target=RMFTestCase.TARGET_COMMON_SERVICES, - try_install=True) - - self.assertResourceCalled('Execute', 'service pxf-service status', - timeout=self.DEFAULT_TIMEOUT, - logoutput=True) - - def tearDown(self): - self.assertNoMoreResources() http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/PXF/test_service_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/PXF/test_service_advisor.py b/ambari-server/src/test/python/stacks/2.3/PXF/test_service_advisor.py deleted file mode 100644 index 4ea3bfb..0000000 --- a/ambari-server/src/test/python/stacks/2.3/PXF/test_service_advisor.py +++ /dev/null @@ -1,111 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -""" - -import os -from unittest import TestCase - - -class TestPXF300ServiceAdvisor(TestCase): - - def setUp(self): - import imp - self.testDirectory = os.path.dirname(os.path.abspath(__file__)) - stackAdvisorPath = os.path.join(self.testDirectory, '../../../../../main/resources/stacks/stack_advisor.py') - pxf300ServiceAdvisorPath = os.path.join(self.testDirectory, '../../../../../main/resources/common-services/PXF/3.0.0/service_advisor.py') - with open(stackAdvisorPath, 'rb') as fp: - imp.load_module('stack_advisor', fp, stackAdvisorPath, ('.py', 'rb', imp.PY_SOURCE)) - with open(pxf300ServiceAdvisorPath, 'rb') as fp: - service_advisor_impl = imp.load_module('service_advisor_impl', fp, pxf300ServiceAdvisorPath, ('.py', 'rb', imp.PY_SOURCE)) - serviceAdvisorClass = getattr(service_advisor_impl, 'PXF300ServiceAdvisor') - self.serviceAdvisor = serviceAdvisorClass() - - self.PXF_PATH = "export HBASE_CLASSPATH=${HBASE_CLASSPATH}:/usr/lib/pxf/pxf-hbase.jar" - - def test_getServiceConfigurationRecommendations(self): - services = { - "configurations": { - "hbase-env": { - "properties": { - "content": "# Some hbase-env content text" - } - } - } - } - - ## Test is PXF_PATH is being added to hbase-env content - - # Case 1: Test pxf-hbase.jar classpath line was added to content - expected = "# Some hbase-env content text\n\n#Add pxf-hbase.jar to HBASE_CLASSPATH\n" + self.PXF_PATH - self.serviceAdvisor.getServiceConfigurationRecommendations(services["configurations"], None, services, None) - self.assertEquals(services["configurations"]["hbase-env"]["properties"]["content"], expected) - - # Case 2: Test pxf-hbase.jar classpath line is not added again if content already has it - services["configurations"]["hbase-env"]["properties"]["content"] = self.PXF_PATH - expected = self.PXF_PATH - self.serviceAdvisor.getServiceConfigurationRecommendations(services["configurations"], None, services, None) - self.assertEquals(services["configurations"]["hbase-env"]["properties"]["content"], expected) - - def test_getConfigurationsValidationItems(self): - services = { - "services": [ - { - "StackServices": { - "service_name": "PXF", - "service_version": "2.0", - "stack_name": "HDP", - "stack_version": "2.3" - } - }, - { - "StackServices": { - "service_name": "HBASE", - "service_version": "2.0", - "stack_name": "HDP", - "stack_version": "2.3" - } - } - ], - "configurations": { - "hbase-env": { - "properties": { - "content": "# Some hbase-env content text" - } - } - } - } - properties = services["configurations"] - - ## Test if PXF_PATH present in hbase-env content - - # Case 1: Generate warning item if PXF_PATH is not present in hbase-env - expected = [ - { - "config-type": "hbase-env", - "message": "HBASE_CLASSPATH must contain the location of pxf-hbase.jar", - "type": "configuration", - "config-name": "content", - "level": "WARN" - } - ] - items = self.serviceAdvisor.getConfigurationsValidationItems(properties, properties, services, None) - self.assertEquals(items, expected) - - # Case 2: No warning should be generated if PXF_PATH is present in hbase-env - properties = services["configurations"]["hbase-env"]["properties"]["content"] = self.PXF_PATH - items = self.serviceAdvisor.getConfigurationsValidationItems(properties, properties, services, None) - self.assertEquals(items, []) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/common/hosts-1-host.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/common/hosts-1-host.json b/ambari-server/src/test/python/stacks/2.3/common/hosts-1-host.json deleted file mode 100644 index 5d6a5b6..0000000 --- a/ambari-server/src/test/python/stacks/2.3/common/hosts-1-host.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "href" : "/api/v1/hosts?fields=Hosts/*&Hosts/host_name.in(c6401.ambari.apache.org)", - "items" : [ - { - "href" : "/api/v1/hosts/c6401.ambari.apache.org", - "Hosts" : { - "cpu_count" : 1, - "desired_configs" : null, - "disk_info" : [ - { - "available" : "481199976", - "device" : "/dev/mapper/VolGroup-lv_root", - "used" : "5713880", - "percent" : "2%", - "size" : "512971376", - "type" : "ext4", - "mountpoint" : "/" - }, - { - "available" : "1478456", - "device" : "tmpfs", - "used" : "0", - "percent" : "0%", - "size" : "1478456", - "type" : "tmpfs", - "mountpoint" : "/dev/shm" - }, - { - "available" : "438284", - "device" : "/dev/sda1", - "used" : "31960", - "percent" : "7%", - "size" : "495844", - "type" : "ext4", - "mountpoint" : "/boot" - }, - { - "available" : "191037148", - "device" : "vagrant", - "used" : "296051072", - "percent" : "61%", - "size" : "487088220", - "type" : "vboxsf", - "mountpoint" : "/vagrant" - } - ], - "host_health_report" : "", - "host_name" : "c6401.ambari.apache.org", - "host_state" : "HEALTHY", - "host_status" : "HEALTHY", - "ip" : "192.168.64.101", - "last_agent_env" : { - "stackFoldersAndFiles" : [ ], - "alternatives" : [ ], - "existingUsers" : [ ], - "existingRepos" : [ ], - "installedPackages" : [ ], - "hostHealth" : { - "activeJavaProcs" : [ ], - "agentTimeStampAtReporting" : 1445288922364, - "serverTimeStampAtReporting" : 1445288922425, - "liveServices" : [ - { - "desc" : "", - "name" : "ntpd", - "status" : "Healthy" - } - ] - }, - "umask" : 18, - "transparentHugePage" : "always", - "firewallRunning" : false, - "firewallName" : "iptables", - "reverseLookup" : true - }, - "last_heartbeat_time" : 1445288922425, - "last_registration_time" : 1445288888619, - "os_arch" : "x86_64", - "os_family" : "redhat6", - "os_type" : "centos6", - "ph_cpu_count" : 1, - "public_host_name" : "c6401.ambari.apache.org", - "rack_info" : "/default-rack", - "recovery_report" : { - "summary" : "DISABLED", - "component_reports" : [ ] - }, - "recovery_summary" : "DISABLED", - "total_mem" : 2956916 - } - } - ] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/de5110ec/ambari-server/src/test/python/stacks/2.3/common/hosts-3-hosts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/common/hosts-3-hosts.json b/ambari-server/src/test/python/stacks/2.3/common/hosts-3-hosts.json deleted file mode 100644 index 3c0511e..0000000 --- a/ambari-server/src/test/python/stacks/2.3/common/hosts-3-hosts.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "href" : "/api/v1/hosts?fields=Hosts/*&Hosts/host_name.in(c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org)", - "items" : [ - { - "href" : "/api/v1/hosts/c6401.ambari.apache.org", - "Hosts" : { - "cpu_count" : 1, - "desired_configs" : null, - "disk_info" : [ - { - "available" : "481199416", - "device" : "/dev/mapper/VolGroup-lv_root", - "used" : "5714440", - "percent" : "2%", - "size" : "512971376", - "type" : "ext4", - "mountpoint" : "/" - }, - { - "available" : "1478456", - "device" : "tmpfs", - "used" : "0", - "percent" : "0%", - "size" : "1478456", - "type" : "tmpfs", - "mountpoint" : "/dev/shm" - }, - { - "available" : "438284", - "device" : "/dev/sda1", - "used" : "31960", - "percent" : "7%", - "size" : "495844", - "type" : "ext4", - "mountpoint" : "/boot" - }, - { - "available" : "191426876", - "device" : "vagrant", - "used" : "295661344", - "percent" : "61%", - "size" : "487088220", - "type" : "vboxsf", - "mountpoint" : "/vagrant" - } - ], - "host_health_report" : "", - "host_name" : "c6401.ambari.apache.org", - "host_state" : "HEALTHY", - "host_status" : "HEALTHY", - "ip" : "192.168.64.101", - "last_agent_env" : { - "stackFoldersAndFiles" : [ ], - "alternatives" : [ ], - "existingUsers" : [ ], - "existingRepos" : [ ], - "installedPackages" : [ ], - "hostHealth" : { - "activeJavaProcs" : [ ], - "agentTimeStampAtReporting" : 1445290054919, - "serverTimeStampAtReporting" : 1445290054980, - "liveServices" : [ - { - "desc" : "", - "name" : "ntpd", - "status" : "Healthy" - } - ] - }, - "umask" : 18, - "transparentHugePage" : "always", - "firewallRunning" : false, - "firewallName" : "iptables", - "reverseLookup" : true - }, - "last_heartbeat_time" : 1445290077648, - "last_registration_time" : 1445289898391, - "os_arch" : "x86_64", - "os_family" : "redhat6", - "os_type" : "centos6", - "ph_cpu_count" : 1, - "public_host_name" : "c6401.ambari.apache.org", - "rack_info" : "/default-rack", - "recovery_report" : { - "summary" : "DISABLED", - "component_reports" : [ ] - }, - "recovery_summary" : "DISABLED", - "total_mem" : 2956916 - } - }, - { - "href" : "/api/v1/hosts/c6402.ambari.apache.org", - "Hosts" : { - "cpu_count" : 1, - "desired_configs" : null, - "disk_info" : [ - { - "available" : "482615388", - "device" : "/dev/mapper/VolGroup-lv_root", - "used" : "4298468", - "percent" : "1%", - "size" : "512971376", - "type" : "ext4", - "mountpoint" : "/" - }, - { - "available" : "1478456", - "device" : "tmpfs", - "used" : "0", - "percent" : "0%", - "size" : "1478456", - "type" : "tmpfs", - "mountpoint" : "/dev/shm" - }, - { - "available" : "438284", - "device" : "/dev/sda1", - "used" : "31960", - "percent" : "7%", - "size" : "495844", - "type" : "ext4", - "mountpoint" : "/boot" - }, - { - "available" : "191430912", - "device" : "vagrant", - "used" : "295657308", - "percent" : "61%", - "size" : "487088220", - "type" : "vboxsf", - "mountpoint" : "/vagrant" - } - ], - "host_health_report" : "", - "host_name" : "c6402.ambari.apache.org", - "host_state" : "HEALTHY", - "host_status" : "HEALTHY", - "ip" : "192.168.64.102", - "last_agent_env" : { - "stackFoldersAndFiles" : [ ], - "alternatives" : [ ], - "existingUsers" : [ ], - "existingRepos" : [ ], - "installedPackages" : [ ], - "hostHealth" : { - "activeJavaProcs" : [ ], - "agentTimeStampAtReporting" : 1445290076132, - "serverTimeStampAtReporting" : 1445290076343, - "liveServices" : [ - { - "desc" : "", - "name" : "ntpd", - "status" : "Healthy" - } - ] - }, - "umask" : 18, - "transparentHugePage" : "always", - "firewallRunning" : false, - "firewallName" : "iptables", - "reverseLookup" : true - }, - "last_heartbeat_time" : 1445290086404, - "last_registration_time" : 1445290032489, - "os_arch" : "x86_64", - "os_family" : "redhat6", - "os_type" : "centos6", - "ph_cpu_count" : 1, - "public_host_name" : "c6402.ambari.apache.org", - "rack_info" : "/default-rack", - "recovery_report" : { - "summary" : "DISABLED", - "component_reports" : [ ] - }, - "recovery_summary" : "DISABLED", - "total_mem" : 2956916 - } - }, - { - "href" : "/api/v1/hosts/c6403.ambari.apache.org", - "Hosts" : { - "cpu_count" : 1, - "desired_configs" : null, - "disk_info" : [ - { - "available" : "482615388", - "device" : "/dev/mapper/VolGroup-lv_root", - "used" : "4298468", - "percent" : "1%", - "size" : "512971376", - "type" : "ext4", - "mountpoint" : "/" - }, - { - "available" : "1478456", - "device" : "tmpfs", - "used" : "0", - "percent" : "0%", - "size" : "1478456", - "type" : "tmpfs", - "mountpoint" : "/dev/shm" - }, - { - "available" : "438284", - "device" : "/dev/sda1", - "used" : "31960", - "percent" : "7%", - "size" : "495844", - "type" : "ext4", - "mountpoint" : "/boot" - }, - { - "available" : "191430912", - "device" : "vagrant", - "used" : "295657308", - "percent" : "61%", - "size" : "487088220", - "type" : "vboxsf", - "mountpoint" : "/vagrant" - } - ], - "host_health_report" : "", - "host_name" : "c6403.ambari.apache.org", - "host_state" : "HEALTHY", - "host_status" : "HEALTHY", - "ip" : "192.168.64.103", - "last_agent_env" : { - "stackFoldersAndFiles" : [ ], - "alternatives" : [ ], - "existingUsers" : [ ], - "existingRepos" : [ ], - "installedPackages" : [ ], - "hostHealth" : { - "activeJavaProcs" : [ ], - "agentTimeStampAtReporting" : 1445290073223, - "serverTimeStampAtReporting" : 1445290073435, - "liveServices" : [ - { - "desc" : "", - "name" : "ntpd", - "status" : "Healthy" - } - ] - }, - "umask" : 18, - "transparentHugePage" : "always", - "firewallRunning" : false, - "firewallName" : "iptables", - "reverseLookup" : true - }, - "last_heartbeat_time" : 1445290083492, - "last_registration_time" : 1445290030522, - "os_arch" : "x86_64", - "os_family" : "redhat6", - "os_type" : "centos6", - "ph_cpu_count" : 1, - "public_host_name" : "c6403.ambari.apache.org", - "rack_info" : "/default-rack", - "recovery_report" : { - "summary" : "DISABLED", - "component_reports" : [ ] - }, - "recovery_summary" : "DISABLED", - "total_mem" : 2956916 - } - } - ] -} \ No newline at end of file