ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [25/37] git commit: AMBARI-5986. Unittests for datanode and nodemanager decomission are absent (aonishuk)
Date Wed, 24 Sep 2014 20:53:24 GMT
AMBARI-5986. Unittests for datanode and nodemanager decomission are absent (aonishuk)


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

Branch: refs/heads/branch-alerts-dev
Commit: e13db051f8cb6e9eebe02926fa268a1be13ce5dd
Parents: 03a1ff9
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Wed Sep 24 18:42:11 2014 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Wed Sep 24 18:42:11 2014 +0300

----------------------------------------------------------------------
 .../python/stacks/1.3.2/HDFS/test_namenode.py   | 37 ++++++++++++++++++++
 .../python/stacks/2.0.6/HDFS/test_namenode.py   | 25 ++++++++++++-
 .../stacks/2.0.6/YARN/test_resourcemanager.py   | 36 +++++++++++++++++++
 .../python/stacks/2.0.6/configs/default.json    |  1 +
 .../python/stacks/2.0.6/configs/secured.json    |  3 +-
 5 files changed, 100 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e13db051/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_namenode.py
index fc87c79..7cc4a1f 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_namenode.py
@@ -211,6 +211,43 @@ class TestNamenode(RMFTestCase):
                               action = ['delete'],
                               )
     self.assertNoMoreResources()
+    
+    
+  def test_decommission_default(self):
+    self.executeScript("1.3.2/services/HDFS/package/scripts/namenode.py",
+                       classname = "NameNode",
+                       command = "decommission",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/etc/hadoop/conf/dfs.exclude',
+        owner = 'hdfs',
+        content = Template('exclude_hosts_list.j2'),
+        group = 'hadoop',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'dfsadmin -refreshNodes',
+        conf_dir = '/etc/hadoop/conf',
+        kinit_override = True,
+        user = 'hdfs',
+    )
+    self.assertNoMoreResources()
+    
+  def test_decommission_secured(self):
+    self.executeScript("1.3.2/services/HDFS/package/scripts/namenode.py",
+                       classname = "NameNode",
+                       command = "decommission",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/etc/hadoop/conf/dfs.exclude',
+        owner = 'hdfs',
+        content = Template('exclude_hosts_list.j2'),
+        group = 'hadoop',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'dfsadmin -refreshNodes',
+        conf_dir = '/etc/hadoop/conf',
+        kinit_override = True,
+        user = 'hdfs',
+    )
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
     self.assertResourceCalled('File', '/etc/security/limits.d/hdfs.conf',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e13db051/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
index c7d2601..bf26877 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
@@ -393,7 +393,7 @@ class TestNamenode(RMFTestCase):
                               kinit_override = True)
     self.assertNoMoreResources()
 
-  def test_decommission_ha(self):
+  def test_decommission_ha_default(self):
     self.executeScript("2.0.6/services/HDFS/package/scripts/namenode.py",
                        classname = "NameNode",
                        command = "decommission",
@@ -411,6 +411,29 @@ class TestNamenode(RMFTestCase):
                               bin_dir = '/usr/bin',
                               kinit_override = True)
     self.assertNoMoreResources()    
+    
+    
+  def test_decommission_secured(self):
+    self.executeScript("2.0.6/services/HDFS/package/scripts/namenode.py",
+                       classname = "NameNode",
+                       command = "decommission",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/etc/hadoop/conf/dfs.exclude',
+        owner = 'hdfs',
+        content = Template('exclude_hosts_list.j2'),
+        group = 'hadoop',
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/dn.service.keytab
dn/c6401.ambari.apache.org@EXAMPLE.COM;',
+        user = 'hdfs',
+    )
+    self.assertResourceCalled('ExecuteHadoop', 'dfsadmin -refreshNodes',
+        bin_dir = '/usr/bin',
+        conf_dir = '/etc/hadoop/conf',
+        kinit_override = True,
+        user = 'hdfs',
+    )
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
     self.assertResourceCalled('File', '/etc/security/limits.d/hdfs.conf',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e13db051/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
index 05a1cb6..69f53c2 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
@@ -110,6 +110,42 @@ class TestResourceManager(RMFTestCase):
     self.assertResourceCalled('File', '/var/run/hadoop-yarn/yarn/yarn-yarn-resourcemanager.pid',
                               action=['delete'])
     self.assertNoMoreResources()
+    
+    
+  def test_decommission_default(self):
+    self.executeScript("2.0.6/services/YARN/package/scripts/resourcemanager.py",
+                       classname = "Resourcemanager",
+                       command = "decommission",
+                       config_file="default.json"
+    )
+    self.assertResourceCalled('File', '/etc/hadoop/conf/yarn.exclude',
+        owner = 'yarn',
+        content = Template('exclude_hosts_list.j2'),
+        group = 'hadoop',
+    )
+    self.assertResourceCalled('Execute', ' yarn --config /etc/hadoop/conf rmadmin -refreshNodes',
+        environment = {'PATH': os.environ['PATH'] + ":/usr/bin:/usr/lib/hadoop-yarn/bin"},
+        user = 'yarn',
+    )
+    self.assertNoMoreResources()
+    
+  def test_decommission_secured(self):
+    self.executeScript("2.0.6/services/YARN/package/scripts/resourcemanager.py",
+                       classname = "Resourcemanager",
+                       command = "decommission",
+                       config_file="secured.json"
+    )
+    self.assertResourceCalled('File', '/etc/hadoop/conf/yarn.exclude',
+        owner = 'yarn',
+        content = Template('exclude_hosts_list.j2'),
+        group = 'hadoop',
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/rm.service.keytab
rm/c6401.ambari.apache.org@EXAMPLE.COM; yarn --config /etc/hadoop/conf rmadmin -refreshNodes',
+        environment = {'PATH': os.environ['PATH'] + ":/usr/bin:/usr/lib/hadoop-yarn/bin"},
+        user = 'yarn',
+    )
+    
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e13db051/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
index 0c3422f..ef279b4 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
@@ -29,6 +29,7 @@
         "script": "scripts/service_check.py",
         "excluded_hosts": "host1,host2",
         "mark_draining_only" : "false",
+        "update_exclude_file_only" : "false",
         "xml_configs_list":[{"hdfs-site.xml":"hdfs-site"}],
         "env_configs_list":[{"hadoop-env.sh":"hadoop-env"},{"log4j.properties":"hdfs-log4j,yarn-log4j"}],
         "output_file":"HDFS_CLIENT-configs.tar.gz"

http://git-wip-us.apache.org/repos/asf/ambari/blob/e13db051/ambari-server/src/test/python/stacks/2.0.6/configs/secured.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/secured.json b/ambari-server/src/test/python/stacks/2.0.6/configs/secured.json
index 3642af6..a484853 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/secured.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/secured.json
@@ -29,7 +29,8 @@
         "script_type": "PYTHON",
         "script": "scripts/yarn_client.py",
         "excluded_hosts": "host1",
-        "mark_draining_only" : "false"
+        "mark_draining_only" : "false",
+        "update_exclude_file_only" : "false"
     },
     "taskId": 186, 
     "public_hostname": "c6401.ambari.apache.org", 


Mime
View raw message