incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-2678. Zookeeper smoke does not fail for exceptions thrown by zkCli. (swagle)
Date Mon, 22 Jul 2013 17:50:34 GMT
Updated Branches:
  refs/heads/trunk 256c30917 -> 7b2d01a2f


AMBARI-2678. Zookeeper smoke does not fail for exceptions thrown by zkCli. (swagle)


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

Branch: refs/heads/trunk
Commit: 7b2d01a2f966afeba4360e6bb3efdd1a0ac6794f
Parents: 256c309
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Mon Jul 22 10:50:23 2013 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Mon Jul 22 10:50:29 2013 -0700

----------------------------------------------------------------------
 .../modules/hdp-zookeeper/files/zkSmoke.sh      | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7b2d01a2/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh b/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh
index e9609c9..64db50c 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh
+++ b/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh
@@ -28,6 +28,9 @@ security_enabled=$5
 kinit_path_local=$6
 smoke_user_keytab=$7
 export ZOOKEEPER_EXIT_CODE=0
+test_output_file=/tmp/zkSmoke.out
+errors_expr="ERROR|Exception"
+
 zkhosts=` grep "^server\.[[:digit:]]"  $conf_dir/zoo.cfg  | cut -f 2 -d '=' | cut -f 1 -d
':' | tr '\n' ' ' `
 zk_node1=`echo $zkhosts | tr ' ' '\n' | head -n 1`  
 echo "zk_node1=$zk_node1"
@@ -35,10 +38,23 @@ if [[ $security_enabled == "true" ]]; then
   kinitcmd="$kinit_path_local -kt $smoke_user_keytab $smoke_user"
   su - $smoke_user -c "$kinitcmd"
 fi
+
+function verify_output() {
+  if [ -f $test_output_file ]; then
+    errors=`grep -iE $errors_expr $test_output_file`
+    if [ "$?" -eq 0 ]; then
+      echo "Error found in the zookeeper smoke test. Exiting."
+      echo $errors
+      exit 1
+    fi
+  fi
+}
+
 # Delete /zk_smoketest znode if exists
-su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ;  echo delete /zk_smoketest | ${smoke_script}
-server $zk_node1:$client_port"
+su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ;  echo delete /zk_smoketest | ${smoke_script}
-server $zk_node1:$client_port 2>&1 >> $test_output_file"
 # Create /zk_smoketest znode on one zookeeper server
-su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo create /zk_smoketest smoke_data
| ${smoke_script} -server $zk_node1:$client_port"
+su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo create /zk_smoketest smoke_data
| ${smoke_script} -server $zk_node1:$client_port 2>&1 >> $test_output_file"
+verify_output
 
 for i in $zkhosts ; do
   echo "Running test on host $i"


Mime
View raw message