You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/01/28 13:48:31 UTC

[2/2] git commit: AMBARI-4434. Add unittets for service_check for YARN, ZK, WEBHCAT, HIVE (Arsen Babych via aonishuk)

AMBARI-4434. Add unittets for service_check for YARN, ZK, WEBHCAT, HIVE
(Arsen Babych via aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/37118617
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/37118617
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/37118617

Branch: refs/heads/trunk
Commit: 371186173be89985c5d2ad4c33fe74c2a4741d88
Parents: 2aad5bb
Author: Andrew Onischuk <ao...@hortonworks.com>
Authored: Fri Jan 17 03:53:59 2014 -0800
Committer: Andrew Onischuk <ao...@hortonworks.com>
Committed: Fri Jan 17 03:53:59 2014 -0800

----------------------------------------------------------------------
 .../HIVE/package/scripts/hcat_service_check.py  |   1 +
 .../HIVE/package/scripts/hcat_service_check.py  |   2 +-
 .../1.3.3/HIVE/test_hive_service_check.py       | 117 +++++++++++++++++++
 .../1.3.3/WEBHCAT/test_webhcat_service_check.py |  61 ++++++++++
 .../ZOOKEEPER/test_zookeeper_service_check.py   |  61 ++++++++++
 .../2.1.1/HIVE/test_hive_service_check.py       | 117 +++++++++++++++++++
 .../2.1.1/WEBHCAT/test_webhcat_service_check.py |  61 ++++++++++
 .../2.1.1/YARN/test_mapreduce2_service_check.py |  90 ++++++++++++++
 .../2.1.1/YARN/test_yarn_service_check.py       |  68 +++++++++++
 .../ZOOKEEPER/test_zookeeper_service_check.py   |  61 ++++++++++
 10 files changed, 638 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/hcat_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/hcat_service_check.py b/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/hcat_service_check.py
index 5112e99..3886c33 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/hcat_service_check.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/hcat_service_check.py
@@ -19,6 +19,7 @@ limitations under the License.
 """
 
 from resource_management import *
+from resource_management.libraries.functions import get_unique_id_and_date
 
 def hcat_service_check():
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/hcat_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/hcat_service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/hcat_service_check.py
index 5112e99..bc75e44 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/hcat_service_check.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/hcat_service_check.py
@@ -19,10 +19,10 @@ limitations under the License.
 """
 
 from resource_management import *
+from resource_management.libraries.functions import get_unique_id_and_date
 
 def hcat_service_check():
     import params
-
     unique = get_unique_id_and_date()
     output_file = format("/apps/hive/warehouse/hcatsmoke{unique}")
     test_cmd = format("fs -test -e {output_file}")

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/1.3.3/HIVE/test_hive_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/HIVE/test_hive_service_check.py b/ambari-server/src/test/python/stacks/1.3.3/HIVE/test_hive_service_check.py
new file mode 100644
index 0000000..c5af2a6
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/HIVE/test_hive_service_check.py
@@ -0,0 +1,117 @@
+#!/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 *
+import datetime
+import  resource_management.libraries.functions
+@patch.object(resource_management.libraries.functions, "get_unique_id_and_date", new = MagicMock(return_value=''))
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("1.3.3/services/HIVE/package/scripts/service_check.py",
+                        classname="HiveServiceCheck",
+                        command="service_check",
+                        config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2Smoke.sh',
+                        content = StaticFile('hiveserver2Smoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2.sql',
+                        content = StaticFile('hiveserver2.sql'),
+    )
+    self.assertResourceCalled('Execute', "env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/hiveserver2Smoke.sh jdbc:hive2://[u'c6402.ambari.apache.org']:10000 /tmp/hiveserver2.sql",
+                        logoutput = True,
+                        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('File', '/tmp/hcatSmoke.sh',
+                        content = StaticFile('hcatSmoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/hcatSmoke.sh hcatsmoke prepare',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /apps/hive/warehouse/hcatsmoke',
+                        logoutput = True,
+                        user = 'hdfs',
+                        conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/hcatSmoke.sh hcatsmoke cleanup',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("1.3.3/services/HIVE/package/scripts/service_check.py",
+                        classname="HiveServiceCheck",
+                        command="service_check",
+                        config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2Smoke.sh',
+                        content = StaticFile('hiveserver2Smoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2.sql',
+                        content = StaticFile('hiveserver2.sql'),
+    )
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/hiveserver2Smoke.sh jdbc:hive2://[u'c6402.ambari.apache.org']:10000/\\;principal=/etc/security/keytabs/hive.service.keytab /tmp/hiveserver2.sql",
+                        logoutput = True,
+                        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('File', '/tmp/hcatSmoke.sh',
+                        content = StaticFile('hcatSmoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; sh /tmp/hcatSmoke.sh hcatsmoke prepare',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /apps/hive/warehouse/hcatsmoke',
+                        logoutput = True,
+                        user = 'hdfs',
+                        conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; sh /tmp/hcatSmoke.sh hcatsmoke cleanup',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/1.3.3/WEBHCAT/test_webhcat_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/WEBHCAT/test_webhcat_service_check.py b/ambari-server/src/test/python/stacks/1.3.3/WEBHCAT/test_webhcat_service_check.py
new file mode 100644
index 0000000..87ff406
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/WEBHCAT/test_webhcat_service_check.py
@@ -0,0 +1,61 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("1.3.3/services/WEBHCAT/package/scripts/service_check.py",
+                       classname="WebHCatServiceCheck",
+                       command="service_check",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/templetonSmoke.sh',
+                       content = StaticFile('templetonSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/templetonSmoke.sh c6402.ambari.apache.org ambari-qa no_keytab False /usr/bin/kinit',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("1.3.3/services/WEBHCAT/package/scripts/service_check.py",
+                       classname="WebHCatServiceCheck",
+                       command="service_check",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/templetonSmoke.sh',
+                       content = StaticFile('templetonSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/templetonSmoke.sh c6402.ambari.apache.org ambari-qa /etc/security/keytabs/smokeuser.headless.keytab True /usr/bin/kinit',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/1.3.3/ZOOKEEPER/test_zookeeper_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/ZOOKEEPER/test_zookeeper_service_check.py b/ambari-server/src/test/python/stacks/1.3.3/ZOOKEEPER/test_zookeeper_service_check.py
new file mode 100644
index 0000000..8ba984c
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/ZOOKEEPER/test_zookeeper_service_check.py
@@ -0,0 +1,61 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("1.3.3/services/ZOOKEEPER/package/scripts/service_check.py",
+                       classname="ZookeeperServiceCheck",
+                       command="service_check",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/zkSmoke.sh',
+                       content = StaticFile('zkSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/zkSmoke.sh /usr/lib/zookeeper/bin/zkCli.sh ambari-qa /etc/zookeeper/conf 2181 False /usr/bin/kinit no_keytab',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("1.3.3/services/ZOOKEEPER/package/scripts/service_check.py",
+                       classname="ZookeeperServiceCheck",
+                       command="service_check",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/zkSmoke.sh',
+                       content = StaticFile('zkSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/zkSmoke.sh /usr/lib/zookeeper/bin/zkCli.sh ambari-qa /etc/zookeeper/conf 2181 True /usr/bin/kinit /etc/security/keytabs/smokeuser.headless.keytab',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/2.1.1/HIVE/test_hive_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/HIVE/test_hive_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/HIVE/test_hive_service_check.py
new file mode 100644
index 0000000..8781b0f
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/HIVE/test_hive_service_check.py
@@ -0,0 +1,117 @@
+#!/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 *
+import datetime
+import  resource_management.libraries.functions
+@patch.object(resource_management.libraries.functions, "get_unique_id_and_date", new = MagicMock(return_value=''))
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("2.1.1/services/HIVE/package/scripts/service_check.py",
+                        classname="HiveServiceCheck",
+                        command="service_check",
+                        config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2Smoke.sh',
+                        content = StaticFile('hiveserver2Smoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2.sql',
+                        content = StaticFile('hiveserver2.sql'),
+    )
+    self.assertResourceCalled('Execute', "env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/hiveserver2Smoke.sh jdbc:hive2://[u'c6402.ambari.apache.org']:10000 /tmp/hiveserver2.sql",
+                        logoutput = True,
+                        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('File', '/tmp/hcatSmoke.sh',
+                        content = StaticFile('hcatSmoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/hcatSmoke.sh hcatsmoke prepare',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /apps/hive/warehouse/hcatsmoke',
+                        logoutput = True,
+                        user = 'hdfs',
+                        conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/hcatSmoke.sh hcatsmoke cleanup',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("2.1.1/services/HIVE/package/scripts/service_check.py",
+                        classname="HiveServiceCheck",
+                        command="service_check",
+                        config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2Smoke.sh',
+                        content = StaticFile('hiveserver2Smoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('File', '/tmp/hiveserver2.sql',
+                        content = StaticFile('hiveserver2.sql'),
+    )
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/hiveserver2Smoke.sh jdbc:hive2://[u'c6402.ambari.apache.org']:10000/\\;principal=/etc/security/keytabs/hive.service.keytab /tmp/hiveserver2.sql",
+                        logoutput = True,
+                        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('File', '/tmp/hcatSmoke.sh',
+                        content = StaticFile('hcatSmoke.sh'),
+                        mode = 493,
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; sh /tmp/hcatSmoke.sh hcatsmoke prepare',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /apps/hive/warehouse/hcatsmoke',
+                        logoutput = True,
+                        user = 'hdfs',
+                        conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; sh /tmp/hcatSmoke.sh hcatsmoke cleanup',
+                        logoutput = True,
+                        path = ['/usr/sbin', '/usr/local/nin', '/bin', '/usr/bin'],
+                        tries = 3,
+                        user = 'ambari-qa',
+                        try_sleep = 5,
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/2.1.1/WEBHCAT/test_webhcat_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/WEBHCAT/test_webhcat_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/WEBHCAT/test_webhcat_service_check.py
new file mode 100644
index 0000000..91befcc
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/WEBHCAT/test_webhcat_service_check.py
@@ -0,0 +1,61 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("2.1.1/services/WEBHCAT/package/scripts/service_check.py",
+                       classname="WebHCatServiceCheck",
+                       command="service_check",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/templetonSmoke.sh',
+                       content = StaticFile('templetonSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/templetonSmoke.sh c6402.ambari.apache.org ambari-qa no_keytab False /usr/bin/kinit',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("2.1.1/services/WEBHCAT/package/scripts/service_check.py",
+                       classname="WebHCatServiceCheck",
+                       command="service_check",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/templetonSmoke.sh',
+                       content = StaticFile('templetonSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/templetonSmoke.sh c6402.ambari.apache.org ambari-qa /etc/security/keytabs/smokeuser.headless.keytab True /usr/bin/kinit',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/2.1.1/YARN/test_mapreduce2_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/YARN/test_mapreduce2_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/YARN/test_mapreduce2_service_check.py
new file mode 100644
index 0000000..c3daa73
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/YARN/test_mapreduce2_service_check.py
@@ -0,0 +1,90 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("2.1.1/services/YARN/package/scripts/mapred_service_check.py",
+                      classname="MapReduce2ServiceCheck",
+                      command="service_check",
+                      config_file="default.json"
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -rm -r -f /user/ambari-qa/mapredsmokeoutput /user/ambari-qa/mapredsmokeinput',
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -put /etc/passwd /user/ambari-qa/mapredsmokeinput',
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples-2.*.jar wordcount /user/ambari-qa/mapredsmokeinput /user/ambari-qa/mapredsmokeoutput',
+                      logoutput = True,
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /user/ambari-qa/mapredsmokeoutput',
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("2.1.1/services/YARN/package/scripts/mapred_service_check.py",
+                      classname="MapReduce2ServiceCheck",
+                      command="service_check",
+                      config_file="secured.json"
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa;',
+                      user = 'ambari-qa',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -rm -r -f /user/ambari-qa/mapredsmokeoutput /user/ambari-qa/mapredsmokeinput',
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -put /etc/passwd /user/ambari-qa/mapredsmokeinput',
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples-2.*.jar wordcount /user/ambari-qa/mapredsmokeinput /user/ambari-qa/mapredsmokeoutput',
+                      logoutput = True,
+                      try_sleep = 5,
+                      tries = 1,
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /user/ambari-qa/mapredsmokeoutput',
+                      user = 'ambari-qa',
+                      conf_dir = '/etc/hadoop/conf',
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/2.1.1/YARN/test_yarn_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/YARN/test_yarn_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/YARN/test_yarn_service_check.py
new file mode 100644
index 0000000..ee02bb7
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/YARN/test_yarn_service_check.py
@@ -0,0 +1,68 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("2.1.1/services/YARN/package/scripts/service_check.py",
+                          classname="ServiceCheck",
+                          command="service_check",
+                          config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/validateYarnComponentStatus.py',
+                          content = StaticFile('validateYarnComponentStatus.py'),
+                          mode = 493,
+    )
+    self.assertResourceCalled('Execute', '/tmp/validateYarnComponentStatus.py rm -p c6402.ambari.apache.org:8088 -s False',
+                          logoutput = True,
+                          path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                          tries = 3,
+                          user = 'ambari-qa',
+                          try_sleep = 5,
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/yarn node -list',
+                          user = 'ambari-qa',
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+    self.executeScript("2.1.1/services/YARN/package/scripts/service_check.py",
+                          classname="ServiceCheck",
+                          command="service_check",
+                          config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/validateYarnComponentStatus.py',
+                          content = StaticFile('validateYarnComponentStatus.py'),
+                          mode = 493,
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; /tmp/validateYarnComponentStatus.py rm -p c6402.ambari.apache.org:8088 -s False',
+                          logoutput = True,
+                          path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                          tries = 3,
+                          user = 'ambari-qa',
+                          try_sleep = 5,
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/yarn node -list',
+                          user = 'ambari-qa',
+    )
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/37118617/ambari-server/src/test/python/stacks/2.1.1/ZOOKEEPER/test_zookeeper_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/ZOOKEEPER/test_zookeeper_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/ZOOKEEPER/test_zookeeper_service_check.py
new file mode 100644
index 0000000..193e3f7
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/ZOOKEEPER/test_zookeeper_service_check.py
@@ -0,0 +1,61 @@
+#!/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 *
+
+class TestServiceCheck(RMFTestCase):
+
+  def test_service_check_default(self):
+
+    self.executeScript("2.1.1/services/ZOOKEEPER/package/scripts/service_check.py",
+                       classname="ZookeeperServiceCheck",
+                       command="service_check",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/tmp/zkSmoke.sh',
+                       content = StaticFile('zkSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/zkSmoke.sh /usr/lib/zookeeper/bin/zkCli.sh ambari-qa /etc/zookeeper/conf 2181 False /usr/bin/kinit no_keytab',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()
+
+  def test_service_check_secured(self):
+
+    self.executeScript("2.1.1/services/ZOOKEEPER/package/scripts/service_check.py",
+                       classname="ZookeeperServiceCheck",
+                       command="service_check",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/tmp/zkSmoke.sh',
+                       content = StaticFile('zkSmoke.sh'),
+                       mode = 493,
+    )
+    self.assertResourceCalled('Execute', 'sh /tmp/zkSmoke.sh /usr/lib/zookeeper/bin/zkCli.sh ambari-qa /etc/zookeeper/conf 2181 True /usr/bin/kinit /etc/security/keytabs/smokeuser.headless.keytab',
+                       logoutput = True,
+                       path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+                       tries = 3,
+                       try_sleep = 5,
+    )
+    self.assertNoMoreResources()