You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2014/01/27 18:59:35 UTC
[2/2] git commit: AMBARI-4427. Unittests for hooks, GANGLIA,
FALCON and SQOOP (Eugene Chekanskiy via dlysnichenko)
AMBARI-4427. Unittests for hooks, GANGLIA, FALCON and SQOOP (Eugene Chekanskiy via dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc102b32
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc102b32
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc102b32
Branch: refs/heads/trunk
Commit: bc102b3273f3fc5809854f30a67e6844c7b10fdd
Parents: dce0e20
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Jan 27 19:58:24 2014 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Jan 27 19:58:24 2014 +0200
----------------------------------------------------------------------
.../services/GANGLIA/package/scripts/ganglia.py | 2 +-
.../FALCON/package/scripts/falcon_client.py | 8 +-
.../FALCON/package/scripts/falcon_server.py | 4 +-
.../services/GANGLIA/package/scripts/ganglia.py | 2 +-
.../GANGLIA/package/scripts/ganglia_server.py | 4 +-
.../1.3.3/GANGLIA/test_ganglia_monitor.py | 195 ++++++++++++++++
.../stacks/1.3.3/GANGLIA/test_ganglia_server.py | 226 +++++++++++++++++++
.../stacks/1.3.3/SQOOP/test_service_check.py | 48 ++++
.../python/stacks/1.3.3/SQOOP/test_sqoop.py | 52 +++++
.../hooks/before-INSTALL/test_before_install.py | 78 +++++++
.../hooks/before-START/test_before_start.py | 150 ++++++++++++
.../stacks/2.1.1/FALCON/test_falcon_client.py | 38 ++++
.../stacks/2.1.1/FALCON/test_falcon_server.py | 94 ++++++++
.../stacks/2.1.1/FALCON/test_service_check.py | 42 ++++
.../2.1.1/GANGLIA/test_ganglia_monitor.py | 169 ++++++++++++++
.../stacks/2.1.1/GANGLIA/test_ganglia_server.py | 214 ++++++++++++++++++
.../stacks/2.1.1/SQOOP/test_service_check.py | 50 ++++
.../python/stacks/2.1.1/SQOOP/test_sqoop.py | 52 +++++
.../python/stacks/2.1.1/configs/default.json | 15 +-
.../python/stacks/2.1.1/configs/secured.json | 13 +-
.../hooks/before-INSTALL/test_before_install.py | 87 +++++++
.../hooks/before-START/test_before_start.py | 157 +++++++++++++
.../src/test/python/stacks/utils/RMFTestCase.py | 5 +-
ambari-server/src/test/python/unitTests.py | 25 +-
24 files changed, 1703 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/ganglia.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/ganglia.py b/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/ganglia.py
index 1eae6d0..52b79be 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/ganglia.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/ganglia.py
@@ -72,7 +72,7 @@ def shell_file(name):
)
-def ganglia_TemplateConfig(name, mode=755, tag=None):
+def ganglia_TemplateConfig(name, mode=0755, tag=None):
import params
TemplateConfig(format("{params.ganglia_shell_cmds_dir}/{name}"),
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_client.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_client.py
index ab59b6f..fd8c005 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_client.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_client.py
@@ -22,15 +22,13 @@ from falcon import falcon
class FalconClient(Script):
def install(self, env):
- import params
-
self.install_packages(env)
- env.set_params(params)
- self.config(env)
+ self.configure(env)
- def config(self, env):
+ def configure(self, env):
import params
+ env.set_params(params)
falcon('client', action='config')
def status(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_server.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_server.py
index fa3bc40..0460460 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_server.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/FALCON/package/scripts/falcon_server.py
@@ -26,12 +26,12 @@ class FalconServer(Script):
self.install_packages(env)
env.set_params(params)
- self.config(env)
def start(self, env):
import params
env.set_params(params)
+ self.configure(env)
falcon('server', action='start')
@@ -43,7 +43,7 @@ class FalconServer(Script):
falcon('server', action='stop')
- def config(self, env):
+ def configure(self, env):
import params
env.set_params(params)
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia.py
index 75626b1..69fde27 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia.py
@@ -63,7 +63,7 @@ def shell_file(name):
)
-def ganglia_TemplateConfig(name, mode=755, tag=None):
+def ganglia_TemplateConfig(name, mode=0755, tag=None):
import params
TemplateConfig(format("{params.ganglia_shell_cmds_dir}/{name}"),
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia_server.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia_server.py
index ab730de..863f092 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia_server.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/ganglia_server.py
@@ -31,7 +31,7 @@ class GangliaServer(Script):
self.install_packages(env)
env.set_params(params)
- self.config(env)
+ self.configure(env)
def start(self, env):
import params
@@ -52,7 +52,7 @@ class GangliaServer(Script):
# Recursively check all existing gmetad pid files
check_process_status(pid_file)
- def config(self, env):
+ def configure(self, env):
import params
ganglia.groups_and_users()
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_monitor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_monitor.py b/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_monitor.py
new file mode 100644
index 0000000..8fae96a
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_monitor.py
@@ -0,0 +1,195 @@
+#!/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 *
+
+
+class TestGangliaMonitor(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Group', 'hadoop',
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ )
+ self.assertResourceCalled('User', 'nobody',
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('User', 'nobody',
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('Directory', '/etc/ganglia/hdp',
+ owner = 'root',
+ group = 'hadoop',
+ recursive = True,
+ )
+ self.assertResourceCalled('Directory', '/usr/libexec/hdp/ganglia',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmetad',
+ content = StaticFile('gmetad.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmond',
+ content = StaticFile('gmond.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkGmond.sh',
+ content = StaticFile('checkGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkRrdcached.sh',
+ content = StaticFile('checkRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmetadLib.sh',
+ content = StaticFile('gmetadLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmondLib.sh',
+ content = StaticFile('gmondLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/rrdcachedLib.sh',
+ content = StaticFile('rrdcachedLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/setupGanglia.sh',
+ content = StaticFile('setupGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmetad.sh',
+ content = StaticFile('startGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmond.sh',
+ content = StaticFile('startGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startRrdcached.sh',
+ content = StaticFile('startRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmetad.sh',
+ content = StaticFile('stopGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmond.sh',
+ content = StaticFile('stopGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopRrdcached.sh',
+ content = StaticFile('stopRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/teardownGanglia.sh',
+ content = StaticFile('teardownGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaClusters.conf',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaEnv.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaLib.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPJobTracker -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHistoryServer -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPSlaves -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Directory', '/etc/ganglia/conf.d',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/conf.d/modgstatus.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/conf.d/multicpu.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/gmond.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertNoMoreResources()
+
+ def test_start_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="start",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'chkconfig gmond off',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmond start >> /tmp/gmond.log 2>&1 ; /bin/ps auwx | /bin/grep [g]mond >> /tmp/gmond.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertNoMoreResources()
+
+ def test_stop_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="stop",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmond stop >> /tmp/gmond.log 2>&1 ; /bin/ps auwx | /bin/grep [g]mond >> /tmp/gmond.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_server.py b/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_server.py
new file mode 100644
index 0000000..3314f10
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/GANGLIA/test_ganglia_server.py
@@ -0,0 +1,226 @@
+#!/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 *
+
+
+class TestGangliaServer(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Group', 'hadoop',
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ )
+ self.assertResourceCalled('User', 'nobody',
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('User', 'nobody',
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('Directory', '/usr/libexec/hdp/ganglia',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmetad',
+ content = StaticFile('gmetad.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmond',
+ content = StaticFile('gmond.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkGmond.sh',
+ content = StaticFile('checkGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkRrdcached.sh',
+ content = StaticFile('checkRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmetadLib.sh',
+ content = StaticFile('gmetadLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmondLib.sh',
+ content = StaticFile('gmondLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/rrdcachedLib.sh',
+ content = StaticFile('rrdcachedLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/setupGanglia.sh',
+ content = StaticFile('setupGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmetad.sh',
+ content = StaticFile('startGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmond.sh',
+ content = StaticFile('startGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startRrdcached.sh',
+ content = StaticFile('startRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmetad.sh',
+ content = StaticFile('stopGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmond.sh',
+ content = StaticFile('stopGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopRrdcached.sh',
+ content = StaticFile('stopRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/teardownGanglia.sh',
+ content = StaticFile('teardownGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaClusters.conf',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaEnv.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaLib.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPNameNode -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPJobTracker -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHBaseMaster -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHistoryServer -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPDataNode -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPTaskTracker -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHBaseRegionServer -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -t -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Directory', '/var/lib/ganglia/dwoo',
+ owner = 'nobody',
+ recursive = True,
+ mode = 0777,
+ )
+ self.assertResourceCalled('Directory', '/srv/www/cgi-bin',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/srv/www/cgi-bin/rrd.py',
+ content = StaticFile('rrd.py'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertNoMoreResources()
+
+ def test_start_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="start",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmetad start >> /tmp/gmetad.log 2>&1 ; /bin/ps auwx | /bin/grep [g]metad >> /tmp/gmetad.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('MonitorWebserver', 'restart',
+ )
+ self.assertNoMoreResources()
+
+ def test_stop_default(self):
+ self.executeScript("1.3.3/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="stop",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmetad stop >> /tmp/gmetad.log 2>&1 ; /bin/ps auwx | /bin/grep [g]metad >> /tmp/gmetad.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('MonitorWebserver', 'restart',
+ )
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_service_check.py b/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_service_check.py
new file mode 100644
index 0000000..87bc826
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_service_check.py
@@ -0,0 +1,48 @@
+#!/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 TestSqoopServiceCheck(RMFTestCase):
+
+ def test_service_check_secured(self):
+ self.executeScript("1.3.3/services/SQOOP/package/scripts/service_check.py",
+ classname = "SqoopServiceCheck",
+ command = "service_check",
+ config_file="secured.json")
+ self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa',)
+ self.assertResourceCalled('Execute', 'sqoop version',
+ logoutput = True,
+ user = 'ambari-qa',)
+ self.assertNoMoreResources()
+
+ def test_service_check_default(self):
+ self.executeScript("1.3.3/services/SQOOP/package/scripts/service_check.py",
+ classname = "SqoopServiceCheck",
+ command = "service_check",
+ config_file="default.json")
+ self.assertResourceCalled('Execute', 'sqoop version',
+ logoutput = True,
+ user = 'ambari-qa',)
+ self.assertNoMoreResources()
+
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_sqoop.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_sqoop.py b/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_sqoop.py
new file mode 100644
index 0000000..92c0d17
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/SQOOP/test_sqoop.py
@@ -0,0 +1,52 @@
+#!/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 TestSqoop(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("1.3.3/services/SQOOP/package/scripts/sqoop_client.py",
+ classname = "SqoopClient",
+ command = "configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Link', '/usr/lib/sqoop/lib/mysql-connector-java.jar',
+ to = '/usr/share/java/mysql-connector-java.jar',)
+ self.assertResourceCalled('Directory', '/usr/lib/sqoop/conf',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('TemplateConfig', '/usr/lib/sqoop/conf/sqoop-env.sh',
+ owner = 'sqoop',
+ template_tag = None,)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-env-template.sh',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-site-template.xml',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-site.xml',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertNoMoreResources()
+
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/hooks/before-INSTALL/test_before_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/1.3.3/hooks/before-INSTALL/test_before_install.py
new file mode 100644
index 0000000..4b385bb
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/hooks/before-INSTALL/test_before_install.py
@@ -0,0 +1,78 @@
+#!/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 *
+
+
+class TestHookBeforeInstall(RMFTestCase):
+ def test_hook_default(self):
+ self.executeScript("1.3.3/hooks/before-INSTALL/scripts/hook.py",
+ classname="BeforeConfigureHook",
+ command="hook",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Group', 'hadoop',)
+ self.assertResourceCalled('Group', 'users',)
+ self.assertResourceCalled('Group', 'users',)
+ self.assertResourceCalled('User', 'ambari-qa',
+ gid='hadoop',
+ groups=[u'users'],)
+ 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 2>/dev/null',
+ not_if='test $(id -u ambari-qa) -gt 1000',)
+ self.assertResourceCalled('User', 'hbase',
+ gid='hadoop',
+ groups=[u'hadoop'],)
+ 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 2>/dev/null',
+ not_if='test $(id -u hbase) -gt 1000',)
+ self.assertResourceCalled('Group', 'nagios',)
+ self.assertResourceCalled('User', 'nagios', gid='nagios',)
+ self.assertResourceCalled('User', 'oozie', gid='hadoop',)
+ self.assertResourceCalled('User', 'hcat', gid='hadoop',)
+ self.assertResourceCalled('User', 'hcat', gid='hadoop',)
+ self.assertResourceCalled('User', 'hive',
+ gid='hadoop',)
+ self.assertResourceCalled('Group', 'nobody',)
+ self.assertResourceCalled('Group', 'nobody',)
+ self.assertResourceCalled('User', 'nobody',
+ gid='hadoop',
+ groups=[u'nobody'],)
+ self.assertResourceCalled('User', 'nobody',
+ gid='hadoop',
+ groups=[u'nobody'],)
+ self.assertResourceCalled('User', 'hdfs',
+ gid='hadoop',
+ groups=[u'hadoop'],)
+ self.assertResourceCalled('User', 'mapred',
+ gid='hadoop',
+ groups=[u'hadoop'],)
+ self.assertResourceCalled('User', 'zookeeper',
+ gid='hadoop',)
+ self.assertResourceCalled('Package', 'unzip',)
+ self.assertResourceCalled('Package', 'net-snmp',)
+ self.assertResourceCalled('Package', 'net-snmp-utils',)
+ self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/1.3.3/hooks/before-START/test_before_start.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.3/hooks/before-START/test_before_start.py b/ambari-server/src/test/python/stacks/1.3.3/hooks/before-START/test_before_start.py
new file mode 100644
index 0000000..6829655
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/1.3.3/hooks/before-START/test_before_start.py
@@ -0,0 +1,150 @@
+#!/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 *
+
+class TestHookBeforeStart(RMFTestCase):
+ def test_hook_default(self):
+ self.executeScript("1.3.3/hooks/before-START/scripts/hook.py",
+ classname="BeforeConfigureHook",
+ command="hook",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'mkdir -p /tmp/HDP-artifacts/ ; curl -kf --retry 10 http://c6401.ambari.apache.org:8080/resources//jdk-7u45-linux-x64.tar.gz -o /tmp/HDP-artifacts//jdk-7u45-linux-x64.tar.gz',
+ not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
+ path = ['/bin', '/usr/bin/'],
+ )
+ self.assertResourceCalled('Execute', 'mkdir -p /usr/jdk64 ; cd /usr/jdk64 ; tar -xf /tmp/HDP-artifacts//jdk-7u45-linux-x64.tar.gz > /dev/null 2>&1',
+ not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
+ path = ['/bin', '/usr/bin/'],
+ )
+ self.assertResourceCalled('Execute', 'mkdir -p /tmp/HDP-artifacts/; curl -kf --retry 10 http://c6401.ambari.apache.org:8080/resources//UnlimitedJCEPolicyJDK7.zip -o /tmp/HDP-artifacts//UnlimitedJCEPolicyJDK7.zip',
+ not_if = 'test -e /tmp/HDP-artifacts//UnlimitedJCEPolicyJDK7.zip',
+ ignore_failures = True,
+ path = ['/bin', '/usr/bin/'],
+ )
+ self.assertResourceCalled('File', '/etc/snmp/snmpd.conf',
+ content = Template('snmpd.conf.j2'),
+ )
+ self.assertResourceCalled('Service', 'snmpd',
+ action = ['restart'],
+ )
+ self.assertResourceCalled('Execute', '/bin/echo 0 > /selinux/enforce',
+ only_if = 'test -f /selinux/enforce',
+ )
+ self.assertResourceCalled('Execute', 'mkdir -p /usr/lib/hadoop/lib/native/Linux-i386-32; ln -sf /usr/lib/libsnappy.so /usr/lib/hadoop/lib/native/Linux-i386-32/libsnappy.so',
+ )
+ self.assertResourceCalled('Execute', 'mkdir -p /usr/lib/hadoop/lib/native/Linux-amd64-64; ln -sf /usr/lib64/libsnappy.so /usr/lib/hadoop/lib/native/Linux-amd64-64/libsnappy.so',
+ )
+ self.assertResourceCalled('Directory', '/etc/hadoop/conf',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('Directory', '/var/log/hadoop',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('Directory', '/var/run/hadoop',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/etc/security/limits.d/hdfs.conf',
+ content = Template('hdfs.conf.j2'),
+ owner = 'root',
+ group = 'root',
+ mode = 0644,
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/taskcontroller.cfg',
+ content = Template('taskcontroller.cfg.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
+ content = Template('hadoop-env.sh.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/commons-logging.properties',
+ content = Template('commons-logging.properties.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/slaves',
+ content = Template('slaves.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/health_check',
+ content = Template('health_check.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?ambari.jobhistory.driver=.*~ambari.jobhistory.driver=org.postgresql.Driver~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.appender.JHA=.*~log4j.appender.JHA=org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.JobHistoryAppender~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.appender.JHA.driver=.*~log4j.appender.JHA.driver=${ambari.jobhistory.driver}~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.appender.JHA.database=.*~log4j.appender.JHA.database=${ambari.jobhistory.database}~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?ambari.jobhistory.logger=.*~ambari.jobhistory.logger=DEBUG,JHA~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.appender.JHA.password=.*~log4j.appender.JHA.password=${ambari.jobhistory.password}~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?ambari.jobhistory.database=.*~ambari.jobhistory.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.additivity.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=.*~log4j.additivity.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=true~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.logger.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=.*~log4j.logger.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=${ambari.jobhistory.logger}~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?log4j.appender.JHA.user=.*~log4j.appender.JHA.user=${ambari.jobhistory.user}~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?ambari.jobhistory.user=.*~ambari.jobhistory.user=mapred~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('Execute', "sed -i 's~\\(###\\)\\?ambari.jobhistory.password=.*~ambari.jobhistory.password=mapred~' /etc/hadoop/conf/log4j.properties",
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-metrics2.properties',
+ content = Template('hadoop-metrics2.properties.j2'),
+ owner = 'hdfs',
+ )
+ self.assertResourceCalled('XmlConfig', 'core-site.xml',
+ owner = 'hdfs',
+ group = 'hadoop',
+ conf_dir = '/etc/hadoop/conf',
+ configurations = self.getConfig()['configurations']['core-site'],
+ )
+ self.assertResourceCalled('XmlConfig', 'mapred-site.xml',
+ owner = 'mapred',
+ group = 'hadoop',
+ conf_dir = '/etc/hadoop/conf',
+ configurations = self.getConfig()['configurations']['mapred-site'],
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/task-log4j.properties',
+ content = StaticFile('task-log4j.properties'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('XmlConfig', 'hdfs-site.xml',
+ owner = 'hdfs',
+ group = 'hadoop',
+ conf_dir = '/etc/hadoop/conf',
+ configurations = self.getConfig()['configurations']['hdfs-site'],
+ )
+ self.assertResourceCalled('Link', '/usr/lib/hadoop/lib/hadoop-tools.jar',
+ to = '/usr/lib/hadoop/hadoop-tools.jar',
+ )
+ self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_client.py b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_client.py
new file mode 100644
index 0000000..6d9eaae
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_client.py
@@ -0,0 +1,38 @@
+#!/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 *
+
+
+class TestFalconClient(RMFTestCase):
+ def test_configure_default(self):
+ self.executeScript("2.1.1/services/FALCON/package/scripts/falcon_client.py",
+ classname="FalconClient",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute',
+ 'cd /tmp; rm -f falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; wget http://public-repo-1.hortonworks.com/HDP-LABS/Projects/Falcon/2.0.6.0-76/rpm/falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; rpm -Uvh --nodeps falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm',
+ not_if='yum list installed | grep falcon', )
+
+ self.assertResourceCalled('File', '/etc/falcon/conf/client.properties',
+ content=Template('client.properties.j2'),
+ mode=0644, )
+ self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_server.py b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_server.py
new file mode 100644
index 0000000..bcf3674
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_falcon_server.py
@@ -0,0 +1,94 @@
+#!/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 *
+
+
+class TestFalconServer(RMFTestCase):
+
+ def test_start_default(self):
+ self.executeScript("2.1.1/services/FALCON/package/scripts/falcon_server.py",
+ classname="FalconServer",
+ command="start",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute',
+ 'cd /tmp; rm -f falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; wget http://public-repo-1.hortonworks.com/HDP-LABS/Projects/Falcon/2.0.6.0-76/rpm/falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; rpm -Uvh --nodeps falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm',
+ not_if='yum list installed | grep falcon', )
+ self.assertResourceCalled('Directory',
+ '/hadoop/falcon',
+ owner='falcon',
+ recursive=True, )
+ self.assertResourceCalled('Directory', '/hadoop/falcon/activemq',
+ owner='falcon',
+ recursive=True, )
+ self.assertResourceCalled('File', '/etc/falcon/conf/runtime.properties',
+ content=Template('runtime.properties.j2'),
+ mode=0644, )
+ self.assertResourceCalled('File', '/etc/falcon/conf/startup.properties',
+ content=Template('startup.properties.j2'),
+ mode=0644, )
+ self.assertResourceCalled('Execute',
+ 'cd /tmp; rm -f falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; wget http://public-repo-1.hortonworks.com/HDP-LABS/Projects/Falcon/2.0.6.0-76/rpm/falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; rpm -Uvh --nodeps falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm',
+ not_if='yum list installed | grep falcon', )
+ self.assertResourceCalled('Execute',
+ 'env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 FALCON_LOG_DIR=/var/log/falcon FALCON_PID_DIR=/var/run/falcon FALCON_DATA_DIR=/hadoop/falcon/activemq /usr/lib/falcon/bin/falcon-start -port 15000',
+ user='falcon', )
+ self.assertNoMoreResources()
+
+ def test_stop_default(self):
+ self.executeScript("2.1.1/services/FALCON/package/scripts/falcon_server.py",
+ classname="FalconServer",
+ command="stop",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute',
+ 'cd /tmp; rm -f falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; wget http://public-repo-1.hortonworks.com/HDP-LABS/Projects/Falcon/2.0.6.0-76/rpm/falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; rpm -Uvh --nodeps falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm',
+ not_if='yum list installed | grep falcon', )
+ self.assertResourceCalled('Execute',
+ 'env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 FALCON_LOG_DIR=/var/log/falcon FALCON_PID_DIR=/var/run/falcon FALCON_DATA_DIR=/hadoop/falcon/activemq /usr/lib/falcon/bin/falcon-stop',
+ user='falcon', )
+ self.assertNoMoreResources()
+
+ def test_configure_default(self):
+ self.executeScript("2.1.1/services/FALCON/package/scripts/falcon_server.py",
+ classname="FalconServer",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute',
+ 'cd /tmp; rm -f falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; wget http://public-repo-1.hortonworks.com/HDP-LABS/Projects/Falcon/2.0.6.0-76/rpm/falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm; rpm -Uvh --nodeps falcon-0.4.0.2.0.6.0-76.el6.noarch.rpm',
+ not_if='yum list installed | grep falcon', )
+ self.assertResourceCalled('Directory',
+ '/hadoop/falcon',
+ owner='falcon',
+ recursive=True, )
+ self.assertResourceCalled('Directory', '/hadoop/falcon/activemq',
+ owner='falcon',
+ recursive=True, )
+ self.assertResourceCalled('File', '/etc/falcon/conf/runtime.properties',
+ content=Template('runtime.properties.j2'),
+ mode=0644, )
+ self.assertResourceCalled('File', '/etc/falcon/conf/startup.properties',
+ content=Template('startup.properties.j2'),
+ mode=0644, )
+ self.assertNoMoreResources()
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_service_check.py
new file mode 100644
index 0000000..9ae6f67
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/FALCON/test_service_check.py
@@ -0,0 +1,42 @@
+#!/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 *
+
+
+class TestFalconServer(RMFTestCase):
+
+ def test_service_check(self):
+ self.executeScript("2.1.1/services/FALCON/package/scripts/service_check.py",
+ classname="FalconServiceCheck",
+ command="service_check",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'env '
+ 'JAVA_HOME=/usr/jdk64/jdk1.7.0_45 FALCON_LOG_DIR=/var/log/falcon '
+ 'FALCON_PID_DIR=/var/run/falcon '
+ 'FALCON_DATA_DIR=/hadoop/falcon/activemq '
+ '/usr/lib/falcon/bin/falcon admin -version',
+ logoutput = True,
+ tries = 3,
+ user = 'ambari-qa',
+ try_sleep = 20,)
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_monitor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_monitor.py b/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_monitor.py
new file mode 100644
index 0000000..ee2f735
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_monitor.py
@@ -0,0 +1,169 @@
+#!/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 *
+
+
+class TestGangliaMonitor(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Directory', '/etc/ganglia/hdp',
+ owner = 'root',
+ group = 'hadoop',
+ recursive = True,
+ )
+ self.assertResourceCalled('Directory', '/usr/libexec/hdp/ganglia',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmetad',
+ content = StaticFile('gmetad.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmond',
+ content = StaticFile('gmond.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkGmond.sh',
+ content = StaticFile('checkGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkRrdcached.sh',
+ content = StaticFile('checkRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmetadLib.sh',
+ content = StaticFile('gmetadLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmondLib.sh',
+ content = StaticFile('gmondLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/rrdcachedLib.sh',
+ content = StaticFile('rrdcachedLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/setupGanglia.sh',
+ content = StaticFile('setupGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmetad.sh',
+ content = StaticFile('startGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmond.sh',
+ content = StaticFile('startGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startRrdcached.sh',
+ content = StaticFile('startRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmetad.sh',
+ content = StaticFile('stopGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmond.sh',
+ content = StaticFile('stopGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopRrdcached.sh',
+ content = StaticFile('stopRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/teardownGanglia.sh',
+ content = StaticFile('teardownGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaClusters.conf',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaEnv.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaLib.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPNameNode -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Directory', '/etc/ganglia/conf.d',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/conf.d/modgstatus.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/conf.d/multicpu.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/gmond.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertNoMoreResources()
+
+ def test_start_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="start",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'chkconfig gmond off',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmond start >> /tmp/gmond.log 2>&1 ; /bin/ps auwx | /bin/grep [g]mond >> /tmp/gmond.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertNoMoreResources()
+
+ def test_stop_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_monitor.py",
+ classname="GangliaMonitor",
+ command="stop",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmond stop >> /tmp/gmond.log 2>&1 ; /bin/ps auwx | /bin/grep [g]mond >> /tmp/gmond.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_server.py b/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_server.py
new file mode 100644
index 0000000..fc792ef
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/GANGLIA/test_ganglia_server.py
@@ -0,0 +1,214 @@
+#!/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 *
+
+
+class TestGangliaServer(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Directory', '/usr/libexec/hdp/ganglia',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmetad',
+ content = StaticFile('gmetad.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/init.d/hdp-gmond',
+ content = StaticFile('gmond.init'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkGmond.sh',
+ content = StaticFile('checkGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/checkRrdcached.sh',
+ content = StaticFile('checkRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmetadLib.sh',
+ content = StaticFile('gmetadLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/gmondLib.sh',
+ content = StaticFile('gmondLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/rrdcachedLib.sh',
+ content = StaticFile('rrdcachedLib.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/setupGanglia.sh',
+ content = StaticFile('setupGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmetad.sh',
+ content = StaticFile('startGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startGmond.sh',
+ content = StaticFile('startGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/startRrdcached.sh',
+ content = StaticFile('startRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmetad.sh',
+ content = StaticFile('stopGmetad.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopGmond.sh',
+ content = StaticFile('stopGmond.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/stopRrdcached.sh',
+ content = StaticFile('stopRrdcached.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/usr/libexec/hdp/ganglia/teardownGanglia.sh',
+ content = StaticFile('teardownGanglia.sh'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaClusters.conf',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaEnv.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('TemplateConfig', '/usr/libexec/hdp/ganglia/gangliaLib.sh',
+ owner = 'root',
+ template_tag = None,
+ group = 'root',
+ mode = 0755,
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPNameNode -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHBaseMaster -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPResourceManager -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPNodeManager -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHistoryServer -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPDataNode -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -c HDPHBaseRegionServer -m -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Execute', '/usr/libexec/hdp/ganglia/setupGanglia.sh -t -o root -g hadoop',
+ path = ['/usr/libexec/hdp/ganglia',
+ '/usr/sbin',
+ '/sbin:/usr/local/bin',
+ '/bin',
+ '/usr/bin'],
+ )
+ self.assertResourceCalled('Directory', '/var/lib/ganglia/dwoo',
+ owner = 'nobody',
+ recursive = True,
+ mode = 0777,
+ )
+ self.assertResourceCalled('Directory', '/srv/www/cgi-bin',
+ recursive = True,
+ )
+ self.assertResourceCalled('File', '/srv/www/cgi-bin/rrd.py',
+ content = StaticFile('rrd.py'),
+ mode = 0755,
+ )
+ self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
+ owner = 'root',
+ group = 'hadoop',
+ )
+ self.assertNoMoreResources()
+
+ def test_start_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="start",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmetad start >> /tmp/gmetad.log 2>&1 ; /bin/ps auwx | /bin/grep [g]metad >> /tmp/gmetad.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('MonitorWebserver', 'restart',
+ )
+ self.assertNoMoreResources()
+
+ def test_stop_default(self):
+ self.executeScript("2.1.1/services/GANGLIA/package/scripts/ganglia_server.py",
+ classname="GangliaServer",
+ command="stop",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'service hdp-gmetad stop >> /tmp/gmetad.log 2>&1 ; /bin/ps auwx | /bin/grep [g]metad >> /tmp/gmetad.log 2>&1',
+ path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ )
+ self.assertResourceCalled('MonitorWebserver', 'restart',
+ )
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_service_check.py b/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_service_check.py
new file mode 100644
index 0000000..c2aec47
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_service_check.py
@@ -0,0 +1,50 @@
+#!/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 TestSqoopServiceCheck(RMFTestCase):
+
+ def test_service_check_secured(self):
+ self.executeScript("2.1.1/services/SQOOP/package/scripts/service_check.py",
+ classname = "SqoopServiceCheck",
+ command = "service_check",
+ config_file="secured.json"
+ )
+ self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa',)
+ self.assertResourceCalled('Execute', 'sqoop version',
+ logoutput = True,
+ user = 'ambari-qa',)
+ self.assertNoMoreResources()
+
+ def test_service_check_default(self):
+ self.executeScript("2.1.1/services/SQOOP/package/scripts/service_check.py",
+ classname = "SqoopServiceCheck",
+ command = "service_check",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Execute', 'sqoop version',
+ logoutput = True,
+ user = 'ambari-qa',)
+ self.assertNoMoreResources()
+
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_sqoop.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_sqoop.py b/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_sqoop.py
new file mode 100644
index 0000000..92c0d17
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.1.1/SQOOP/test_sqoop.py
@@ -0,0 +1,52 @@
+#!/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 TestSqoop(RMFTestCase):
+
+ def test_configure_default(self):
+ self.executeScript("1.3.3/services/SQOOP/package/scripts/sqoop_client.py",
+ classname = "SqoopClient",
+ command = "configure",
+ config_file="default.json"
+ )
+ self.assertResourceCalled('Link', '/usr/lib/sqoop/lib/mysql-connector-java.jar',
+ to = '/usr/share/java/mysql-connector-java.jar',)
+ self.assertResourceCalled('Directory', '/usr/lib/sqoop/conf',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('TemplateConfig', '/usr/lib/sqoop/conf/sqoop-env.sh',
+ owner = 'sqoop',
+ template_tag = None,)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-env-template.sh',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-site-template.xml',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertResourceCalled('File', '/usr/lib/sqoop/conf/sqoop-site.xml',
+ owner = 'sqoop',
+ group = 'hadoop',)
+ self.assertNoMoreResources()
+
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc102b32/ambari-server/src/test/python/stacks/2.1.1/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/configs/default.json b/ambari-server/src/test/python/stacks/2.1.1/configs/default.json
index 9069853..7d4e9a6 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.1.1/configs/default.json
@@ -12,7 +12,8 @@
"ambari_db_rca_driver": "org.postgresql.Driver",
"jdk_name": "jdk-7u45-linux-x64.tar.gz",
"ambari_db_rca_username": "mapred",
- "java_home": "/usr/jdk64/jdk1.7.0_45"
+ "java_home": "/usr/jdk64/jdk1.7.0_45",
+ "db_name": "ambari"
},
"commandType": "EXECUTION_COMMAND",
"roleParams": {},
@@ -285,7 +286,12 @@
"hadoop_heapsize": "1024",
"hadoop_pid_dir_prefix": "/var/run/hadoop",
"nagios_user": "nagios",
- "hbase_log_dir": "/var/log/hbase"
+ "hbase_log_dir": "/var/log/hbase",
+ "falcon_user": "falcon",
+ "falcon_port": "15000",
+ "falcon_local_dir": "/hadoop/falcon",
+ "falcon_store_uri": "file:///hadoop/falcon/store",
+ "rca_enabled": "false"
},
"capacity-scheduler": {
"yarn.scheduler.capacity.node-locality-delay": "40",
@@ -540,7 +546,7 @@
],
"logviewer_server_hosts": [
"c6402.ambari.apache.org"
- ],
+ ],
"hive_metastore_hosts": [
"c6402.ambari.apache.org"
],
@@ -596,6 +602,9 @@
],
"hive_mysql_host": [
"c6402.ambari.apache.org"
+ ],
+ "falcon_server_hosts": [
+ "c6402.ambari.apache.org"
]
}
}
\ No newline at end of file