From eba1806f15f9359b5f26f2ad41e982c54a350467 Mon Sep 17 00:00:00 2001 From: asreekumar Date: Tue, 18 Nov 2014 17:46:48 -0800 Subject: [PATCH] Add E2E test for templeton.mapper.memory.mb property --- hcatalog/src/test/e2e/templeton/README.txt | 12 ++++ hcatalog/src/test/e2e/templeton/build.xml | 29 ++++++++++ .../deployers/config/webhcat/webhcat-site.xml | 12 ++++ .../templeton/deployers/deploy_e2e_artifacts.sh | 3 + .../e2e/templeton/tests/modifyConfiguration.conf | 64 ++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 hcatalog/src/test/e2e/templeton/tests/modifyConfiguration.conf diff --git a/hcatalog/src/test/e2e/templeton/README.txt b/hcatalog/src/test/e2e/templeton/README.txt index d272985..1478d7e 100644 --- a/hcatalog/src/test/e2e/templeton/README.txt +++ b/hcatalog/src/test/e2e/templeton/README.txt @@ -205,6 +205,18 @@ Here is the schema of the table writen in MySQL: To prevent primary key violation and sqoop import directory conflict, make sure the "PERSON" table is empty and the folder hdfs://hostname:8020/sqoopoutputdir doesn't exist before running the test. +Running updateConfig tests +-------------------------- +ant test-updateConfig -Dinpdir.hdfs= -Dtest.user.name= \ + -Dsecure.mode= -Dharness.webhdfs.url= -Dharness.templeton.url= + +This test suite is trying to verify the use of property templeton.mapper.memory.mb in webhcat-site.xml. +For this, an attempt is made to load data of size greater than 100MB, from one hive table to another hive table, +with the templeton.mapper.memory.mb set to a very low value. This is a negative test case that expects the failure of map job +due to insufficient memory. + +For running this test suite templeton.mapper.memory.mb property should be set to 0.01 in webhcat-site.xml + Notes ----- It's best to set HADOOP_HOME_WARN_SUPPRESS=true everywhere you can. diff --git a/hcatalog/src/test/e2e/templeton/build.xml b/hcatalog/src/test/e2e/templeton/build.xml index ee98a99..eefbd7a 100644 --- a/hcatalog/src/test/e2e/templeton/build.xml +++ b/hcatalog/src/test/e2e/templeton/build.xml @@ -197,6 +197,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hcatalog/src/test/e2e/templeton/deployers/config/webhcat/webhcat-site.xml b/hcatalog/src/test/e2e/templeton/deployers/config/webhcat/webhcat-site.xml index 8984503..8b227dc 100644 --- a/hcatalog/src/test/e2e/templeton/deployers/config/webhcat/webhcat-site.xml +++ b/hcatalog/src/test/e2e/templeton/deployers/config/webhcat/webhcat-site.xml @@ -148,4 +148,16 @@ --> + diff --git a/hcatalog/src/test/e2e/templeton/deployers/deploy_e2e_artifacts.sh b/hcatalog/src/test/e2e/templeton/deployers/deploy_e2e_artifacts.sh index 8a4621f..2999f55 100755 --- a/hcatalog/src/test/e2e/templeton/deployers/deploy_e2e_artifacts.sh +++ b/hcatalog/src/test/e2e/templeton/deployers/deploy_e2e_artifacts.sh @@ -25,6 +25,9 @@ source ./env.sh echo "Deploying artifacts to HDFS..." +curl -O http://files.grouplens.org/datasets/movielens/ml-1m.zip +unzip ml-1m.zip +mv ml-1m/ratings.dat ${PROJ_HOME}/hcatalog/src/test/e2e/templeton/inpdir/ratings.txt ${HADOOP_HOME}/bin/hdfs dfs -put ${PROJ_HOME}/hcatalog/src/test/e2e/templeton/inpdir/ webhcate2e #For hadoop1 we copy the same file with 2 names #$HADOOP_HOME/bin/hadoop fs -put hadoop-examples-1.2.1.jar webhcate2e/hexamples.jar diff --git a/hcatalog/src/test/e2e/templeton/tests/modifyConfiguration.conf b/hcatalog/src/test/e2e/templeton/tests/modifyConfiguration.conf new file mode 100644 index 0000000..bab047f --- /dev/null +++ b/hcatalog/src/test/e2e/templeton/tests/modifyConfiguration.conf @@ -0,0 +1,64 @@ +# 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. + +############################################################################### +# curl command tests for templeton +# +# + +#use Yahoo::Miners::Test::PigSetup; + +#PigSetup::setup(); + +#my $me = `whoami`; +#chomp $me; +$cfg = +{ + 'driver' => 'Curl', + + 'groups' => + [ +##============================================================================================================= + { + 'name' => 'ModifyWebhcatConfig', + 'tests' => + [ + { + #test to verify templeton.mapper.memory.mb update + 'num' => 1, + 'setup' => [ + { + 'method' => 'POST', + 'url' => ':TEMPLETON_URL:/templeton/v1/ddl', + 'status_code' => 200, + 'post_options' => ['user.name=:UNAME:','exec=drop table if exists ratings;CREATE EXTERNAL TABLE ratings(userid INT, movieid INT, ratings FLOAT, unixtime STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY \':\' location \':INPDIR_HDFS:/ratings/\';drop table if exists testtable;create table testtable(userid INT, movieid INT, ratings FLOAT, unixtime STRING) location \':INPDIR_HDFS:/testtable/\';'],'json_field_substr_match' => {'stderr' => 'OK'} + } + ], + 'method' => 'POST', + 'url' => ':TEMPLETON_URL:/templeton/v1/hive', + 'post_options' => ['user.name=:UNAME:','execute=INSERT OVERWRITE TABLE testtable SELECT * from ratings','statusdir=:OUTDIR:/status'], + 'json_field_substr_match' => { 'id' => '\d+'}, + #results + 'status_code' => 200, + 'check_job_created' => 1, + 'check_job_complete' => 'FAILURE', + } + ] + } + ] +}, + ; \ No newline at end of file -- 1.8.5.2 (Apple Git-48)