Repository: ambari
Updated Branches:
  refs/heads/trunk f898c0479 -> 23b7c1108


http://git-wip-us.apache.org/repos/asf/ambari/blob/23b7c110/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
 
b/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
deleted file mode 100644
index dabaaf6..0000000
--- 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
+++ /dev/null
@@ -1,40 +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 MagicMock, call, patch
-from stacks.utils.RMFTestCase import *
-
-
-@patch("os.path.exists", new = MagicMock(return_value=True))
-class TestHookAfterInstall(RMFTestCase):
-  def test_hook_default(self):
-    self.executeScript("1.3.2/hooks/after-INSTALL/scripts/hook.py",
-                       classname="AfterInstallHook",
-                       command="hook",
-                       config_file="default.json"
-    )
-    self.assertResourceCalled('XmlConfig', 'core-site.xml',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              conf_dir = '/etc/hadoop/conf',
-                              configurations = 
self.getConfig()['configurations']['core-site'],
-                              configuration_attributes = 
self.getConfig()['configuration_attributes']['core-site']
-                              )
-    self.assertNoMoreResources()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/23b7c110/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
 
b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
deleted file mode 100644
index 77ef139..0000000
--- 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
+++ /dev/null
@@ -1,157 +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 *
-from mock.mock import MagicMock, call, patch
-from resource_management import Hook
-
[email protected](Hook, "run_custom_hook", new = MagicMock())
-class TestHookBeforeInstall(RMFTestCase):
-  def test_hook_default(self):
-    self.executeScript("1.3.2/hooks/before-ANY/scripts/hook.py",
-                       classname="BeforeAnyHook",
-                       command="hook",
-                       config_file="default.json"
-    )
-    self.assertResourceCalled('Execute', 'mkdir -p /tmp/AMBARI-artifacts/;     
curl -kf -x "" --retry 10     
http://c6401.ambari.apache.org:8080/resources//UnlimitedJCEPolicyJDK7.zip -o 
/tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip',
-        environment = {'no_proxy': 'c6401.ambari.apache.org'},
-        not_if = 'test -e /tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip',
-        ignore_failures = True,
-        path = ['/bin', '/usr/bin/'],
-    )
-    self.assertResourceCalled('Group', 'hadoop',
-        ignore_failures = False,
-    )
-    self.assertResourceCalled('Group', 'nobody',
-        ignore_failures = False,
-    )
-    self.assertResourceCalled('Group', 'users',
-        ignore_failures = False,
-    )
-    self.assertResourceCalled('User', 'hive',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'oozie',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'nobody',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'nobody'],
-    )
-    self.assertResourceCalled('User', 'ambari-qa',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'users'],
-    )
-    self.assertResourceCalled('User', 'flume',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'hdfs',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'storm',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'mapred',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'hbase',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'tez',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'zookeeper',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'falcon',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'sqoop',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'yarn',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('User', 'hcat',
-        gid = 'hadoop',
-        ignore_failures = False,
-        groups = [u'hadoop'],
-    )
-    self.assertResourceCalled('File', '/tmp/changeUid.sh',
-        content = StaticFile('changeToSecureUid.sh'),
-        mode = 0555,
-    )
-    self.assertResourceCalled('Execute', '/tmp/changeUid.sh ambari-qa 
/tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa',
-        not_if = 'test $(id -u ambari-qa) -gt 1000',
-    )
-    self.assertResourceCalled('File', '/tmp/changeUid.sh',
-        content = StaticFile('changeToSecureUid.sh'),
-        mode = 0555,
-    )
-    self.assertResourceCalled('Execute', '/tmp/changeUid.sh hbase 
/home/hbase,/tmp/hbase,/usr/bin/hbase,/var/log/hbase,/hadoop/hbase',
-        not_if = 'test $(id -u hbase) -gt 1000',
-    )
-    self.assertResourceCalled('Directory', '/etc/hadoop/conf.empty',
-        owner = 'root',
-        group = 'root',
-        recursive = True,
-    )
-    self.assertResourceCalled('Link', '/etc/hadoop/conf',
-        not_if = 'ls /etc/hadoop/conf',
-        to = '/etc/hadoop/conf.empty',
-    )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
-        content = 
InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
-        owner = 'hdfs',
-    )
-    self.assertResourceCalled('XmlConfig', 'core-site.xml',
-        owner = 'hdfs',
-        group = 'hadoop',
-        conf_dir = '/etc/hadoop/conf',
-        configuration_attributes = 
self.getConfig()['configuration_attributes']['core-site'],
-        configurations = self.getConfig()['configurations']['core-site'],
-    )
-    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/23b7c110/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
 
b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
deleted file mode 100644
index 17a0ed8..0000000
--- 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
+++ /dev/null
@@ -1,55 +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 *
-from mock.mock import MagicMock, call, patch
-from resource_management import *
-
[email protected](Hook, "run_custom_hook", new = MagicMock())
-class TestHookBeforeInstall(RMFTestCase):
-  def test_hook_default(self):
-    self.executeScript("1.3.2/hooks/before-INSTALL/scripts/hook.py",
-                       classname="BeforeInstallHook",
-                       command="hook",
-                       config_file="default.json"
-    )
-    self.assertResourceCalled('Repository', 'HDP-1.3.4',
-        action=['create'],
-        
base_url='http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.3.0',
-        components=['HDP', 'main'],
-        mirror_list=None,
-        repo_file_name='HDP',
-        repo_template='repo_suse_rhel.j2'
-    )
-    self.assertResourceCalled('Execute', 'mkdir -p /tmp/AMBARI-artifacts/ ; 
curl -kf -x \"\" --retry 10 
http://c6401.ambari.apache.org:8080/resources//jdk-7u67-linux-x64.tar.gz -o 
/tmp/AMBARI-artifacts//jdk-7u67-linux-x64.tar.gz',
-        not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
-        path = ['/bin', '/usr/bin/'],
-        environment = {'no_proxy': 'c6401.ambari.apache.org'}
-    )
-    self.assertResourceCalled('Directory', '/usr/jdk64',)
-    self.assertResourceCalled('Execute', ('chmod', 'a+x', u'/usr/jdk64'),
-        not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
-        sudo = True,
-    )
-    self.assertResourceCalled('Execute', 'mkdir -p /tmp/jdk && cd /tmp/jdk && 
tar -xf /tmp/AMBARI-artifacts//jdk-7u67-linux-x64.tar.gz && sudo cp -r 
/tmp/jdk/* /usr/jdk64',
-        not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
-    )
-    self.assertResourceCalled('Package', 'unzip',)
-    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/23b7c110/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py
 
b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py
deleted file mode 100644
index fc45b8f..0000000
--- 
a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py
+++ /dev/null
@@ -1,217 +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 *
-from mock.mock import MagicMock, call, patch
-from resource_management import Hook
-import json
-
-@patch("os.path.exists", new = MagicMock(return_value=True))
[email protected](Hook, "run_custom_hook")
-class TestHookBeforeStart(RMFTestCase):
-  def test_hook_default(self, mockHook):
-
-    self.executeScript("1.3.2/hooks/before-START/scripts/hook.py",
-                       classname="BeforeStartHook",
-                       command="hook",
-                       config_file="default.json"
-    )
-    self.assertResourceCalled('Execute', '/bin/echo 0 > /selinux/enforce',
-                              only_if = 'test -f /selinux/enforce',
-                              )
-    self.assertResourceCalled('Directory', '/var/log/hadoop',
-                              owner = 'root',
-                              group = 'hadoop',
-                              mode = 0775,
-                              recursive = True,
-                              )
-    self.assertResourceCalled('Directory', '/var/run/hadoop',
-                            owner = 'root',
-                            group = 'root',
-                            recursive = True,
-                            )
-    self.assertResourceCalled('File', 
'/etc/hadoop/conf/commons-logging.properties',
-                              content = 
Template('commons-logging.properties.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/health_check',
-                              content = Template('health_check.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/log4j.properties',
-                              content = 
'log4jproperties\nline2log4jproperties\nline2\nambari.jobhistory.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nambari.jobhistory.driver=org.postgresql.Driver\nambari.jobhistory.user=mapred\nambari.jobhistory.password=mapred\nambari.jobhistory.logger=${hadoop.root.logger}\n\nlog4j.appender.JHA=org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.JobHistoryAppender\nlog4j.appender.JHA.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nlog4j.appender.JHA.driver=org.postgresql.Driver\nlog4j.appender.JHA.user=mapred\nlog4j.appender.JHA.password=mapred\n\nlog4j.logger.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=DEBUG,JHA\nlog4j.additivity.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=true\n\n',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              mode = 0644,
-    )
-    self.assertResourceCalled('File', 
'/etc/hadoop/conf/hadoop-metrics2.properties',
-                              content = 
Template('hadoop-metrics2.properties.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/task-log4j.properties',
-                              content = StaticFile('task-log4j.properties'),
-                              mode = 0755,
-                              )
-    self.assertResourceCalled('Link', '/usr/lib/hadoop/lib/hadoop-tools.jar',
-                              to = '/usr/lib/hadoop/hadoop-tools.jar',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/configuration.xsl',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/masters',
-      owner = 'hdfs',
-      group = 'hadoop',
-    )
-    self.assertNoMoreResources()
-
-  def test_hook_secured(self, mockHook):
-    self.executeScript("1.3.2/hooks/before-START/scripts/hook.py",
-                       classname="BeforeStartHook",
-                       command="hook",
-                       config_file="secured.json"
-    )
-    self.assertResourceCalled('Execute', '/bin/echo 0 > /selinux/enforce',
-                              only_if = 'test -f /selinux/enforce',
-                              )
-    self.assertResourceCalled('Directory', '/var/log/hadoop',
-                              owner = 'root',
-                              group = 'hadoop',
-                              mode = 0775,
-                              recursive = True,
-                              )
-    self.assertResourceCalled('Directory', '/var/run/hadoop',
-                              owner = 'root',
-                              group = 'root',
-                              recursive = True,
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/health_check',
-                              content = Template('health_check.j2'),
-                              owner = 'root',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/log4j.properties',
-                              content = 'log4jproperties\nline2',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              mode = 0644,
-                              )
-    self.assertResourceCalled('File', 
'/etc/hadoop/conf/hadoop-metrics2.properties',
-                              content = 
Template('hadoop-metrics2.properties.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/task-log4j.properties',
-                              content = StaticFile('task-log4j.properties'),
-                              mode = 0755,
-                              )
-    self.assertResourceCalled('Link', '/usr/lib/hadoop/lib/hadoop-tools.jar',
-                              to = '/usr/lib/hadoop/hadoop-tools.jar',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/configuration.xsl',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/masters',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              )
-    self.assertNoMoreResources()
-
-  def test_hook_default_hdfs(self, mockHook):
-    config_file = "stacks/1.3.2/configs/default.json"
-    with open(config_file, "r") as f:
-      default_json = json.load(f)
-
-    default_json['serviceName']= 'HDFS'
-    self.executeScript("1.3.2/hooks/before-START/scripts/hook.py",
-                       classname="BeforeStartHook",
-                       command="hook",
-                       config_dict=default_json
-    )
-    self.assertResourceCalled('Execute', '/bin/echo 0 > /selinux/enforce',
-                              only_if = 'test -f /selinux/enforce',
-                              )
-    self.assertResourceCalled('Directory', 
'/usr/lib/hadoop/lib/native/Linux-i386-32',
-        recursive = True,
-    )
-    self.assertResourceCalled('Directory', 
'/usr/lib/hadoop/lib/native/Linux-amd64-64',
-        recursive = True,
-    )
-    self.assertResourceCalled('Link', 
'/usr/lib/hadoop/lib/native/Linux-i386-32/libsnappy.so',
-        to = '/usr/lib/libsnappy.so',
-    )
-    self.assertResourceCalled('Link', 
'/usr/lib/hadoop/lib/native/Linux-amd64-64/libsnappy.so',
-        to = '/usr/lib64/libsnappy.so',
-    )
-    self.assertResourceCalled('Directory', '/var/log/hadoop',
-                              owner = 'root',
-                              group = 'hadoop',
-                              mode = 0775,
-                              recursive = True,
-                              )
-    self.assertResourceCalled('Directory', '/var/run/hadoop',
-                              owner = 'root',
-                              group = 'root',
-                              recursive = True,
-                              )
-    self.assertResourceCalled('File', 
'/etc/hadoop/conf/commons-logging.properties',
-                              content = 
Template('commons-logging.properties.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/health_check',
-                              content = Template('health_check.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/log4j.properties',
-                              content = 
'log4jproperties\nline2log4jproperties\nline2\nambari.jobhistory.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nambari.jobhistory.driver=org.postgresql.Driver\nambari.jobhistory.user=mapred\nambari.jobhistory.password=mapred\nambari.jobhistory.logger=${hadoop.root.logger}\n\nlog4j.appender.JHA=org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.JobHistoryAppender\nlog4j.appender.JHA.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nlog4j.appender.JHA.driver=org.postgresql.Driver\nlog4j.appender.JHA.user=mapred\nlog4j.appender.JHA.password=mapred\n\nlog4j.logger.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=DEBUG,JHA\nlog4j.additivity.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=true\n\n',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              mode = 0644,
-                              )
-    self.assertResourceCalled('File', 
'/etc/hadoop/conf/hadoop-metrics2.properties',
-                              content = 
Template('hadoop-metrics2.properties.j2'),
-                              owner = 'hdfs',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/task-log4j.properties',
-                              content = StaticFile('task-log4j.properties'),
-                              mode = 0755,
-                              )
-    self.assertResourceCalled('Link', '/usr/lib/hadoop/lib/hadoop-tools.jar',
-                              to = '/usr/lib/hadoop/hadoop-tools.jar',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/configuration.xsl',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              )
-    self.assertResourceCalled('File', '/etc/hadoop/conf/masters',
-                              owner = 'hdfs',
-                              group = 'hadoop',
-                              )
-    self.assertNoMoreResources()
-    
-def test_that_jce_is_required_in_secured_cluster(self):
-  try:
-    self.executeScript("2.0.6/hooks/before-START/scripts/hook.py",
-                       classname="BeforeStartHook",
-                       command="hook",
-                       config_file="secured_no_jce_name.json"
-    )
-    self.fail("Should throw an exception")
-  except Fail:
-    pass  # Expected

Reply via email to