| # 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' => 'TestStreaming', |
| 'tests' => |
| [ |
| { |
| 'num' => 1, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', |
| 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt','output=:OUTDIR:/mycounts', |
| 'mapper=/bin/cat', 'reducer=/usr/bin/wc'], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| { |
| #-ve test - no input file |
| 'num' => 2, |
| 'ignore' => 'wait for fix in hadoop 1.0.3', |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', |
| 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt','output=:OUTDIR:/mycounts', |
| 'mapper=/bin/ls no_such-file-12e3', 'reducer=/usr/bin/wc'], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'FAILURE', |
| 'check_call_back' => 1, |
| }, |
| |
| ] |
| }, |
| ##============================================================================================================= |
| { |
| 'name' => 'TestKillJob', |
| 'tests' => |
| [ |
| { |
| 'num' => 1, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', |
| 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt','output=:OUTDIR:/mycounts', |
| 'mapper=/bin/sleep 100', 'reducer=/usr/bin/wc'], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'KILLED', |
| # 'check_call_back' => 1, #TODO - enable call back check after fix |
| 'kill_job_timeout' => 10, |
| }, |
| ] |
| }, |
| ##============================================================================================================= |
| { |
| 'name' => 'TestMapReduce', |
| 'tests' => |
| [ |
| { |
| |
| 'num' => 1, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/jar', |
| 'post_options' => ['user.name=:UNAME:','arg=:INPDIR_HDFS:/nums.txt', 'arg= :OUTDIR:/wc.txt', |
| 'jar=:INPDIR_HDFS:/hexamples.jar', 'class=wordcount', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| ] |
| }, |
| ##============================================================================================================= |
| { |
| 'name' => 'TestPig', |
| 'tests' => |
| [ |
| { |
| #test syntax error |
| 'ignore' => 'fails in current version', |
| 'num' => 1, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:','execute=asdf', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'FAILURE', |
| 'check_call_back' => 1, |
| }, |
| { |
| #valid syntax, hdfs operation through pig |
| 'num' => 2, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:','execute=fs -ls :INPDIR_HDFS:;', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| { |
| #syntax check - valid syntax |
| 'num' => 3, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:','arg=-check', 'file=:INPDIR_HDFS:/loadstore.pig', 'arg=-p', 'arg=INPDIR=:INPDIR_HDFS:','arg=-p', 'arg=OUTDIR=:OUTDIR:', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| { |
| #syntax check cmd - valid syntax |
| 'num' => 4, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:', 'arg=-d', 'arg=INFO' , 'execute=fs -ls :INPDIR_HDFS: ', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #a simple load store script |
| 'num' => 5, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:', 'arg=-p', 'arg=INPDIR=:INPDIR_HDFS:','arg=-p', 'arg=OUTDIR=:OUTDIR:', 'file=:INPDIR_HDFS:/loadstore.pig', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| |
| { |
| #pig query registering jar |
| 'num' => 6, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:', 'arg=-p', 'arg=INPDIR=:INPDIR_HDFS:','arg=-p', 'arg=OUTDIR=:OUTDIR:', 'file=:INPDIR_HDFS:/jarregistered.pig', |
| 'files=:INPDIR_HDFS:/piggybank.jar' ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #macro |
| 'num' => 7, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:', 'arg=-p', 'arg=INPDIR=:INPDIR_HDFS:','arg=-p', 'arg=OUTDIR=:OUTDIR:', 'file=:INPDIR_HDFS:/rowcount_withmacro.pig', |
| 'files=:INPDIR_HDFS:/rowcountmacro.pig' ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #no file to be copied, should result in launcher job error |
| 'num' => 8, |
| ignore => 'check is disabled for now in templeton', |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/pig', |
| 'post_options' => ['user.name=:UNAME:', 'arg=-p', 'arg=INPDIR=:INPDIR_HDFS:','arg=-p', 'arg= OUTDIR=:OUTDIR:', 'file=:INPDIR_HDFS:/no_such_file.pig', |
| 'files=:INPDIR_HDFS:/rowcountmacro.pig' ], |
| 'json_field_substr_match' => { 'error' => 'does not exist'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_complete' => 'FAILURE', |
| |
| }, |
| |
| |
| |
| #test 9 |
| #TODO jython test |
| |
| |
| |
| |
| ] |
| }, |
| ##============================================================================================================= |
| { |
| 'name' => 'TestHive', |
| 'tests' => |
| [ |
| { |
| #test syntax error |
| 'ignore' => 'fails in current version', |
| 'num' => 1, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=asdf', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'FAILURE', |
| |
| }, |
| |
| { |
| #test show tables |
| 'num' => 2, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=show tables', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #test show tables |
| 'num' => 3, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=drop table if exists mynums;', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| { |
| #test show tables |
| 'num' => 4, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=create external table mynums(a int, b int) location ":INPDIR_HDFS:/numstable/";', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #test describe |
| 'num' => 5, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=describe formatted mynums', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #test select * |
| 'num' => 6, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=select * from mynums', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| }, |
| |
| { |
| #test select a,b |
| 'num' => 7, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=select a,b from mynums', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| 'check_call_back' => 1, |
| |
| }, |
| |
| |
| { |
| #test udfs : select a,rand(b) |
| 'num' => 8, |
| 'method' => 'POST', |
| 'url' => ':TEMPLETON_URL:/templeton/v1/hive', |
| 'post_options' => ['user.name=:UNAME:','execute=select a,rand(b) from mynums', ], |
| 'json_field_substr_match' => { 'id' => '\d+'}, |
| #results |
| 'status_code' => 200, |
| 'check_job_created' => 1, |
| 'check_job_complete' => 'SUCCESS', |
| |
| }, |
| |
| |
| |
| ] |
| }, |
| |
| |
| |
| |
| |
| |
| |
| ] |
| }, |
| ; |
| |